more c++ math

This commit is contained in:
Garux 2021-02-26 01:10:51 +03:00
parent 4ce944444d
commit 9857bb955b
13 changed files with 71 additions and 99 deletions

View File

@ -11,6 +11,11 @@ Element m_elements[2];
public: public:
BasicVector2(){ BasicVector2(){
} }
template<typename OtherElement>
BasicVector2( const BasicVector2<OtherElement>& other ){
x() = static_cast<Element>( other.x() );
y() = static_cast<Element>( other.y() );
}
BasicVector2( const Element& x_, const Element& y_ ){ BasicVector2( const Element& x_, const Element& y_ ){
x() = x_; x() = x_;
y() = y_; y() = y_;

View File

@ -5,7 +5,6 @@
#include "math/plane.h" #include "math/plane.h"
#define VectorSet( v, a, b, c ) ( ( v )[0] = ( a ),( v )[1] = ( b ),( v )[2] = ( c ) )
#define VectorCopy( a,b ) ( ( b )[0] = ( a )[0],( b )[1] = ( a )[1],( b )[2] = ( a )[2] ) #define VectorCopy( a,b ) ( ( b )[0] = ( a )[0],( b )[1] = ( a )[1],( b )[2] = ( a )[2] )
#define RGBTOGRAY( x ) ( (float)( ( x )[0] ) * 0.2989f + (float)( ( x )[1] ) * 0.5870f + (float)( ( x )[2] ) * 0.1140f ) #define RGBTOGRAY( x ) ( (float)( ( x )[0] ) * 0.2989f + (float)( ( x )[1] ) * 0.5870f + (float)( ( x )[2] ) * 0.1140f )

View File

@ -522,8 +522,8 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, const Vector3& or
if ( brushPrimitives ) { if ( brushPrimitives ) {
int i; int i;
Vector3 texX, texY; Vector3 texX, texY;
float xyI[2], xyJ[2], xyK[2]; Vector2 xyI, xyJ, xyK;
float stI[2], stJ[2], stK[2]; Vector2 stI, stJ, stK;
float D, D0, D1, D2; float D, D0, D1, D2;
ComputeAxisBase( buildPlane->normal(), texX, texY ); ComputeAxisBase( buildPlane->normal(), texX, texY );
@ -534,9 +534,9 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, const Vector3& or
xyJ[1] = vector3_dot( vert[1]->xyz, texY ); xyJ[1] = vector3_dot( vert[1]->xyz, texY );
xyK[0] = vector3_dot( vert[2]->xyz, texX ); xyK[0] = vector3_dot( vert[2]->xyz, texX );
xyK[1] = vector3_dot( vert[2]->xyz, texY ); xyK[1] = vector3_dot( vert[2]->xyz, texY );
stI[0] = vert[0]->st[0]; stI[1] = vert[0]->st[1]; stI = vert[0]->st;
stJ[0] = vert[1]->st[0]; stJ[1] = vert[1]->st[1]; stJ = vert[1]->st;
stK[0] = vert[2]->st[0]; stK[1] = vert[2]->st[1]; stK = vert[2]->st;
// - solve linear equations: // - solve linear equations:
// - (x, y) := xyz . (texX, texY) // - (x, y) := xyz . (texX, texY)

View File

@ -62,8 +62,6 @@ static Vector3 entityOrigin;
returns false if a texture matrix cannot be created returns false if a texture matrix cannot be created
*/ */
#define Vector2Subtract( a,b,c ) ( ( c )[ 0 ] = ( a )[ 0 ] - ( b )[ 0 ], ( c )[ 1 ] = ( a )[ 1 ] - ( b )[ 1 ] )
static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection, bspDrawVert_t *a, bspDrawVert_t *b, bspDrawVert_t *c ){ static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection, bspDrawVert_t *a, bspDrawVert_t *b, bspDrawVert_t *c ){
int i, j; int i, j;
double bb, s, t; double bb, s, t;
@ -151,7 +149,7 @@ static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection,
{ {
int k; int k;
DoubleVector3 deltas[ 3 ]; DoubleVector3 deltas[ 3 ];
double texDeltas[ 3 ][ 2 ]; BasicVector2<double> texDeltas[ 3 ];
double delta, texDelta; double delta, texDelta;
@ -161,9 +159,9 @@ static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection,
deltas[ 0 ] = pa - pb; deltas[ 0 ] = pa - pb;
deltas[ 1 ] = pa - pc; deltas[ 1 ] = pa - pc;
deltas[ 2 ] = pb - pc; deltas[ 2 ] = pb - pc;
Vector2Subtract( a->st, b->st, texDeltas[ 0 ] ); texDeltas[ 0 ] = a->st - b->st;
Vector2Subtract( a->st, c->st, texDeltas[ 1 ] ); texDeltas[ 1 ] = a->st - c->st;
Vector2Subtract( b->st, c->st, texDeltas[ 2 ] ); texDeltas[ 2 ] = b->st - c->st;
/* walk st */ /* walk st */
for ( i = 0; i < 2; i++ ) for ( i = 0; i < 2; i++ )

View File

@ -95,9 +95,7 @@ static void CreateSunLight( sun_t *sun ){
//% Sys_Printf( "%d: Angle: %3.4lf Elevation: %3.3lf\n", sun->numSamples, radians_to_degrees( angle ), radians_to_degrees( elevation ) ); //% Sys_Printf( "%d: Angle: %3.4lf Elevation: %3.3lf\n", sun->numSamples, radians_to_degrees( angle ), radians_to_degrees( elevation ) );
/* create new vector */ /* create new vector */
direction[ 0 ] = cos( angle ) * cos( elevation ); direction = vector3_for_spherical( angle, elevation );
direction[ 1 ] = sin( angle ) * cos( elevation );
direction[ 2 ] = sin( elevation );
} }
/* create a light */ /* create a light */
@ -163,7 +161,6 @@ static void CreateSkyLights( const Vector3& color, float value, int iterations,
/* setup */ /* setup */
elevationSteps = iterations - 1; elevationSteps = iterations - 1;
angleSteps = elevationSteps * 4; angleSteps = elevationSteps * 4;
angle = 0.0f;
elevationStep = degrees_to_radians( 90.0f / iterations ); /* skip elevation 0 */ elevationStep = degrees_to_radians( 90.0f / iterations ); /* skip elevation 0 */
angleStep = degrees_to_radians( 360.0f / angleSteps ); angleStep = degrees_to_radians( 360.0f / angleSteps );
@ -180,9 +177,7 @@ static void CreateSkyLights( const Vector3& color, float value, int iterations,
for ( j = 0; j < angleSteps; j++ ) for ( j = 0; j < angleSteps; j++ )
{ {
/* create sun */ /* create sun */
sun.direction[ 0 ] = cos( angle ) * cos( elevation ); sun.direction = vector3_for_spherical( angle, elevation );
sun.direction[ 1 ] = sin( angle ) * cos( elevation );
sun.direction[ 2 ] = sin( elevation );
CreateSunLight( &sun ); CreateSunLight( &sun );
/* move */ /* move */

View File

@ -37,8 +37,6 @@
#define Vector2Copy( a, b ) ( ( b )[ 0 ] = ( a )[ 0 ], ( b )[ 1 ] = ( a )[ 1 ] )
#define MAX_NODE_ITEMS 5 #define MAX_NODE_ITEMS 5
#define MAX_NODE_TRIANGLES 5 #define MAX_NODE_TRIANGLES 5
#define MAX_TRACE_DEPTH 32 #define MAX_TRACE_DEPTH 32

View File

@ -1028,7 +1028,7 @@ void SetupSurfaceLightmaps( void ){
info->sampleSize = GetSurfaceExtraSampleSize( num ); info->sampleSize = GetSurfaceExtraSampleSize( num );
info->longestCurve = GetSurfaceExtraLongestCurve( num ); info->longestCurve = GetSurfaceExtraLongestCurve( num );
info->patchIterations = IterationsForCurve( info->longestCurve, patchSubdivisions ); info->patchIterations = IterationsForCurve( info->longestCurve, patchSubdivisions );
GetSurfaceExtraLightmapAxis( num, info->axis ); info->axis = GetSurfaceExtraLightmapAxis( num );
/* mark parent */ /* mark parent */
if ( info->parentSurfaceNum >= 0 ) { if ( info->parentSurfaceNum >= 0 ) {

View File

@ -214,7 +214,6 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor
mapDrawSurface_t *ds; mapDrawSurface_t *ds;
bspDrawVert_t *dv; bspDrawVert_t *dv;
const char *picoShaderName; const char *picoShaderName;
picoVec_t *xyz, *normal, *st;
byte *color; byte *color;
picoIndex_t *indexes; picoIndex_t *indexes;
char *skinfilecontent; char *skinfilecontent;
@ -427,12 +426,10 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor
dv = &ds->verts[ i ]; dv = &ds->verts[ i ];
/* xyz and normal */ /* xyz and normal */
xyz = PicoGetSurfaceXYZ( surface, i ); dv->xyz = vector3_from_array( PicoGetSurfaceXYZ( surface, i ) );
VectorCopy( xyz, dv->xyz );
matrix4_transform_point( transform, dv->xyz ); matrix4_transform_point( transform, dv->xyz );
normal = PicoGetSurfaceNormal( surface, i ); dv->normal = vector3_from_array( PicoGetSurfaceNormal( surface, i ) );
VectorCopy( normal, dv->normal );
matrix4_transform_direction( nTransform, dv->normal ); matrix4_transform_direction( nTransform, dv->normal );
VectorNormalize( dv->normal ); VectorNormalize( dv->normal );
@ -451,9 +448,7 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor
/* normal texture coordinates */ /* normal texture coordinates */
else else
{ {
st = PicoGetSurfaceST( surface, 0, i ); dv->st = vector2_from_array( PicoGetSurfaceST( surface, 0, i ) );
dv->st[ 0 ] = st[ 0 ];
dv->st[ 1 ] = st[ 1 ];
} }
/* set lightmap/color bits */ /* set lightmap/color bits */

View File

@ -437,7 +437,7 @@ struct bspAdvertisement_t
------------------------------------------------------------------------------- */ ------------------------------------------------------------------------------- */
/* ydnar: for q3map_tcMod */ /* ydnar: for q3map_tcMod */
typedef float tcMod_t[ 3 ][ 3 ]; typedef Vector3 tcMod_t[ 3 ];
/* ydnar: for multiple game support */ /* ydnar: for multiple game support */
@ -628,7 +628,7 @@ struct shaderInfo_t
bool tcGen; /* ydnar: has explicit texcoord generation */ bool tcGen; /* ydnar: has explicit texcoord generation */
Vector3 vecs[ 2 ]; /* ydnar: explicit texture vectors for [0,1] texture space */ Vector3 vecs[ 2 ]; /* ydnar: explicit texture vectors for [0,1] texture space */
tcMod_t mod; /* ydnar: q3map_tcMod matrix for djbob :) */ tcMod_t mod; /* ydnar: q3map_tcMod matrix for djbob :) */
Vector3 lightmapAxis; /* ydnar: explicit lightmap axis projection */ Vector3 lightmapAxis = { 0, 0, 0 }; /* ydnar: explicit lightmap axis projection */
colorMod_t *colorMod; /* ydnar: q3map_rgb/color/alpha/Set/Mod support */ colorMod_t *colorMod; /* ydnar: q3map_rgb/color/alpha/Set/Mod support */
int furNumLayers; /* ydnar: number of fur layers */ int furNumLayers; /* ydnar: number of fur layers */
@ -673,8 +673,8 @@ struct shaderInfo_t
int skyLightIterations; /* ydnar */ int skyLightIterations; /* ydnar */
sun_t *sun; /* ydnar */ sun_t *sun; /* ydnar */
Vector3 color; /* normalized color */ Vector3 color = { 0, 0, 0 }; /* normalized color */
Color4f averageColor; Color4f averageColor = { 0, 0, 0, 0 };
byte lightStyle; byte lightStyle;
/* vortex: per-surface floodlight */ /* vortex: per-surface floodlight */
@ -691,7 +691,7 @@ struct shaderInfo_t
int shaderWidth, shaderHeight; /* ydnar */ int shaderWidth, shaderHeight; /* ydnar */
Vector2 stFlat; Vector2 stFlat;
Vector3 fogDir; /* ydnar */ Vector3 fogDir = { 0, 0, 0 }; /* ydnar */
char *shaderText; /* ydnar */ char *shaderText; /* ydnar */
bool custom; bool custom;
@ -952,7 +952,7 @@ struct mapDrawSurface_t
int castShadows, recvShadows; int castShadows, recvShadows;
/* ydnar: texture coordinate range monitoring for hardware with limited texcoord precision (in texel space) */ /* ydnar: texture coordinate range monitoring for hardware with limited texcoord precision (in texel space) */
float bias[ 2 ]; Vector2 bias;
int texMins[ 2 ], texMaxs[ 2 ], texRange[ 2 ]; int texMins[ 2 ], texMaxs[ 2 ], texRange[ 2 ];
/* ydnar: for patches */ /* ydnar: for patches */
@ -1760,7 +1760,7 @@ int GetSurfaceExtraRecvShadows( int num );
int GetSurfaceExtraSampleSize( int num ); int GetSurfaceExtraSampleSize( int num );
int GetSurfaceExtraMinSampleSize( int num ); int GetSurfaceExtraMinSampleSize( int num );
float GetSurfaceExtraLongestCurve( int num ); float GetSurfaceExtraLongestCurve( int num );
void GetSurfaceExtraLightmapAxis( int num, Vector3& lightmapAxis ); Vector3 GetSurfaceExtraLightmapAxis( int num );
void WriteSurfaceExtraFile( const char *path ); void WriteSurfaceExtraFile( const char *path );
void LoadSurfaceExtraFile( const char *path ); void LoadSurfaceExtraFile( const char *path );
@ -1870,12 +1870,12 @@ image_t *ImageLoad( const char *filename );
/* shaders.c */ /* shaders.c */
void ColorMod( colorMod_t *am, int numVerts, bspDrawVert_t *drawVerts ); void ColorMod( colorMod_t *am, int numVerts, bspDrawVert_t *drawVerts );
void TCMod( tcMod_t mod, Vector2& st ); void TCMod( const tcMod_t& mod, Vector2& st );
void TCModIdentity( tcMod_t mod ); void TCModIdentity( tcMod_t& mod );
void TCModMultiply( tcMod_t a, tcMod_t b, tcMod_t out ); void TCModMultiply( const tcMod_t& a, const tcMod_t& b, tcMod_t& out );
void TCModTranslate( tcMod_t mod, float s, float t ); void TCModTranslate( tcMod_t& mod, float s, float t );
void TCModScale( tcMod_t mod, float s, float t ); void TCModScale( tcMod_t& mod, float s, float t );
void TCModRotate( tcMod_t mod, float euler ); void TCModRotate( tcMod_t& mod, float euler );
bool ApplySurfaceParm( const char *name, int *contentFlags, int *surfaceFlags, int *compileFlags ); bool ApplySurfaceParm( const char *name, int *contentFlags, int *surfaceFlags, int *compileFlags );

View File

@ -163,29 +163,23 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts ){
routines for dealing with a 3x3 texture mod matrix routines for dealing with a 3x3 texture mod matrix
*/ */
void TCMod( tcMod_t mod, Vector2& st ){ void TCMod( const tcMod_t& mod, Vector2& st ){
float old[ 2 ]; const Vector2 old = st;
old[ 0 ] = st[ 0 ];
old[ 1 ] = st[ 1 ];
st[ 0 ] = ( mod[ 0 ][ 0 ] * old[ 0 ] ) + ( mod[ 0 ][ 1 ] * old[ 1 ] ) + mod[ 0 ][ 2 ]; st[ 0 ] = ( mod[ 0 ][ 0 ] * old[ 0 ] ) + ( mod[ 0 ][ 1 ] * old[ 1 ] ) + mod[ 0 ][ 2 ];
st[ 1 ] = ( mod[ 1 ][ 0 ] * old[ 0 ] ) + ( mod[ 1 ][ 1 ] * old[ 1 ] ) + mod[ 1 ][ 2 ]; st[ 1 ] = ( mod[ 1 ][ 0 ] * old[ 0 ] ) + ( mod[ 1 ][ 1 ] * old[ 1 ] ) + mod[ 1 ][ 2 ];
} }
void TCModIdentity( tcMod_t mod ){ void TCModIdentity( tcMod_t& mod ){
mod[ 0 ][ 0 ] = 1.0f; mod[ 0 ][ 1 ] = 0.0f; mod[ 0 ][ 2 ] = 0.0f; mod[ 0 ][ 0 ] = 1.0f; mod[ 0 ][ 1 ] = 0.0f; mod[ 0 ][ 2 ] = 0.0f;
mod[ 1 ][ 0 ] = 0.0f; mod[ 1 ][ 1 ] = 1.0f; mod[ 1 ][ 2 ] = 0.0f; mod[ 1 ][ 0 ] = 0.0f; mod[ 1 ][ 1 ] = 1.0f; mod[ 1 ][ 2 ] = 0.0f;
mod[ 2 ][ 0 ] = 0.0f; mod[ 2 ][ 1 ] = 0.0f; mod[ 2 ][ 2 ] = 1.0f; /* this row is only used for multiples, not transformation */ mod[ 2 ][ 0 ] = 0.0f; mod[ 2 ][ 1 ] = 0.0f; mod[ 2 ][ 2 ] = 1.0f; /* this row is only used for multiples, not transformation */
} }
void TCModMultiply( tcMod_t a, tcMod_t b, tcMod_t out ){ void TCModMultiply( const tcMod_t& a, const tcMod_t& b, tcMod_t& out ){
int i; for ( int i = 0; i < 3; i++ )
for ( i = 0; i < 3; i++ )
{ {
out[ i ][ 0 ] = ( a[ i ][ 0 ] * b[ 0 ][ 0 ] ) + ( a[ i ][ 1 ] * b[ 1 ][ 0 ] ) + ( a[ i ][ 2 ] * b[ 2 ][ 0 ] ); out[ i ][ 0 ] = ( a[ i ][ 0 ] * b[ 0 ][ 0 ] ) + ( a[ i ][ 1 ] * b[ 1 ][ 0 ] ) + ( a[ i ][ 2 ] * b[ 2 ][ 0 ] );
out[ i ][ 1 ] = ( a[ i ][ 0 ] * b[ 0 ][ 1 ] ) + ( a[ i ][ 1 ] * b[ 1 ][ 1 ] ) + ( a[ i ][ 2 ] * b[ 2 ][ 1 ] ); out[ i ][ 1 ] = ( a[ i ][ 0 ] * b[ 0 ][ 1 ] ) + ( a[ i ][ 1 ] * b[ 1 ][ 1 ] ) + ( a[ i ][ 2 ] * b[ 2 ][ 1 ] );
@ -194,19 +188,19 @@ void TCModMultiply( tcMod_t a, tcMod_t b, tcMod_t out ){
} }
void TCModTranslate( tcMod_t mod, float s, float t ){ void TCModTranslate( tcMod_t& mod, float s, float t ){
mod[ 0 ][ 2 ] += s; mod[ 0 ][ 2 ] += s;
mod[ 1 ][ 2 ] += t; mod[ 1 ][ 2 ] += t;
} }
void TCModScale( tcMod_t mod, float s, float t ){ void TCModScale( tcMod_t& mod, float s, float t ){
mod[ 0 ][ 0 ] *= s; mod[ 0 ][ 0 ] *= s;
mod[ 1 ][ 1 ] *= t; mod[ 1 ][ 1 ] *= t;
} }
void TCModRotate( tcMod_t mod, float euler ){ void TCModRotate( tcMod_t& mod, float euler ){
tcMod_t old, temp; tcMod_t old, temp;
float radians, sinv, cosv; float radians, sinv, cosv;
@ -1235,7 +1229,6 @@ static void ParseShaderFile( const char *filename ){
degree of 0 = from the east, 90 = north, etc. altitude of 0 = sunrise/set, 90 = noon degree of 0 = from the east, 90 = north, etc. altitude of 0 = sunrise/set, 90 = noon
ydnar: sof2map has bareword 'sun' token, so we support that as well */ ydnar: sof2map has bareword 'sun' token, so we support that as well */
else if ( striEqual( token, "sun" ) /* sof2 */ || striEqual( token, "q3map_sun" ) || striEqual( token, "q3map_sunExt" ) ) { else if ( striEqual( token, "sun" ) /* sof2 */ || striEqual( token, "q3map_sun" ) || striEqual( token, "q3map_sunExt" ) ) {
float a, b;
sun_t *sun; sun_t *sun;
/* ydnar: extended sun directive? */ /* ydnar: extended sun directive? */
const bool ext = striEqual( token, "q3map_sunext" ); const bool ext = striEqual( token, "q3map_sunext" );
@ -1269,14 +1262,12 @@ static void ParseShaderFile( const char *filename ){
/* get sun angle/elevation */ /* get sun angle/elevation */
GetTokenAppend( shaderText, false ); GetTokenAppend( shaderText, false );
a = degrees_to_radians( atof( token ) ); const double a = degrees_to_radians( atof( token ) );
GetTokenAppend( shaderText, false ); GetTokenAppend( shaderText, false );
b = degrees_to_radians( atof( token ) ); const double b = degrees_to_radians( atof( token ) );
sun->direction[ 0 ] = cos( a ) * cos( b ); sun->direction = vector3_for_spherical( a, b );
sun->direction[ 1 ] = sin( a ) * cos( b );
sun->direction[ 2 ] = sin( b );
/* get filter radius from shader */ /* get filter radius from shader */
sun->filterRadius = si->lightFilterRadius; sun->filterRadius = si->lightFilterRadius;

View File

@ -2884,8 +2884,7 @@ static void MakeDebugPortalSurfs_r( node_t *node, shaderInfo_t *si ){
/* set it */ /* set it */
dv->xyz = w->p[ i ]; dv->xyz = w->p[ i ];
dv->normal = p->plane.normal(); dv->normal = p->plane.normal();
dv->st[ 0 ] = 0; dv->st = { 0, 0 };
dv->st[ 1 ] = 0;
for ( k = 0; k < MAX_LIGHTMAPS; k++ ) for ( k = 0; k < MAX_LIGHTMAPS; k++ )
{ {
dv->color[ k ].rgb() = debugColors[ c % 12 ]; dv->color[ k ].rgb() = debugColors[ c % 12 ];
@ -2985,9 +2984,6 @@ void MakeFogHullSurfs( entity_t *e, tree_t *tree, const char *shader ){
*/ */
void BiasSurfaceTextures( mapDrawSurface_t *ds ){ void BiasSurfaceTextures( mapDrawSurface_t *ds ){
int i;
/* calculate the surface texture bias */ /* calculate the surface texture bias */
CalcSurfaceTextureRange( ds ); CalcSurfaceTextureRange( ds );
@ -2997,10 +2993,9 @@ void BiasSurfaceTextures( mapDrawSurface_t *ds ){
} }
/* bias the texture coordinates */ /* bias the texture coordinates */
for ( i = 0; i < ds->numVerts; i++ ) for ( int i = 0; i < ds->numVerts; i++ )
{ {
ds->verts[ i ].st[ 0 ] += ds->bias[ 0 ]; ds->verts[ i ].st += ds->bias;
ds->verts[ i ].st[ 1 ] += ds->bias[ 1 ];
} }
} }

View File

@ -139,50 +139,42 @@ static surfaceExtra_t *GetSurfaceExtra( int num ){
shaderInfo_t *GetSurfaceExtraShaderInfo( int num ){ shaderInfo_t *GetSurfaceExtraShaderInfo( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->si;
return se->si;
} }
int GetSurfaceExtraParentSurfaceNum( int num ){ int GetSurfaceExtraParentSurfaceNum( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->parentSurfaceNum;
return se->parentSurfaceNum;
} }
int GetSurfaceExtraEntityNum( int num ){ int GetSurfaceExtraEntityNum( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->entityNum;
return se->entityNum;
} }
int GetSurfaceExtraCastShadows( int num ){ int GetSurfaceExtraCastShadows( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->castShadows;
return se->castShadows;
} }
int GetSurfaceExtraRecvShadows( int num ){ int GetSurfaceExtraRecvShadows( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->recvShadows;
return se->recvShadows;
} }
int GetSurfaceExtraSampleSize( int num ){ int GetSurfaceExtraSampleSize( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->sampleSize;
return se->sampleSize;
} }
float GetSurfaceExtraLongestCurve( int num ){ float GetSurfaceExtraLongestCurve( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->longestCurve;
return se->longestCurve;
} }
void GetSurfaceExtraLightmapAxis( int num, Vector3& lightmapAxis ){ Vector3 GetSurfaceExtraLightmapAxis( int num ){
surfaceExtra_t *se = GetSurfaceExtra( num ); return GetSurfaceExtra( num )->lightmapAxis;
lightmapAxis = se->lightmapAxis;
} }

View File

@ -549,7 +549,9 @@ void MaxAreaFaceSurface( mapDrawSurface_t *ds ){
if ( ds->numVerts == 3 ) { if ( ds->numVerts == 3 ) {
ds->numIndexes = 3; ds->numIndexes = 3;
ds->indexes = safe_malloc( ds->numIndexes * sizeof( int ) ); ds->indexes = safe_malloc( ds->numIndexes * sizeof( int ) );
VectorSet( ds->indexes, 0, 1, 2 ); ds->indexes[0] = 0;
ds->indexes[1] = 1;
ds->indexes[2] = 2;
numMaxAreaSurfaces++; numMaxAreaSurfaces++;
return; return;
} }
@ -677,7 +679,9 @@ void StripFaceSurface( mapDrawSurface_t *ds ){
/* is this a simple triangle? */ /* is this a simple triangle? */
if ( ds->numVerts == 3 ) { if ( ds->numVerts == 3 ) {
numIndexes = 3; numIndexes = 3;
VectorSet( indexes, 0, 1, 2 ); indexes[0] = 0;
indexes[1] = 1;
indexes[2] = 2;
} }
else else
{ {