[SOURCE]
class CTerrain
{
public:
CTerrain()
{
m_pNext = NULL;
};
int m_iWidth;
int m_iHeight;
int m_iCapWidth;
int m_iCapHeight;
Vector m_vecMin;
Vector m_vecMax;
BOOL m_bLayer1;
BOOL m_bLayer2;
BOOL m_bLayer3;
char *m_pszTexture0;
char *m_pszTexture1;
char *m_pszTexture2;
char *m_pszTexture3;
CShader *m_pShader0;
CShader *m_pShader1;
CShader *m_pShader2;
CShader *m_pShader3;
float *m_pVertexArray;
float *m_pUVArray;
float *m_pNormalArray;
float *m_pBlendFactor;
int *m_pIndex;
CTerrain *m_pNext;
};
[/SOURCE]
rendering 4 layered terrain as fast as possible
hi
here s the class that holds terrain batches in my engine
-the psztexture pointers hold the name of the texture that is use for the correspondent layer
-blendfactor holds RGB values for blending layer 1 2 3 onto the baselayer 0
-m_pShader* are pointers to structures that hold the properties defined in .shader files
now to the CShader thing
it contains
material properties used for opengl lighting like mat_ambient ...
you specify dot3 bumpmaps parallax mapping there
you can give each texture a detailmap and specify the blendmode
so if i use dot3 bumpmapping parallax mapping and a detailmap for each layer i get up to 16 texture units, the maximum on a geforce 6800
now my batches are devided into 512*512 units e.g. the player is 72 units large and i want to feature up to 8 lights
now i don t know how i should render all this the most efficient way
i will need multiple passes thats clear + the shadowmaps for the directional, spot and omnidirectional pointlights
should i render each layer in a separate pass?
or write a dynamic pixel and vertex shader (shader branching is supported on gf6800 cards) ?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement