- rewrote sky dome rendering to use a static vertex buffer if not on OpenGL 2.x.

This commit is contained in:
Christoph Oelckers 2014-06-14 01:24:28 +02:00
commit 8d9a90cd22
8 changed files with 240 additions and 149 deletions

View file

@ -325,6 +325,7 @@ void FFlatVertexBuffer::BindVBO()
glTexCoordPointer(2,GL_FLOAT, sizeof(FFlatVertex), &VTO->u);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
}

View file

@ -95,4 +95,47 @@ private:
};
struct FSkyVertex
{
float x, y, z, u, v;
PalEntry color;
};
class FSkyVertexBuffer : public FVertexBuffer
{
public:
static const int SKYHEMI_UPPER = 1;
static const int SKYHEMI_LOWER = 2;
enum
{
SKYMODE_MAINLAYER = 0,
SKYMODE_SECONDLAYER = 1,
SKYMODE_FOGLAYER = 2
};
private:
TArray<FSkyVertex> mVertices;
TArray<unsigned int> mPrimStart;
int mRows, mColumns;
void SkyVertex(int r, int c, bool yflip);
void CreateSkyHemisphere(int hemi);
void CreateDome();
void RenderRow(int prim, int row, bool color);
public:
FSkyVertexBuffer();
virtual ~FSkyVertexBuffer();
virtual void BindVBO();
void RenderDome(FMaterial *tex, int mode);
};
#define VSO ((FSkyVertex*)NULL)
#endif