Jump to content

  • Log In with Google      Sign In   
  • Create Account


Shockwave

Member Since 17 Apr 2005
Offline Last Active Jul 15 2014 03:07 AM

Topics I've Started

Terrain type related problems in RTS game

07 April 2014 - 05:21 AM

Hi,

I've started a small RTS project and had encountered some interesting problems for which I can't find solutions in the Internet and thus I've made my own algos for solving 'em but I'm not sure that I'm not inventing a wheel (and even that it's not a square wheel smile.png ).

 

Lets say we have a terrain built from a heightmap and with textures applied to it using splatting. There are 4 textures: sand, stone (red), grass, snow.

 

1. I want to allow construction of buildings only on terrain covered by stone. One of the approaches I can think of is to have a quadtree structure where sectors have boolean value saying if sector is constructible or not. The smallest size of quadtree's region is a size of smallest building's aabb. This boolean value in quadtree tree node is set according to color of region of pixels in splatting texture (if all pixels are red, mark this node as one in which building construction is allowed).

 

2. I have a vehicle and I want to change its speed according to terrain type (for example, on sand vehicle's speed should be reduced by 0.4, etc.). So I need to know on what terrain type vehicle is on. I thought of checking splatting map's pixel color in the current position of vehicle but I'm not sure this is a correct approach.

 

So guys I need your opinion, if described solutions are good or I'm inventing square wheel. Any help will be much appreciated.

 

Thanks in advance


DirectX 9 Effect framework and XNA math problem

15 February 2011 - 08:15 AM

I've decided to change math library in my engine (GAPI - DirectX9) from D3DX to XNA from the new DX SDK. The problem is that I can't find a way to pass my matrices to shader through Effect framework SetMatrix function. I tried (float*), (D3DMATRIX *) and many other things but no success.

Here's a structure of XMMATRIX according to SDK help:
typedef struct _XMMATRIX {
    union {
        XMVECTOR r[4];
        struct {
            FLOAT _11;
            FLOAT _12;
            FLOAT _13;
            FLOAT _14;
            FLOAT _21;
            FLOAT _22;
            FLOAT _23;
            FLOAT _24;
            FLOAT _31;
            FLOAT _32;
            FLOAT _33;
            FLOAT _34;
            FLOAT _41;
            FLOAT _42;
            FLOAT _43;
            FLOAT _44;
        };
        FLOAT m[4][4];
    };
} XMMATRIX;
Please if anyone know how to solve this issue (pass XMMATRIX to fx shader through SetMatrix function) I'd gladly listen to the solution :)

edit:
In drawScene function I have:
HR(mFX->SetMatrix(mhP, &mProj));
where mFX ->
ID3DXEffect*  mFX;
mhP->
D3DXHANDLE mhP;
mProj ->
XMMATRIX mProj;
If I use D3DX matrix - everything is fine. But if I use XMMATRIX - I receive the following compiler error: error C2664: 'ID3DXEffect::SetMatrix' : cannot convert parameter 2 from 'XMMATRIX *' to 'const D3DXMATRIX *' on this line.

[updated]how to convert from GLSL to HLSL?

12 March 2006 - 06:51 AM

Maybe somebody knows a program for converting from GLSL to HLSL code or can advise some article/tutorial/thread on a forum about how to convert manually GLSL instructions into HLSL one? For example I'm confused with varying variables. Thanks in advance. [Edited by - Shockwave on March 13, 2006 8:43:54 AM]

BSP tree and lightmaps

29 April 2005 - 08:13 AM

Please help me! I cann't find any tutorial about using BSP tree to generate lightmaps on DirectX 9. Could you help me giving some information or links about it. I don't want to use a Quake3 bsp. Best regards, Peter

PARTNERS