diff options
author | Ixtli <cg@325i.org> | 2010-03-06 21:01:05 +0900 |
---|---|---|
committer | Enne Walker <ennewalker@users.sourceforge.net> | 2010-04-24 10:19:41 -0400 |
commit | 39c67a47583ff614d09aa7ed15cce6595d50ebd8 (patch) | |
tree | 1096d02f16ada38fb3cc0533f723d926d63b1429 /crawl-ref/source/glwrapper.h | |
parent | 780665a3fb385d397c6f3e92cffee89df3ff94db (diff) | |
download | crawl-ref-39c67a47583ff614d09aa7ed15cce6595d50ebd8.tar.gz crawl-ref-39c67a47583ff614d09aa7ed15cce6595d50ebd8.zip |
Added GLPrimitive to glwrapper, condenced all vert-drawing methods to drawGLPrimitives and then updated tilebuf, font, reg, and sdl to use it propperly.
As well, tilebuf's VertBuffer::draw() method needed to be changed to allow passing to pre-render transformations (used in submerged tile rendering.)
Diffstat (limited to 'crawl-ref/source/glwrapper.h')
-rw-r--r-- | crawl-ref/source/glwrapper.h | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/crawl-ref/source/glwrapper.h b/crawl-ref/source/glwrapper.h index fbc4526e94..fb63c20c09 100644 --- a/crawl-ref/source/glwrapper.h +++ b/crawl-ref/source/glwrapper.h @@ -9,6 +9,16 @@ #ifdef USE_TILE #ifdef USE_GL +struct GLW_3VF +{ + GLW_3VF() {}; + GLW_3VF(float l, float m, float n) : x(l), y(m), z(n) {} + + float x; + float y; + float z; +}; + enum MipMapOptions { MIPMAP_CREATE, @@ -27,6 +37,27 @@ typedef enum GLW_QUADS } drawing_modes; +struct GLPrimitive +{ + GLPrimitive(long unsigned int sz, size_t ct, unsigned int vs, + const void* v_pt, const void *c_pt, const void *t_pt); + + // Primitive Metadata + drawing_modes mode; + unsigned int vertSize; // Coords per vertex + long unsigned int size; + size_t count; + + // Primitive Data + const void *vert_pointer; + const void *colour_pointer; + const void *texture_pointer; + + // Primitive render manipulations + GLW_3VF *pretranslate; + GLW_3VF *prescale; +}; + struct GLState { GLState(); @@ -52,30 +83,12 @@ public: // State Manipulation static void set(const GLState& state); static void pixelStoreUnpackAlignment(unsigned int bpp); - static void pushMatrix(); - static void popMatrix(); - static void setProjectionMatrixMode(); - static void setModelviewMatrixMode(); - static void translatef(float x, float y, float z); - static void scalef(float x, float y, float z); - static void loadIdentity(); - static void clearBuffers(); - - // Drawing Quads - static void drawQuadPTVert( long unsigned int size, size_t count, - const void *vert_pointer, const void *tex_pointer); - static void drawQuadPCVert( long unsigned int size, size_t count, - const void *vert_pointer, const void *color_pointer); - static void drawQuadPTCVert( long unsigned int size, size_t count, - const void *vert_pointer, const void *tex_pointer, - const void *color_pointer); - static void drawQuadP3TCVert( long unsigned int size, size_t count, - const void *vert_pointer, const void *tex_pointer, - const void *color_pointer); + static void resetViewForRedraw(float x, float y); + static void setTransform(GLW_3VF *translate, GLW_3VF *scale); + static void resetTransform(); - // Drawing Lines - static void drawLinePCVert( long unsigned int size, size_t count, - const void *vert_pointer, const void *color_pointer); + // Drawing GLPrimitives + static void drawGLPrimitive(const GLPrimitive &prim); // Drawing tiles-specific objects static void drawTextBlock(unsigned int x_pos, unsigned int y_pos, |