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_poly.cpp File Reference
#include "mesh.h"
#include "aux_texture.h"
#include <values.h>
#include <float.h>
#include <assert.h>

Go to the source code of this file.

Macros

#define PBEHIND   (-1)
 
#define PFRONT   (1)
 
#define PUNK   (0)
 
#define WHICHSID(v)   ( ( (v.x*a+v.y*b+v.z*c+d) > 0 )*2-1 )
 

Functions

static int whichside (GFXVertex *t, int numvertex, float a, float b, float c, float d)
 
void updateMax (Vector &mn, Vector &mx, const GFXVertex &ver)
 

Macro Definition Documentation

#define PBEHIND   (-1)

Definition at line 8 of file mesh_poly.cpp.

#define PFRONT   (1)

Definition at line 9 of file mesh_poly.cpp.

Referenced by Mesh::Fork().

#define PUNK   (0)

Definition at line 10 of file mesh_poly.cpp.

Referenced by whichside().

#define WHICHSID (   v)    ( ( (v.x*a+v.y*b+v.z*c+d) > 0 )*2-1 )

Definition at line 12 of file mesh_poly.cpp.

Referenced by whichside().

Function Documentation

void updateMax ( Vector mn,
Vector mx,
const GFXVertex ver 
)

Definition at line 1116 of file mesh_xml.cpp.

References max(), min(), GFXVertex::x, GFXVertex::y, and GFXVertex::z.

Referenced by Mesh::Fork(), and Mesh::PostProcessLoading().

1117 {
1118  mn.i = min( ver.x, mn.i );
1119  mx.i = max( ver.x, mx.i );
1120  mn.j = min( ver.y, mn.j );
1121  mx.j = max( ver.y, mx.j );
1122  mn.k = min( ver.z, mn.k );
1123  mx.k = max( ver.z, mx.k );
1124 }
static int whichside ( GFXVertex t,
int  numvertex,
float  a,
float  b,
float  c,
float  d 
)
static

Definition at line 14 of file mesh_poly.cpp.

References i, PUNK, and WHICHSID.

Referenced by Mesh::Fork().

15 {
16  int count = PUNK;
17  for (int i = 0; i < numvertex; i++)
18  count += WHICHSID( t[i] );
19  if (count == PUNK)
20  count = (rand()%2)*2-1;
21  return ( (count > 0)*2 )-1;
22 }