Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <gfxlib_struct.h>
Classes | |
union | INDEX |
union | VDAT |
Vertices and colors stored. More... | |
Public Member Functions | |
void | RefreshDisplayList () |
Propagates modifications to the display list. More... | |
GFXVertexList (enum POLYTYPE poly, int numVertices, const GFXVertex *vertices, int numindices, bool Mutable=false, unsigned int *index=0) | |
creates a vertex list with 1 polytype and a given number of vertices More... | |
GFXVertexList (enum POLYTYPE *poly, int numVertices, const GFXVertex *vertices, int numlists, int *offsets, bool Mutable=false, unsigned int *index=0) | |
Creates a vertex list with an arbitrary number of poly types and given vertices, num list and offsets (see above) More... | |
GFXVertexList (enum POLYTYPE poly, int numVertices, const GFXColorVertex *colors, int numindices, bool Mutable=false, unsigned int *index=0) | |
Creates a vertex list with 1 poly type and color information to boot. More... | |
GFXVertexList (enum POLYTYPE *poly, int numVertices, const GFXColorVertex *colors, int numlists, int *offsets, bool Mutable=false, unsigned int *index=0) | |
Creates a vertex list with an arbitrary number of poly types and color. More... | |
virtual | ~GFXVertexList () |
virtual int | numTris () const |
Returns number of Triangles in vertex list (counts tri strips) More... | |
virtual int | numQuads () const |
Returns number of Quads in vertex list (counts quad strips) More... | |
unsigned int | GetIndex (int offset) const |
Looks up the index in the appropriate short, char or int array. More... | |
POLYTYPE * | GetPolyType () const |
int * | GetOffsets () const |
int | GetNumLists () const |
bool | hasColor () const |
int | GetNumVertices () const |
virtual VDAT * | Map (bool read, bool write) |
void | UnMap () |
virtual VDAT * | BeginMutate (int offset) |
Returns the array of vertices to be mutated. More... | |
virtual void | EndMutate (int newsize=0) |
Ends mutation and refreshes display list. More... | |
void | LoadDrawState () |
Loads the draw state (what is active) of a given vlist for mass drawing. More... | |
virtual void | BeginDrawState (GFXBOOL lock=GFXTRUE) |
Specifies array pointers and loads the draw state of a given vlist for mass drawing. More... | |
virtual void | Draw () |
Draws a single copy of the mass-loaded vlist. More... | |
void | Draw (enum POLYTYPE poly, int numV) |
void | Draw (enum POLYTYPE poly, int numV, unsigned char *index) |
void | Draw (enum POLYTYPE poly, int numV, unsigned short *index) |
void | Draw (enum POLYTYPE poly, int numV, unsigned int *index) |
void | DrawOnce () |
Loads draw state and prepares to draw only once. More... | |
virtual void | EndDrawState (GFXBOOL lock=GFXTRUE) |
virtual void | GetPolys (GFXVertex **vert, int *numPolys, int *numTris) |
returns a packed vertex list with number of polys and number of tries to passed in arguments. Useful for getting vertex info from a mesh More... | |
Protected Member Functions | |
const GFXVertex * | GetVertex (int index) const |
Num vertices allocated. More... | |
const GFXColorVertex * | GetColorVertex (int index) const |
void | Init (enum POLYTYPE *poly, int numVertices, const GFXVertex *vert, const GFXColorVertex *colors, int numlists, int *offsets, bool Mutable, unsigned int *indices) |
Init function (call from construtor) More... | |
virtual void | Draw (enum POLYTYPE *poly, const INDEX index, const int numLists, const int *offsets) |
void | RenormalizeNormals () |
GFXVertexList () | |
Static Protected Member Functions | |
static void | VtxCopy (GFXVertexList *thus, GFXVertex *dst, int offset, int howmany) |
copies nonindexed vertices to dst vertex array More... | |
static void | ColVtxCopy (GFXVertexList *thus, GFXVertex *dst, int offset, int howmany) |
Copies nonindex colored vertices to dst vertex array. More... | |
static void | ColIndVtxCopy (GFXVertexList *thus, GFXVertex *dst, int offset, int howmany) |
Copies indexed colored vertices to dst vertex array. More... | |
static void | IndVtxCopy (GFXVertexList *thus, GFXVertex *dst, int offset, int howmany) |
Copies indexed vertices to dst vertex array. More... | |
Protected Attributes | |
int | numVertices |
union GFXVertexList::VDAT | data |
union GFXVertexList::INDEX | index |
enum POLYTYPE * | mode |
Array of modes that vertices will be drawn with. More... | |
bool | unique_mode |
int | display_list |
Display list number if list is indeed active. 0 otherwise. More... | |
int | vbo_data |
int | numlists |
number of different mode, drawn lists More... | |
int * | offsets |
char | changed |
If vertex list has been mutated since last draw. Low 3 bits store the stride of the index list (if avail). another bit for if color is presnet. More... | |
Friends | |
class | GFXSphereVertexList |
A vertex list is a list of any conglomeration of POLY TYPES. It is held for storage in an array of GFXVertex but attempts to use a display list to hold information if possible
Definition at line 491 of file gfxlib_struct.h.
|
protected |
Definition at line 602 of file gfxlib_struct.cpp.
Referenced by GFXSphereVertexList::GFXSphereVertexList().
|
inline |
creates a vertex list with 1 polytype and a given number of vertices
Definition at line 558 of file gfxlib_struct.h.
|
inline |
Creates a vertex list with an arbitrary number of poly types and given vertices, num list and offsets (see above)
Definition at line 568 of file gfxlib_struct.h.
|
inline |
Creates a vertex list with 1 poly type and color information to boot.
Definition at line 579 of file gfxlib_struct.h.
|
inline |
Creates a vertex list with an arbitrary number of poly types and color.
Definition at line 589 of file gfxlib_struct.h.
|
virtual |
Definition at line 506 of file gfxlib_struct.cpp.
References changed, GFXVertexList::VDAT::colors, data, display_list, GFXDeleteList(), HAS_COLOR, mode, offsets, vbo_data, and GFXVertexList::VDAT::vertices.
Specifies array pointers and loads the draw state of a given vlist for mass drawing.
Reimplemented in GFXSphereVertexList.
Definition at line 164 of file gfxlib_struct.cpp.
References BindBuf(), BindInd(), changed, clear_gl_error(), GFXVertexList::VDAT::colors, data, display_list, gl_options, glClientActiveTextureARB_p, glLockArraysEXT_p, HAS_COLOR, HAS_INDEX, gl_options_t::Multitexture, numVertices, print_gl_error(), GFXVertex::s, GFXColorVertex::s, GFXVertex::tx, GFXColorVertex::tx, vbo_data, and GFXVertexList::VDAT::vertices.
Referenced by PointStarVlist::BeginDrawState(), SpriteStarVlist::BeginDrawState(), GFXSphereVertexList::BeginDrawState(), Bolt::Draw(), DrawOnce(), Logo::ProcessDrawQueue(), and quadsquare::Render().
|
virtual |
Returns the array of vertices to be mutated.
Reimplemented in GFXSphereVertexList.
Definition at line 575 of file gfxlib_struct.cpp.
References Map().
Referenced by quadsquare::AddHeightMapAux(), PointStarVlist::BeginDrawState(), GFXSphereVertexList::ProceduralModification(), quadsquare::quadsquare(), quadsquare::RecomputeErrorAndLighting(), and quadsquare::Render().
|
staticprotected |
Copies indexed colored vertices to dst vertex array.
Definition at line 320 of file gl_vertex_list.cpp.
References GFXVertexList::VDAT::colors, data, GetIndex(), GFXColorVertex::i, i, j, GFXColorVertex::j, GFXColorVertex::k, GFXColorVertex::s, GFXColorVertex::t, GFXColorVertex::tw, GFXColorVertex::tx, GFXColorVertex::ty, GFXColorVertex::tz, Vector, GFXColorVertex::x, GFXColorVertex::y, and GFXColorVertex::z.
Referenced by GetPolys().
|
staticprotected |
Copies nonindex colored vertices to dst vertex array.
Definition at line 261 of file gl_vertex_list.cpp.
References GFXVertexList::VDAT::colors, data, GFXColorVertex::i, i, GFXColorVertex::j, GFXColorVertex::k, GFXColorVertex::s, GFXColorVertex::t, GFXColorVertex::tw, GFXColorVertex::tx, GFXColorVertex::ty, GFXColorVertex::tz, Vector, GFXColorVertex::x, GFXColorVertex::y, and GFXColorVertex::z.
Referenced by GetPolys().
|
protectedvirtual |
Reimplemented in GFXSphereVertexList.
Definition at line 312 of file gfxlib_struct.cpp.
References GFXVertexList::INDEX::b, BindInd(), changed, display_list, GFXBlendMode(), GFXCallList(), GFXDisable(), GFXEnable(), GFXGetBlendMode(), GFXLINE, GFXLINESTRIP, GFXPOINT, GFXPOLY, GFXPopBlendMode(), GFXPushBlendMode(), gl_batches_this_frame, gl_options, gl_vertices_this_frame, glMultiDrawArrays_p, glMultiDrawElements_p, HAS_INDEX, i, INDEX_BYTE, INDEX_SHORT, j, numlists, ONE, PolyLookup(), SMOOTH, gl_options_t::smooth_lines, gl_options_t::smooth_points, SRCALPHA, unique_mode, vbo_data, and ZERO.
Referenced by Bolt::Draw(), PointStarVlist::Draw(), SpriteStarVlist::Draw(), GFXSphereVertexList::Draw(), Logo::ProcessDrawQueue(), and quadsquare::Render().
|
virtual |
Draws a single copy of the mass-loaded vlist.
Reimplemented in GFXSphereVertexList.
Definition at line 306 of file gfxlib_struct.cpp.
References index, mode, numlists, and offsets.
Referenced by Draw(), and DrawOnce().
Definition at line 264 of file gfxlib_struct.cpp.
References GFXVertexList::INDEX::b, Draw(), and index.
Definition at line 270 of file gfxlib_struct.cpp.
References GFXVertexList::INDEX::b, changed, Draw(), HAS_INDEX, and index.
Definition at line 279 of file gfxlib_struct.cpp.
References changed, Draw(), HAS_INDEX, index, and GFXVertexList::INDEX::s.
Definition at line 288 of file gfxlib_struct.cpp.
References changed, Draw(), HAS_INDEX, GFXVertexList::INDEX::i, index, and int.
void GFXVertexList::DrawOnce | ( | ) |
Loads draw state and prepares to draw only once.
Definition at line 298 of file gfxlib_struct.cpp.
References BeginDrawState(), Draw(), EndDrawState(), GFXFALSE, and LoadDrawState().
Referenced by Mesh::DrawNow(), and Beam::ProcessDrawQueue().
Reimplemented in GFXSphereVertexList.
Definition at line 250 of file gfxlib_struct.cpp.
References changed, display_list, GFXColor4f(), glUnlockArraysEXT_p, HAS_COLOR, numVertices, and vbo_data.
Referenced by Bolt::Draw(), DrawOnce(), PointStarVlist::EndDrawState(), SpriteStarVlist::EndDrawState(), GFXSphereVertexList::EndDrawState(), Logo::ProcessDrawQueue(), and quadsquare::Render().
|
virtual |
Ends mutation and refreshes display list.
Reimplemented in GFXSphereVertexList.
Definition at line 581 of file gfxlib_struct.cpp.
References CHANGE_CHANGE, CHANGE_MUTABLE, changed, numlists, numVertices, offsets, RefreshDisplayList(), RenormalizeNormals(), UnMap(), and vbo_data.
Referenced by quadsquare::AddHeightMapAux(), PointStarVlist::BeginDrawState(), GFXSphereVertexList::ProceduralModification(), quadsquare::quadsquare(), quadsquare::RecomputeErrorAndLighting(), and quadsquare::Render().
|
protected |
Definition at line 358 of file gl_vertex_list.cpp.
References GFXVertexList::VDAT::colors, data, and index.
Looks up the index in the appropriate short, char or int array.
Definition at line 311 of file gl_vertex_list.cpp.
References GFXVertexList::INDEX::b, changed, GFXVertexList::INDEX::i, index, int, and GFXVertexList::INDEX::s.
Referenced by ColIndVtxCopy(), IndVtxCopy(), and RefreshDisplayList().
int GFXVertexList::GetNumLists | ( | ) | const |
Definition at line 625 of file gfxlib_struct.cpp.
References numlists.
|
inline |
Definition at line 611 of file gfxlib_struct.h.
References numVertices.
Referenced by PointStarVlist::BeginDrawState(), PointStarVlist::Draw(), and MeshAnimation::Init().
int * GFXVertexList::GetOffsets | ( | ) | const |
Definition at line 620 of file gfxlib_struct.cpp.
References offsets.
returns a packed vertex list with number of polys and number of tries to passed in arguments. Useful for getting vertex info from a mesh
Reimplemented in GFXSphereVertexList.
Definition at line 363 of file gl_vertex_list.cpp.
References changed, ColIndVtxCopy(), ColVtxCopy(), GFXPOLY, GFXQUAD, GFXQUADSTRIP, GFXTRI, GFXTRIFAN, GFXTRISTRIP, HAS_COLOR, HAS_INDEX, i, IndVtxCopy(), j, Map(), mode, numlists, numQuads(), numTris(), numVertices, offsets, UnMap(), and VtxCopy().
Referenced by Mesh::Fork(), Mesh::GetPolys(), and GFXSphereVertexList::GetPolys().
POLYTYPE * GFXVertexList::GetPolyType | ( | ) | const |
Num vertices allocated.
Definition at line 353 of file gl_vertex_list.cpp.
References data, index, and GFXVertexList::VDAT::vertices.
bool GFXVertexList::hasColor | ( | ) | const |
|
staticprotected |
Copies indexed vertices to dst vertex array.
Definition at line 334 of file gl_vertex_list.cpp.
References data, GetIndex(), GFXVertex::i, i, GFXVertex::j, j, GFXVertex::k, GFXVertex::s, GFXVertex::t, GFXVertex::tw, GFXVertex::tx, GFXVertex::ty, GFXVertex::tz, Vector, GFXVertexList::VDAT::vertices, GFXVertex::x, GFXVertex::y, and GFXVertex::z.
Referenced by GetPolys().
|
protected |
Init function (call from construtor)
Definition at line 99 of file gl_vertex_list.cpp.
References GFXVertexList::INDEX::b, CHANGE_CHANGE, CHANGE_MUTABLE, changed, colors, GFXVertexList::VDAT::colors, data, display_list, GFX_BUFFER_MAP_UNMAP, HAS_COLOR, i, GFXVertexList::INDEX::i, index, INDEX_BYTE, INDEX_INT, INDEX_SHORT, VsnetOSS::memcpy(), mode, numlists, numVertices, RefreshDisplayList(), RenormalizeNormals(), GFXVertexList::INDEX::s, sizeof(), unique_mode, vbo_data, GFXVertexList::VDAT::vertices, and VSFileSystem::vs_dprintf().
Referenced by GFXVertexList().
void GFXVertexList::LoadDrawState | ( | ) |
Loads the draw state (what is active) of a given vlist for mass drawing.
Definition at line 439 of file gl_vertex_list.cpp.
Referenced by PointStarVlist::BeginDrawState(), SpriteStarVlist::BeginDrawState(), Bolt::Draw(), DrawOnce(), Logo::ProcessDrawQueue(), and quadsquare::Render().
|
virtual |
Definition at line 529 of file gfxlib_struct.cpp.
References GFXVertexList::INDEX::b, BindBuf(), BindInd(), changed, GFXVertexList::VDAT::colors, data, display_list, GFX_BUFFER_MAP_UNMAP, glMapBufferARB_p, HAS_COLOR, index, vbo_data, and GFXVertexList::VDAT::vertices.
Referenced by BeginMutate(), and GetPolys().
|
virtual |
Returns number of Quads in vertex list (counts quad strips)
Definition at line 237 of file gl_vertex_list.cpp.
References GFXQUAD, GFXQUADSTRIP, i, mode, numlists, and offsets.
Referenced by GetPolys().
|
virtual |
Returns number of Triangles in vertex list (counts tri strips)
Definition at line 216 of file gl_vertex_list.cpp.
References GFXPOLY, GFXTRI, GFXTRIFAN, GFXTRISTRIP, i, mode, numlists, and offsets.
Referenced by GetPolys(), and GFXSphereVertexList::GetPolys().
void GFXVertexList::RefreshDisplayList | ( | ) |
Propagates modifications to the display list.
Definition at line 72 of file gfxlib_struct.cpp.
References a, GFXVertexList::INDEX::b, BindBuf(), BindInd(), CHANGE_CHANGE, CHANGE_MUTABLE, changed, GFXVertexList::VDAT::colors, data, display_list, gl_options_t::display_lists, GetIndex(), GFXCreateList(), GFXDeleteList(), GFXEndList(), GFXTexCoord224f(), gl_options, glBindBufferARB_p, glBufferDataARB_p, glGenBuffersARB_p, glMapBufferARB_p, glUnmapBufferARB_p, HAS_COLOR, HAS_INDEX, GFXVertex::i, GFXColorVertex::i, i, index, INDEX_BYTE, INDEX_SHORT, int, mode, numlists, numVertices, offsets, PolyLookup(), GFXColorVertex::r, GFXVertex::s, GFXColorVertex::s, GFXVertex::t, GFXColorVertex::t, GFXVertex::tw, GFXColorVertex::tw, GFXVertex::tx, GFXColorVertex::tx, GFXVertex::ty, GFXColorVertex::ty, GFXVertex::tz, GFXColorVertex::tz, vs_options::vbo, vbo_data, GFXVertexList::VDAT::vertices, GFXVertex::x, and GFXColorVertex::x.
Referenced by EndMutate(), and Init().
|
protected |
Definition at line 273 of file gl_vertex_list.cpp.
References changed, GFXVertexList::VDAT::colors, data, GFXVertex::GetNormal(), GFXColorVertex::GetNormal(), GFX_SCALE, HAS_COLOR, GFXVertex::i, GFXColorVertex::i, i, GFXVertex::j, GFXColorVertex::j, GFXVertex::k, GFXColorVertex::k, numVertices, GFXVertex::SetNormal(), GFXColorVertex::SetNormal(), Vector, and GFXVertexList::VDAT::vertices.
Referenced by EndMutate(), and Init().
void GFXVertexList::UnMap | ( | ) |
Definition at line 556 of file gfxlib_struct.cpp.
References BindBuf(), BindInd(), GFXVertexList::VDAT::colors, data, display_list, GFX_BUFFER_MAP_UNMAP, vbo_data, and GFXVertexList::VDAT::vertices.
Referenced by EndMutate(), and GetPolys().
|
staticprotected |
copies nonindexed vertices to dst vertex array
Definition at line 256 of file gl_vertex_list.cpp.
References data, VsnetOSS::memcpy(), sizeof(), and GFXVertexList::VDAT::vertices.
Referenced by GetPolys().
|
friend |
Definition at line 493 of file gfxlib_struct.h.
|
protected |
If vertex list has been mutated since last draw. Low 3 bits store the stride of the index list (if avail). another bit for if color is presnet.
Definition at line 531 of file gfxlib_struct.h.
Referenced by BeginDrawState(), Draw(), EndDrawState(), EndMutate(), GetIndex(), GetPolys(), hasColor(), Init(), Map(), RefreshDisplayList(), RenormalizeNormals(), and ~GFXVertexList().
|
protected |
|
protected |
Display list number if list is indeed active. 0 otherwise.
Definition at line 521 of file gfxlib_struct.h.
Referenced by BeginDrawState(), Draw(), EndDrawState(), GFXSphereVertexList::GFXSphereVertexList(), Init(), Map(), RefreshDisplayList(), UnMap(), GFXSphereVertexList::~GFXSphereVertexList(), and ~GFXVertexList().
|
protected |
|
protected |
Array of modes that vertices will be drawn with.
Definition at line 518 of file gfxlib_struct.h.
Referenced by Draw(), GetPolys(), GetPolyType(), GFXSphereVertexList::GFXSphereVertexList(), Init(), numQuads(), numTris(), RefreshDisplayList(), GFXSphereVertexList::~GFXSphereVertexList(), and ~GFXVertexList().
|
protected |
number of different mode, drawn lists
Definition at line 524 of file gfxlib_struct.h.
Referenced by Draw(), EndMutate(), GetNumLists(), GetPolys(), GFXSphereVertexList::GFXSphereVertexList(), Init(), numQuads(), numTris(), RefreshDisplayList(), and GFXSphereVertexList::~GFXSphereVertexList().
|
protected |
Definition at line 498 of file gfxlib_struct.h.
Referenced by BeginDrawState(), EndDrawState(), EndMutate(), GetNumVertices(), GetPolys(), GFXSphereVertexList::GFXSphereVertexList(), Init(), GFXSphereVertexList::ProceduralModification(), RefreshDisplayList(), RenormalizeNormals(), and GFXSphereVertexList::~GFXSphereVertexList().
|
protected |
number of vertices in each individual mode. 2 triangles 3 quads and 2 lines would be {6,12,4} as the offsets
Definition at line 529 of file gfxlib_struct.h.
Referenced by Draw(), EndMutate(), GetOffsets(), GetPolys(), GFXSphereVertexList::GFXSphereVertexList(), numQuads(), numTris(), RefreshDisplayList(), GFXSphereVertexList::~GFXSphereVertexList(), and ~GFXVertexList().
|
protected |
Definition at line 519 of file gfxlib_struct.h.
|
protected |
Definition at line 522 of file gfxlib_struct.h.
Referenced by BeginDrawState(), Draw(), EndDrawState(), EndMutate(), GFXSphereVertexList::GFXSphereVertexList(), Init(), Map(), RefreshDisplayList(), UnMap(), GFXSphereVertexList::~GFXSphereVertexList(), and ~GFXVertexList().