Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mesh_bxm.cpp File Reference
#include "mesh_io.h"
#include "mesh_bxm.h"
#include "mesh.h"
#include "mesh_xml.h"
#include "aux_texture.h"
#include "animation.h"
#include "faction_generic.h"
#include <assert.h>
#include "vegastrike.h"

Go to the source code of this file.

Classes

struct  OrigMeshLoader
 

Macros

#define fprintf   aprintf
 
#define fopen   aopen
 
#define fclose   aopen
 
#define DLISTBEGINSTATE(stat)
 
#define DLISTDOVERTEX(num)
 
#define DLISTENDSTATE(stat)
 
#define BEGIN_GL_LINES(expectitems)
 
#define BEGIN_GL_TRIANGLES(expectitems)
 
#define BEGIN_GL_TRIANGLE(expectitems)
 
#define BEGIN_GL_QUADS(expectitems)
 
#define BEGIN_GL_QUAD(expectitems)
 
#define BEGIN_GL_TRIANGLE_FAN(expectitems)
 
#define BEGIN_GL_QUAD_STRIP(expectitems)
 
#define BEGIN_GL_TRIANGLE_STRIP(expectitems)
 
#define BEGIN_GL_LINE_STRIP(expectitems)
 
#define END_GL_LINES
 
#define END_GL_TRIANGLES
 
#define END_GL_TRIANGLE
 
#define END_GL_QUADS
 
#define END_GL_QUAD
 
#define END_GL_TRIANGLE_FAN
 
#define END_GL_QUAD_STRIP
 
#define END_GL_TRIANGLE_STRIP
 
#define END_GL_LINE_STRIP
 
#define END_GL_COMPILE
 
#define READSTRING(inmemfile, word32index, stringlen, stringvar)
 
#define BEGINSTATE(stat, expectitems)
 
#define ENDSTATE(stat)
 
#define DOVERTEX(num)
 
#define bxmfprintf   fignoref
 
#define bxmfopen   fignorefopen
 

Functions

void fcloseInput (FILE *fp)
 
int aprintf (...)
 
FILE * aopen (...)
 
template<typename T >
void reverse_vector (vector< T > &vec)
 
static void fignoref (FILE *f,...)
 
static FILE * fignorefopen (const char *, const char *)
 

Variables

string inverseblend [16]
 

Macro Definition Documentation

#define BEGIN_GL_LINE_STRIP (   expectitems)
Value:
do { \
xml.num_vertices = 2; xml.linestrips.push_back( vector< GFXVertex > () ); \
xml.active_list = &xml.linestrips.back(); xml.lstrcnt = xml.linestripind.size(); xml.active_ind = &xml.linestripind; \
xml.active_list->reserve( expectitems ); xml.active_ind->reserve( expectitems ); \
} \
while (0)

Definition at line 166 of file mesh_bxm.cpp.

#define BEGIN_GL_LINES (   expectitems)
Value:
do { \
xml.active_list = &xml.lines; xml.active_ind = &xml.lineind; xml.num_vertices = \
2; xml.active_list->reserve( 2*expectitems ); xml.active_ind->reserve( 2*expectitems ); \
} \
while (0)

Definition at line 113 of file mesh_bxm.cpp.

#define BEGIN_GL_QUAD (   expectitems)
Value:
do {xml.quadshade.push_back( flatshade ); } \
while (0)

Definition at line 138 of file mesh_bxm.cpp.

#define BEGIN_GL_QUAD_STRIP (   expectitems)
Value:
do { \
xml.num_vertices = 4; xml.quadstrips.push_back( vector< GFXVertex > () ); \
xml.active_list = &xml.quadstrips.back(); xml.qstrcnt = xml.quadstripind.size(); xml.active_ind = &xml.quadstripind; \
xml.active_list->reserve( expectitems ); xml.active_ind->reserve( expectitems ); \
} \
while (0)

Definition at line 150 of file mesh_bxm.cpp.

#define BEGIN_GL_QUADS (   expectitems)
Value:
do { \
xml.active_list = &xml.quads; xml.active_ind = &xml.quadind; xml.num_vertices = \
4; xml.active_list->reserve( 4*expectitems ); xml.active_ind->reserve( 4*expectitems ); \
} \
while (0)

Definition at line 131 of file mesh_bxm.cpp.

#define BEGIN_GL_TRIANGLE (   expectitems)
Value:
do {xml.trishade.push_back( flatshade ); } \
while (0)

Definition at line 127 of file mesh_bxm.cpp.

#define BEGIN_GL_TRIANGLE_FAN (   expectitems)
Value:
do { \
xml.trifans.push_back( std::vector< GFXVertex > () ); xml.active_list = \
&xml.trifans.back(); xml.tfancnt = xml.trifanind.size(); xml.active_ind = &xml.trifanind; xml.active_list->reserve( \
expectitems ); xml.active_ind->reserve( expectitems ); \
} \
while (0)

Definition at line 142 of file mesh_bxm.cpp.

#define BEGIN_GL_TRIANGLE_STRIP (   expectitems)
Value:
do { \
xml.num_vertices = 3; xml.tristrips.push_back( vector< GFXVertex > () ); \
xml.tstrcnt = xml.tristripind.size(); xml.active_ind = &xml.tristripind; xml.active_list->reserve( expectitems ); \
xml.active_ind->reserve( expectitems ); \
} \
while (0)

Definition at line 158 of file mesh_bxm.cpp.

#define BEGIN_GL_TRIANGLES (   expectitems)
Value:
do { \
xml.active_list = &xml.tris; xml.active_ind = &xml.triind; xml.num_vertices = 3; \
xml.active_list->reserve( 3*expectitems ); xml.active_ind->reserve( 3*expectitems ); \
} \
while (0)

Definition at line 120 of file mesh_bxm.cpp.

#define BEGINSTATE (   stat,
  expectitems 
)
Value:
do {BEGIN_##stat( expectitems ); DLISTBEGINSTATE( stat ); } \
while (0)

Definition at line 240 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

#define bxmfopen   fignorefopen

Definition at line 294 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

#define bxmfprintf   fignoref

Definition at line 293 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

#define DLISTBEGINSTATE (   stat)

Definition at line 106 of file mesh_bxm.cpp.

#define DLISTDOVERTEX (   num)

Definition at line 107 of file mesh_bxm.cpp.

#define DLISTENDSTATE (   stat)

Definition at line 108 of file mesh_bxm.cpp.

#define DOVERTEX (   num)
Value:
do { \
vtx = xml.vertices[ind##num]; \
if (!xml.sharevert) { \
vtx.s = s##num; \
vtx.t = t##num; \
} \
xml.vertex = vtx; \
xml.vertexcount[ind##num] += 1; \
if ( (!vtx.i) && (!vtx.j) && (!vtx.k) && !xml.recalc_norm ) \
xml.recalc_norm = true; \
xml.active_list->push_back( xml.vertex ); \
xml.active_ind->push_back( ind##num ); \
xml.num_vertices--; \
DLISTDOVERTEX( stat ); \
} \
while (0)

Definition at line 248 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

#define END_GL_COMPILE

Definition at line 228 of file mesh_bxm.cpp.

#define END_GL_LINE_STRIP
Value:
do { \
xml.nrmllinstrip.reserve( xml.linestripind.size()*2 ); \
for (unsigned int i = xml.lstrcnt+1; i < xml.linestripind.size(); i++) { \
xml.nrmllinstrip.push_back( xml.linestripind[i-1] ); \
xml.nrmllinstrip.push_back( xml.linestripind[i] ); \
} \
} \
while (0)

Definition at line 218 of file mesh_bxm.cpp.

#define END_GL_LINES

Definition at line 174 of file mesh_bxm.cpp.

#define END_GL_QUAD

Definition at line 178 of file mesh_bxm.cpp.

#define END_GL_QUAD_STRIP
Value:
do {xml.nrmlquadstrip.reserve( xml.quadstripind.size()*(4/2) ); \
for (unsigned int i = xml.qstrcnt+3; i < xml.quadstripind.size(); i += 2) { \
xml.nrmlquadstrip.push_back( xml.quadstripind[i-3] ); \
xml.nrmlquadstrip.push_back( xml.quadstripind[i-2] ); \
xml.nrmlquadstrip.push_back( xml.quadstripind[i] ); \
xml.nrmlquadstrip.push_back( xml.quadstripind[i-1] ); \
} \
} \
while (0)

Definition at line 190 of file mesh_bxm.cpp.

#define END_GL_QUADS

Definition at line 177 of file mesh_bxm.cpp.

#define END_GL_TRIANGLE

Definition at line 176 of file mesh_bxm.cpp.

#define END_GL_TRIANGLE_FAN
Value:
do {xml.nrmltrifan.reserve( xml.trifanind.size()*3 ); \
for (unsigned int i = xml.tfancnt+2; i < xml.trifanind.size(); i++) { \
xml.nrmltrifan.push_back( xml.trifanind[xml.tfancnt] ); \
xml.nrmltrifan.push_back( xml.trifanind[i-1] ); \
xml.nrmltrifan.push_back( xml.trifanind[i] ); \
} \
} \
while (0)

Definition at line 180 of file mesh_bxm.cpp.

#define END_GL_TRIANGLE_STRIP
Value:
do {xml.nrmltristrip.reserve( xml.tristripind.size()*3 ); \
for (unsigned int i = xml.tstrcnt+2; i < xml.tristripind.size(); i++) { \
if ( (i-xml.tstrcnt)%2 ) { \
xml.nrmltristrip.push_back( xml.tristripind[i-2] ); \
xml.nrmltristrip.push_back( xml.tristripind[i-1] ); \
xml.nrmltristrip.push_back( xml.tristripind[i] ); \
} \
else { \
xml.nrmltristrip.push_back( xml.tristripind[i-1] ); \
xml.nrmltristrip.push_back( xml.tristripind[i-2] ); \
xml.nrmltristrip.push_back( xml.tristripind[i] ); \
} \
} \
} \
while (0)

Definition at line 201 of file mesh_bxm.cpp.

#define END_GL_TRIANGLES

Definition at line 175 of file mesh_bxm.cpp.

#define ENDSTATE (   stat)
Value:
do {END_##stat; DLISTENDSTATE( stat ); } \
while (0)

Definition at line 244 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

#define READSTRING (   inmemfile,
  word32index,
  stringlen,
  stringvar 
)
Value:
do { /* By Klauss - Much more efficient than the preceding code, and yet still portable */ \
char8bit *inmemstring = (char8bit*) (inmemfile+word32index); \
char8bit oc = inmemstring[stringlen]; inmemstring[stringlen] = 0; \
stringvar = (const char*) inmemstring; \
inmemstring[stringlen] = oc; \
word32index += (stringlen+3)/4; \
} \
while (0)

Definition at line 230 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

Function Documentation

FILE* aopen (   ...)

Definition at line 31 of file mesh_bxm.cpp.

32 {
33  return NULL;
34 }
int aprintf (   ...)

Definition at line 26 of file mesh_bxm.cpp.

27 {
28  return 0;
29 }
void fcloseInput ( FILE *  fp)

Definition at line 21 of file mesh_bxm.cpp.

References fclose.

Referenced by Mesh::LoadMeshes().

22 {
23  fclose( fp );
24 }
static void fignoref ( FILE *  f,
  ... 
)
inlinestatic

Definition at line 286 of file mesh_bxm.cpp.

286 {}
static FILE* fignorefopen ( const char *  ,
const char *   
)
inlinestatic

Definition at line 288 of file mesh_bxm.cpp.

289 {
290  return 0;
291 }
template<typename T >
void reverse_vector ( vector< T > &  vec)

Definition at line 267 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().

268 {
269  vector< T >newvec;
270  for ( ; ( !vec.empty() ); vec.pop_back() )
271  newvec.push_back( vec.back() );
272  vec.swap( newvec );
273 }

Variable Documentation

string inverseblend[16]
Initial value:
= {
"ZERO", "ZERO", "ONE", "SRCCOLOR", "INVSRCCOLOR", "SRCALPHA", "INVSRCALPHA",
"DESTALPHA", "INVDESTALPHA", "DESTCOLOR", "INVDESTCOLOR", "SRCALPHASAT", "CONSTALPHA", "INVCONSTALPHA",
"CONSTCOLOR", "INVCONSTCOLOR"
}

Definition at line 15 of file mesh_bxm.cpp.

Referenced by Mesh::LoadMeshes().