add BasicVector3 uniform constructor
This commit is contained in:
parent
98f9023cdc
commit
1144be0881
|
|
@ -70,10 +70,9 @@ explicit BasicVector3( const BasicVector2<OtherElement>& vec2 ){
|
||||||
y() = static_cast<Element>( vec2.y() );
|
y() = static_cast<Element>( vec2.y() );
|
||||||
z() = 0;
|
z() = 0;
|
||||||
}
|
}
|
||||||
BasicVector3( const Element& x_, const Element& y_, const Element& z_ ){
|
BasicVector3( const Element& x_, const Element& y_, const Element& z_ ) : m_elements{ x_, y_, z_ }{
|
||||||
x() = x_;
|
}
|
||||||
y() = y_;
|
explicit BasicVector3( const Element& value ) : m_elements{ value, value, value }{
|
||||||
z() = z_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Element& x(){
|
Element& x(){
|
||||||
|
|
@ -109,9 +108,8 @@ const Element* data() const {
|
||||||
return m_elements;
|
return m_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicVector3& set( const Element value ){
|
void set( const Element value ){
|
||||||
x() = y() = z() = value;
|
x() = y() = z() = value;
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -189,9 +187,8 @@ const BasicVector3<Element>& vec3() const {
|
||||||
return reinterpret_cast<const BasicVector3<Element>&>( x() );
|
return reinterpret_cast<const BasicVector3<Element>&>( x() );
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicVector4& set( const Element value ){
|
void set( const Element value ){
|
||||||
x() = y() = z() = w() = value;
|
x() = y() = z() = w() = value;
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ void WindingExtendBounds( const winding_t *w, MinMax& minmax ){
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
Vector3 WindingCenter( const winding_t *w ){
|
Vector3 WindingCenter( const winding_t *w ){
|
||||||
Vector3 center( 0, 0, 0 );
|
Vector3 center( 0 );
|
||||||
|
|
||||||
for ( int i = 0 ; i < w->numpoints ; i++ )
|
for ( int i = 0 ; i < w->numpoints ; i++ )
|
||||||
center += w->p[i];
|
center += w->p[i];
|
||||||
|
|
@ -817,7 +817,7 @@ winding_t *ChopWinding( winding_t *in, const Plane3f& plane ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const MinMax c_worldMinmax( Vector3().set( MIN_WORLD_COORD ), Vector3().set( MAX_WORLD_COORD ) );
|
inline const MinMax c_worldMinmax( Vector3( MIN_WORLD_COORD ), Vector3( MAX_WORLD_COORD ) );
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
CheckWinding
|
CheckWinding
|
||||||
|
|
|
||||||
|
|
@ -247,10 +247,7 @@ static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection,
|
||||||
note: non-normalized axes will screw up the plane transform
|
note: non-normalized axes will screw up the plane transform
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void TransformDecalProjector( decalProjector_t *in, Vector3 axis[ 3 ], const Vector3& origin, decalProjector_t *out ){
|
static void TransformDecalProjector( decalProjector_t *in, const Vector3 (&axis)[ 3 ], const Vector3& origin, decalProjector_t *out ){
|
||||||
int i;
|
|
||||||
|
|
||||||
|
|
||||||
/* copy misc stuff */
|
/* copy misc stuff */
|
||||||
out->si = in->si;
|
out->si = in->si;
|
||||||
out->numPlanes = in->numPlanes;
|
out->numPlanes = in->numPlanes;
|
||||||
|
|
@ -263,7 +260,7 @@ static void TransformDecalProjector( decalProjector_t *in, Vector3 axis[ 3 ], co
|
||||||
out->radius2 = in->radius2;
|
out->radius2 = in->radius2;
|
||||||
|
|
||||||
/* translate planes */
|
/* translate planes */
|
||||||
for ( i = 0; i < in->numPlanes; i++ )
|
for ( int i = 0; i < in->numPlanes; i++ )
|
||||||
{
|
{
|
||||||
out->planes[ i ].a = vector3_dot( in->planes[ i ].normal(), axis[ 0 ] );
|
out->planes[ i ].a = vector3_dot( in->planes[ i ].normal(), axis[ 0 ] );
|
||||||
out->planes[ i ].b = vector3_dot( in->planes[ i ].normal(), axis[ 1 ] );
|
out->planes[ i ].b = vector3_dot( in->planes[ i ].normal(), axis[ 1 ] );
|
||||||
|
|
@ -272,7 +269,7 @@ static void TransformDecalProjector( decalProjector_t *in, Vector3 axis[ 3 ], co
|
||||||
}
|
}
|
||||||
|
|
||||||
/* translate texture matrix */
|
/* translate texture matrix */
|
||||||
for ( i = 0; i < 2; i++ )
|
for ( int i = 0; i < 2; i++ )
|
||||||
{
|
{
|
||||||
out->texMat[ i ][ 0 ] = vector3_dot( in->texMat[ i ].vec3(), axis[ 0 ] );
|
out->texMat[ i ][ 0 ] = vector3_dot( in->texMat[ i ].vec3(), axis[ 0 ] );
|
||||||
out->texMat[ i ][ 1 ] = vector3_dot( in->texMat[ i ].vec3(), axis[ 1 ] );
|
out->texMat[ i ][ 1 ] = vector3_dot( in->texMat[ i ].vec3(), axis[ 1 ] );
|
||||||
|
|
@ -739,7 +736,6 @@ void MakeEntityDecals( entity_t *e ){
|
||||||
int i, j, f, fOld, start;
|
int i, j, f, fOld, start;
|
||||||
decalProjector_t dp;
|
decalProjector_t dp;
|
||||||
mapDrawSurface_t *ds;
|
mapDrawSurface_t *ds;
|
||||||
Vector3 identityAxis[ 3 ] = { g_vector3_axis_x, g_vector3_axis_y, g_vector3_axis_z };
|
|
||||||
|
|
||||||
|
|
||||||
/* note it */
|
/* note it */
|
||||||
|
|
@ -763,7 +759,7 @@ void MakeEntityDecals( entity_t *e ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get projector */
|
/* get projector */
|
||||||
TransformDecalProjector( &projectors[ i ], identityAxis, e->origin, &dp );
|
TransformDecalProjector( &projectors[ i ], g_vector3_axes, e->origin, &dp );
|
||||||
|
|
||||||
/* walk the list of surfaces in the entity */
|
/* walk the list of surfaces in the entity */
|
||||||
for ( j = e->firstDrawSurf; j < numMapDrawSurfs; j++ )
|
for ( j = e->firstDrawSurf; j < numMapDrawSurfs; j++ )
|
||||||
|
|
|
||||||
|
|
@ -632,8 +632,8 @@ int FogForBounds( const MinMax& minmax, float epsilon ){
|
||||||
brush_t *brush = mapFogs[ i ].brush;
|
brush_t *brush = mapFogs[ i ].brush;
|
||||||
|
|
||||||
/* get bounds */
|
/* get bounds */
|
||||||
const MinMax fogMinmax( brush->minmax.mins - Vector3().set( epsilon ),
|
const MinMax fogMinmax( brush->minmax.mins - Vector3( epsilon ),
|
||||||
brush->minmax.maxs + Vector3().set( epsilon ) );
|
brush->minmax.maxs + Vector3( epsilon ) );
|
||||||
/* check against bounds */
|
/* check against bounds */
|
||||||
if( !minmax.test( fogMinmax ) ){
|
if( !minmax.test( fogMinmax ) ){
|
||||||
continue; /* no overlap */
|
continue; /* no overlap */
|
||||||
|
|
|
||||||
|
|
@ -605,7 +605,7 @@ void SetEntityOrigins( void ){
|
||||||
dm = &bspModels[ modelnum ];
|
dm = &bspModels[ modelnum ];
|
||||||
|
|
||||||
/* get entity origin */
|
/* get entity origin */
|
||||||
Vector3 origin( 0, 0, 0 );
|
Vector3 origin( 0 );
|
||||||
if ( !e.read_keyvalue( origin, "origin" ) ) {
|
if ( !e.read_keyvalue( origin, "origin" ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
textureColor.alpha() = 255.0f;
|
textureColor.alpha() = 255.0f;
|
||||||
}
|
}
|
||||||
const float avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
const float avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
||||||
color = ( ( textureColor.rgb() * bounceColorRatio + Vector3().set( avgcolor * ( 1 - bounceColorRatio ) ) ) / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ].rgb() / 255.0f );
|
color = ( ( textureColor.rgb() * bounceColorRatio + Vector3( avgcolor * ( 1 - bounceColorRatio ) ) ) / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ].rgb() / 255.0f );
|
||||||
// color = ( textureColor.rgb / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ].rgb / 255.0f );
|
// color = ( textureColor.rgb / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ].rgb / 255.0f );
|
||||||
|
|
||||||
minmax.extend( color );
|
minmax.extend( color );
|
||||||
|
|
@ -333,7 +333,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
|
||||||
textureColor.alpha() = 255;
|
textureColor.alpha() = 255;
|
||||||
}
|
}
|
||||||
const float avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
const float avgcolor = ( textureColor[ 0 ] + textureColor[ 1 ] + textureColor[ 2 ] ) / 3;
|
||||||
color = ( ( textureColor.rgb() * bounceColorRatio + Vector3().set( avgcolor * ( 1 - bounceColorRatio ) ) ) / 255 ) * ( radLuxel / 255 );
|
color = ( ( textureColor.rgb() * bounceColorRatio + Vector3( avgcolor * ( 1 - bounceColorRatio ) ) ) / 255 ) * ( radLuxel / 255 );
|
||||||
//Sys_Printf( "%i %i %i %i %i \n", (int) textureColor.rgb[ 0 ], (int) textureColor.rgb[ 1 ], (int) textureColor.rgb[ 2 ], (int) avgcolor, (int) color[ i ] );
|
//Sys_Printf( "%i %i %i %i %i \n", (int) textureColor.rgb[ 0 ], (int) textureColor.rgb[ 1 ], (int) textureColor.rgb[ 2 ], (int) avgcolor, (int) color[ i ] );
|
||||||
minmax.extend( color );
|
minmax.extend( color );
|
||||||
average += color;
|
average += color;
|
||||||
|
|
|
||||||
|
|
@ -594,7 +594,7 @@ static void SubdivideTraceNode_r( int nodeNum, int depth ){
|
||||||
|
|
||||||
/* bound the node */
|
/* bound the node */
|
||||||
node->minmax.clear();
|
node->minmax.clear();
|
||||||
DoubleVector3 average( 0, 0, 0 );
|
DoubleVector3 average( 0 );
|
||||||
count = 0;
|
count = 0;
|
||||||
for ( i = 0; i < node->numItems; i++ )
|
for ( i = 0; i < node->numItems; i++ )
|
||||||
{
|
{
|
||||||
|
|
@ -1112,13 +1112,13 @@ static void PopulateTraceNodes( void ){
|
||||||
e->vectorForKey( "origin", origin );
|
e->vectorForKey( "origin", origin );
|
||||||
|
|
||||||
/* get scale */
|
/* get scale */
|
||||||
Vector3 scale = { 1.f, 1.f, 1.f };
|
Vector3 scale( 1 );
|
||||||
if( !e->read_keyvalue( scale, "modelscale_vec" ) )
|
if( !e->read_keyvalue( scale, "modelscale_vec" ) )
|
||||||
if( e->read_keyvalue( scale[0], "modelscale" ) )
|
if( e->read_keyvalue( scale[0], "modelscale" ) )
|
||||||
scale[1] = scale[2] = scale[0];
|
scale[1] = scale[2] = scale[0];
|
||||||
|
|
||||||
/* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */
|
/* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */
|
||||||
Vector3 angles = { 0.f, 0.f, 0.f };
|
Vector3 angles( 0 );
|
||||||
if ( !e->read_keyvalue( value, "angles" ) ||
|
if ( !e->read_keyvalue( value, "angles" ) ||
|
||||||
3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) )
|
3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) )
|
||||||
e->read_keyvalue( angles[ 2 ], "angle" );
|
e->read_keyvalue( angles[ 2 ], "angle" );
|
||||||
|
|
|
||||||
|
|
@ -157,13 +157,12 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){
|
||||||
#define EQUAL_NORMAL_EPSILON 0.01f
|
#define EQUAL_NORMAL_EPSILON 0.01f
|
||||||
|
|
||||||
void SmoothNormals( void ){
|
void SmoothNormals( void ){
|
||||||
int i, j, k, f, numVerts, numVotes, fOld, start;
|
int i, j, k, f, fOld, start;
|
||||||
float shadeAngle, defaultShadeAngle, maxShadeAngle;
|
float shadeAngle, defaultShadeAngle, maxShadeAngle;
|
||||||
bspDrawSurface_t *ds;
|
bspDrawSurface_t *ds;
|
||||||
shaderInfo_t *si;
|
shaderInfo_t *si;
|
||||||
float *shadeAngles;
|
float *shadeAngles;
|
||||||
byte *smoothed;
|
byte *smoothed;
|
||||||
Vector3 average;
|
|
||||||
int indexes[ MAX_SAMPLES ];
|
int indexes[ MAX_SAMPLES ];
|
||||||
Vector3 votes[ MAX_SAMPLES ];
|
Vector3 votes[ MAX_SAMPLES ];
|
||||||
|
|
||||||
|
|
@ -239,9 +238,9 @@ void SmoothNormals( void ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear */
|
/* clear */
|
||||||
average.set( 0 );
|
Vector3 average( 0 );
|
||||||
numVerts = 0;
|
int numVerts = 0;
|
||||||
numVotes = 0;
|
int numVotes = 0;
|
||||||
|
|
||||||
/* build a table of coincident vertexes */
|
/* build a table of coincident vertexes */
|
||||||
for ( j = i; j < numBSPDrawVerts && numVerts < MAX_SAMPLES; j++ )
|
for ( j = i; j < numBSPDrawVerts && numVerts < MAX_SAMPLES; j++ )
|
||||||
|
|
@ -396,7 +395,7 @@ static void PerturbNormal( bspDrawVert_t *dv, shaderInfo_t *si, Vector3& pNormal
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remap sampled normal from [0,255] to [-1,-1] */
|
/* remap sampled normal from [0,255] to [-1,-1] */
|
||||||
bump.rgb() = ( bump.rgb() - Vector3().set( 127.0f ) ) * ( 1.0f / 127.5f );
|
bump.rgb() = ( bump.rgb() - Vector3( 127.0f ) ) * ( 1.0f / 127.5f );
|
||||||
|
|
||||||
/* scale tangent vectors and add to original normal */
|
/* scale tangent vectors and add to original normal */
|
||||||
pNormal = dv->normal + stv[ 0 ] * bump[ 0 ] + ttv[ 0 ] * bump[ 1 ] + dv->normal * bump[ 2 ];
|
pNormal = dv->normal + stv[ 0 ] * bump[ 0 ] + ttv[ 0 ] * bump[ 1 ] + dv->normal * bump[ 2 ];
|
||||||
|
|
@ -1676,7 +1675,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, const Vector
|
||||||
Vector3 deluxel[ 4 ];
|
Vector3 deluxel[ 4 ];
|
||||||
Vector3 origin[ 4 ], normal[ 4 ];
|
Vector3 origin[ 4 ], normal[ 4 ];
|
||||||
float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
|
float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
|
||||||
Vector3 color, direction( 0, 0, 0 ), total( 0, 0, 0 );
|
Vector3 color, direction( 0 ), total( 0 );
|
||||||
|
|
||||||
|
|
||||||
/* limit check */
|
/* limit check */
|
||||||
|
|
@ -1795,7 +1794,7 @@ static void RandomSubsampleRawLuxel( rawLightmap_t *lm, trace_t *trace, const Ve
|
||||||
int b, mapped = 0;
|
int b, mapped = 0;
|
||||||
int cluster;
|
int cluster;
|
||||||
Vector3 origin, normal;
|
Vector3 origin, normal;
|
||||||
Vector3 total( 0, 0, 0 ), totaldirection( 0, 0, 0 );
|
Vector3 total( 0 ), totaldirection( 0 );
|
||||||
float dx, dy;
|
float dx, dy;
|
||||||
|
|
||||||
for ( b = 0; b < lightSamples; ++b )
|
for ( b = 0; b < lightSamples; ++b )
|
||||||
|
|
@ -1918,7 +1917,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){
|
||||||
|
|
||||||
/* color the luxel with lightmap axis? */
|
/* color the luxel with lightmap axis? */
|
||||||
else if ( debugAxis ) {
|
else if ( debugAxis ) {
|
||||||
luxel.value = ( lm->axis + Vector3( 1, 1, 1 ) ) * 127.5f;
|
luxel.value = ( lm->axis + Vector3( 1 ) ) * 127.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* color the luxel with luxel cluster? */
|
/* color the luxel with luxel cluster? */
|
||||||
|
|
@ -1935,7 +1934,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){
|
||||||
|
|
||||||
/* color the luxel with the normal */
|
/* color the luxel with the normal */
|
||||||
else if ( normalmap ) {
|
else if ( normalmap ) {
|
||||||
luxel.value = ( lm->getSuperNormal( x, y ) + Vector3( 1, 1, 1 ) ) * 127.5f;
|
luxel.value = ( lm->getSuperNormal( x, y ) + Vector3( 1 ) ) * 127.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* otherwise clear it */
|
/* otherwise clear it */
|
||||||
|
|
@ -2126,7 +2125,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){
|
||||||
/* setup */
|
/* setup */
|
||||||
mapped = 0;
|
mapped = 0;
|
||||||
lighted = 0;
|
lighted = 0;
|
||||||
Vector3 total( 0, 0, 0 );
|
Vector3 total( 0 );
|
||||||
|
|
||||||
/* test 2x2 stamp */
|
/* test 2x2 stamp */
|
||||||
for ( t = 0; t < 4; t++ )
|
for ( t = 0; t < 4; t++ )
|
||||||
|
|
@ -2372,7 +2371,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){
|
||||||
//% if( lm->getSuperCluster( x, y ) < 0 )
|
//% if( lm->getSuperCluster( x, y ) < 0 )
|
||||||
//% continue;
|
//% continue;
|
||||||
|
|
||||||
lm->getSuperLuxel( lightmapNum, x, y ).value = lm->getSuperNormal( x, y ) * 127 + Vector3( 127, 127, 127 );
|
lm->getSuperLuxel( lightmapNum, x, y ).value = lm->getSuperNormal( x, y ) * 127 + Vector3( 127 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2634,7 +2633,7 @@ void IlluminateVertexes( int num ){
|
||||||
|
|
||||||
/* color the luxel with the normal */
|
/* color the luxel with the normal */
|
||||||
else if ( normalmap ) {
|
else if ( normalmap ) {
|
||||||
radVertLuxel = ( verts[ i ].normal + Vector3( 1, 1, 1 ) ) * 127.5f;
|
radVertLuxel = ( verts[ i ].normal + Vector3( 1 ) ) * 127.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( info->si->noVertexLight ) {
|
else if ( info->si->noVertexLight ) {
|
||||||
|
|
@ -2712,7 +2711,7 @@ void IlluminateVertexes( int num ){
|
||||||
z1 = ( ( z >> 1 ) ^ ( z & 1 ? -1 : 0 ) ) + ( z & 1 );
|
z1 = ( ( z >> 1 ) ^ ( z & 1 ? -1 : 0 ) ) + ( z & 1 );
|
||||||
|
|
||||||
/* nudge origin */
|
/* nudge origin */
|
||||||
trace.origin = verts[ i ].xyz + Vector3( x1, y1, z1 ) * Vector3().set( VERTEX_NUDGE );
|
trace.origin = verts[ i ].xyz + Vector3( x1, y1, z1 ) * Vector3( VERTEX_NUDGE );
|
||||||
|
|
||||||
/* try at nudged origin */
|
/* try at nudged origin */
|
||||||
trace.cluster = ClusterForPointExtFilter( origin, VERTEX_EPSILON, info->numSurfaceClusters, &surfaceClusters[ info->firstSurfaceCluster ] );
|
trace.cluster = ClusterForPointExtFilter( origin, VERTEX_EPSILON, info->numSurfaceClusters, &surfaceClusters[ info->firstSurfaceCluster ] );
|
||||||
|
|
@ -2857,7 +2856,7 @@ void IlluminateVertexes( int num ){
|
||||||
|
|
||||||
/* color the luxel with the normal? */
|
/* color the luxel with the normal? */
|
||||||
if ( normalmap ) {
|
if ( normalmap ) {
|
||||||
radVertLuxel = ( verts[ i ].normal + Vector3( 1, 1, 1 ) ) * 127.5f;
|
radVertLuxel = ( verts[ i ].normal + Vector3( 1 ) ) * 127.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* color the luxel with surface num? */
|
/* color the luxel with surface num? */
|
||||||
|
|
|
||||||
|
|
@ -1271,7 +1271,7 @@ void StitchSurfaceLightmaps( void ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* walk candidate luxels */
|
/* walk candidate luxels */
|
||||||
Vector3 average( 0, 0, 0 );
|
Vector3 average( 0 );
|
||||||
numLuxels = 0;
|
numLuxels = 0;
|
||||||
totalColor = 0.0f;
|
totalColor = 0.0f;
|
||||||
for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ )
|
for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ )
|
||||||
|
|
@ -2182,7 +2182,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){
|
||||||
if ( deluxemap ) {
|
if ( deluxemap ) {
|
||||||
/* normalize average light direction */
|
/* normalize average light direction */
|
||||||
const Vector3 direction = VectorNormalized( lm->getBspDeluxel( x, y ) * 1000.0f ) * 127.5f;
|
const Vector3 direction = VectorNormalized( lm->getBspDeluxel( x, y ) * 1000.0f ) * 127.5f;
|
||||||
olm->bspDirBytes[ oy * olm->customWidth + ox ] = direction + Vector3().set( 127.5f );
|
olm->bspDirBytes[ oy * olm->customWidth + ox ] = direction + Vector3( 127.5f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2282,7 +2282,7 @@ void FillOutLightmap( outLightmap_t *olm ){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
Vector3 dir_sum( 0, 0, 0 ), light_sum( 0, 0, 0 );
|
Vector3 dir_sum( 0 ), light_sum( 0 );
|
||||||
|
|
||||||
/* try all four neighbors */
|
/* try all four neighbors */
|
||||||
ofs = ( ( y + olm->customHeight - 1 ) % olm->customHeight ) * olm->customWidth + x;
|
ofs = ( ( y + olm->customHeight - 1 ) % olm->customHeight ) * olm->customWidth + x;
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ void SnapPlaneImproved( Plane3f& plane, int numPoints, const Vector3 *points ){
|
||||||
if ( SnapNormal( plane.normal() ) ) {
|
if ( SnapNormal( plane.normal() ) ) {
|
||||||
if ( numPoints > 0 ) {
|
if ( numPoints > 0 ) {
|
||||||
// Adjust the dist so that the provided points don't drift away.
|
// Adjust the dist so that the provided points don't drift away.
|
||||||
Vector3 center( 0, 0, 0 );
|
Vector3 center( 0 );
|
||||||
for ( int i = 0; i < numPoints; i++ )
|
for ( int i = 0; i < numPoints; i++ )
|
||||||
{
|
{
|
||||||
center += points[i];
|
center += points[i];
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ void MakeMeshNormals( mesh_t in ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 sum( 0, 0, 0 );
|
Vector3 sum( 0 );
|
||||||
for ( k = 0 ; k < 8 ; k++ ) {
|
for ( k = 0 ; k < 8 ; k++ ) {
|
||||||
if ( !good[k] || !good[( k + 1 ) & 7] ) {
|
if ( !good[k] || !good[( k + 1 ) & 7] ) {
|
||||||
continue; // didn't get two points
|
continue; // didn't get two points
|
||||||
|
|
|
||||||
|
|
@ -500,7 +500,7 @@ void InsertModel( const char *name, int skin, int frame, const Matrix4& transfor
|
||||||
double normalEpsilon_save;
|
double normalEpsilon_save;
|
||||||
bool snpd;
|
bool snpd;
|
||||||
MinMax minmax;
|
MinMax minmax;
|
||||||
Vector3 avgDirection( 0, 0, 0 );
|
Vector3 avgDirection( 0 );
|
||||||
int axis;
|
int axis;
|
||||||
#define nonax_clip_dbg 0
|
#define nonax_clip_dbg 0
|
||||||
|
|
||||||
|
|
@ -1318,14 +1318,14 @@ void AddTriangleModels( entity_t *eparent ){
|
||||||
origin -= eparent->origin; /* offset by parent */
|
origin -= eparent->origin; /* offset by parent */
|
||||||
|
|
||||||
/* get scale */
|
/* get scale */
|
||||||
Vector3 scale( 1, 1, 1 );
|
Vector3 scale( 1 );
|
||||||
if( !e->read_keyvalue( scale, "modelscale_vec" ) )
|
if( !e->read_keyvalue( scale, "modelscale_vec" ) )
|
||||||
if( e->read_keyvalue( scale[0], "modelscale" ) )
|
if( e->read_keyvalue( scale[0], "modelscale" ) )
|
||||||
scale[1] = scale[2] = scale[0];
|
scale[1] = scale[2] = scale[0];
|
||||||
|
|
||||||
/* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */
|
/* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */
|
||||||
const char *value;
|
const char *value;
|
||||||
Vector3 angles( 0, 0, 0 );
|
Vector3 angles( 0 );
|
||||||
if ( !e->read_keyvalue( value, "angles" ) ||
|
if ( !e->read_keyvalue( value, "angles" ) ||
|
||||||
3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) )
|
3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) )
|
||||||
e->read_keyvalue( angles[ 2 ], "angle" );
|
e->read_keyvalue( angles[ 2 ], "angle" );
|
||||||
|
|
|
||||||
|
|
@ -183,8 +183,8 @@ void MakeHeadnodePortals( tree_t *tree ){
|
||||||
node = tree->headnode;
|
node = tree->headnode;
|
||||||
|
|
||||||
// pad with some space so there will never be null volume leafs
|
// pad with some space so there will never be null volume leafs
|
||||||
const MinMax bounds( tree->minmax.mins - Vector3().set( SIDESPACE ),
|
const MinMax bounds( tree->minmax.mins - Vector3( SIDESPACE ),
|
||||||
tree->minmax.maxs + Vector3().set( SIDESPACE ) );
|
tree->minmax.maxs + Vector3( SIDESPACE ) );
|
||||||
if ( !bounds.valid() ) {
|
if ( !bounds.valid() ) {
|
||||||
Error( "Backwards tree volume" );
|
Error( "Backwards tree volume" );
|
||||||
}
|
}
|
||||||
|
|
@ -632,13 +632,13 @@ EFloodEntities FloodEntities( tree_t *tree ){
|
||||||
skybox = true;
|
skybox = true;
|
||||||
|
|
||||||
/* get scale */
|
/* get scale */
|
||||||
Vector3 scale( 64, 64, 64 );
|
Vector3 scale( 64 );
|
||||||
if( !e.read_keyvalue( scale, "_scale" ) )
|
if( !e.read_keyvalue( scale, "_scale" ) )
|
||||||
if( e.read_keyvalue( scale[0], "_scale" ) )
|
if( e.read_keyvalue( scale[0], "_scale" ) )
|
||||||
scale[1] = scale[2] = scale[0];
|
scale[1] = scale[2] = scale[0];
|
||||||
|
|
||||||
/* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */
|
/* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */
|
||||||
Vector3 angles( 0, 0, 0 );
|
Vector3 angles( 0 );
|
||||||
if ( !e.read_keyvalue( value, "angles" ) ||
|
if ( !e.read_keyvalue( value, "angles" ) ||
|
||||||
3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) )
|
3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) )
|
||||||
e.read_keyvalue( angles[ 2 ], "angle" );
|
e.read_keyvalue( angles[ 2 ], "angle" );
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,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 = { 0, 0, 0 }; /* ydnar: explicit lightmap axis projection */
|
Vector3 lightmapAxis{ 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 */
|
||||||
|
|
@ -671,7 +671,7 @@ struct shaderInfo_t
|
||||||
int skyLightIterations; /* ydnar */
|
int skyLightIterations; /* ydnar */
|
||||||
sun_t *sun; /* ydnar */
|
sun_t *sun; /* ydnar */
|
||||||
|
|
||||||
Vector3 color = { 0, 0, 0 }; /* normalized color */
|
Vector3 color{ 0 }; /* normalized color */
|
||||||
Color4f averageColor = { 0, 0, 0, 0 };
|
Color4f averageColor = { 0, 0, 0, 0 };
|
||||||
byte lightStyle;
|
byte lightStyle;
|
||||||
|
|
||||||
|
|
@ -689,7 +689,7 @@ struct shaderInfo_t
|
||||||
int shaderWidth, shaderHeight; /* ydnar */
|
int shaderWidth, shaderHeight; /* ydnar */
|
||||||
Vector2 stFlat;
|
Vector2 stFlat;
|
||||||
|
|
||||||
Vector3 fogDir = { 0, 0, 0 }; /* ydnar */
|
Vector3 fogDir{ 0 }; /* ydnar */
|
||||||
|
|
||||||
char *shaderText; /* ydnar */
|
char *shaderText; /* ydnar */
|
||||||
bool custom;
|
bool custom;
|
||||||
|
|
@ -2127,7 +2127,7 @@ Q_EXTERN int allocatedmapplanes Q_ASSIGN( 0 );
|
||||||
Q_EXTERN int numMapPatches;
|
Q_EXTERN int numMapPatches;
|
||||||
Q_EXTERN MinMax g_mapMinmax;
|
Q_EXTERN MinMax g_mapMinmax;
|
||||||
|
|
||||||
inline const MinMax c_worldMinmax( Vector3().set( MIN_WORLD_COORD ), Vector3().set( MAX_WORLD_COORD ) );
|
inline const MinMax c_worldMinmax( Vector3( MIN_WORLD_COORD ), Vector3( MAX_WORLD_COORD ) );
|
||||||
|
|
||||||
Q_EXTERN int defaultFogNum Q_ASSIGN( -1 ); /* ydnar: cleaner fog handling */
|
Q_EXTERN int defaultFogNum Q_ASSIGN( -1 ); /* ydnar: cleaner fog handling */
|
||||||
Q_EXTERN int numMapFogs Q_ASSIGN( 0 );
|
Q_EXTERN int numMapFogs Q_ASSIGN( 0 );
|
||||||
|
|
|
||||||
|
|
@ -1183,7 +1183,7 @@ mapDrawSurface_t *DrawSurfaceForShader( const char *shader ){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void AddSurfaceFlare( mapDrawSurface_t *ds, const Vector3& entityOrigin ){
|
static void AddSurfaceFlare( mapDrawSurface_t *ds, const Vector3& entityOrigin ){
|
||||||
Vector3 origin( 0, 0, 0 );
|
Vector3 origin( 0 );
|
||||||
/* find centroid */
|
/* find centroid */
|
||||||
for ( int i = 0; i < ds->numVerts; i++ )
|
for ( int i = 0; i < ds->numVerts; i++ )
|
||||||
origin += ds->verts[ i ].xyz;
|
origin += ds->verts[ i ].xyz;
|
||||||
|
|
@ -1227,7 +1227,7 @@ static void SubdivideFace_r( entity_t *e, brush_t *brush, side_t *side, winding_
|
||||||
/* split the face */
|
/* split the face */
|
||||||
for ( axis = 0; axis < 3; axis++ )
|
for ( axis = 0; axis < 3; axis++ )
|
||||||
{
|
{
|
||||||
Vector3 planePoint( 0, 0, 0 );
|
Vector3 planePoint( 0 );
|
||||||
Plane3f plane( 0, 0, 0, 0 );
|
Plane3f plane( 0, 0, 0, 0 );
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2866,8 +2866,8 @@ void MakeFogHullSurfs( entity_t *e, tree_t *tree, const char *shader ){
|
||||||
Sys_FPrintf( SYS_VRB, "--- MakeFogHullSurfs ---\n" );
|
Sys_FPrintf( SYS_VRB, "--- MakeFogHullSurfs ---\n" );
|
||||||
|
|
||||||
/* get hull bounds */
|
/* get hull bounds */
|
||||||
const Vector3 fogMins = g_mapMinmax.mins - Vector3( 128, 128, 128 );
|
const Vector3 fogMins = g_mapMinmax.mins - Vector3( 128 );
|
||||||
const Vector3 fogMaxs = g_mapMinmax.maxs + Vector3( 128, 128, 128 );
|
const Vector3 fogMaxs = g_mapMinmax.maxs + Vector3( 128 );
|
||||||
|
|
||||||
/* get foghull shader */
|
/* get foghull shader */
|
||||||
si = ShaderInfoForShader( shader );
|
si = ShaderInfoForShader( shader );
|
||||||
|
|
@ -2969,7 +2969,7 @@ int AddSurfaceModelsToTriangle_r( mapDrawSurface_t *ds, const surfaceModel_t& mo
|
||||||
|
|
||||||
/* calculate scale */
|
/* calculate scale */
|
||||||
r = model.minScale + Random() * ( model.maxScale - model.minScale );
|
r = model.minScale + Random() * ( model.maxScale - model.minScale );
|
||||||
const Vector3 scale( r, r, r );
|
const Vector3 scale( r );
|
||||||
|
|
||||||
/* calculate angle */
|
/* calculate angle */
|
||||||
angle = model.minAngle + Random() * ( model.maxAngle - model.minAngle );
|
angle = model.minAngle + Random() * ( model.maxAngle - model.minAngle );
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ void Foliage( mapDrawSurface_t *src ){
|
||||||
oldNumMapDrawSurfs = numMapDrawSurfs;
|
oldNumMapDrawSurfs = numMapDrawSurfs;
|
||||||
|
|
||||||
/* add the model to the bsp */
|
/* add the model to the bsp */
|
||||||
InsertModel( foliage.model.c_str(), 0, 0, matrix4_scale_for_vec3( Vector3().set( foliage.scale ) ), NULL, NULL, src->entityNum, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal );
|
InsertModel( foliage.model.c_str(), 0, 0, matrix4_scale_for_vec3( Vector3( foliage.scale ) ), NULL, NULL, src->entityNum, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal );
|
||||||
|
|
||||||
/* walk each new surface */
|
/* walk each new surface */
|
||||||
for ( i = oldNumMapDrawSurfs; i < numMapDrawSurfs; i++ )
|
for ( i = oldNumMapDrawSurfs; i < numMapDrawSurfs; i++ )
|
||||||
|
|
|
||||||
|
|
@ -1095,12 +1095,11 @@ void FixMetaTJunctions( void ){
|
||||||
#define EQUAL_NORMAL_EPSILON 0.01f
|
#define EQUAL_NORMAL_EPSILON 0.01f
|
||||||
|
|
||||||
void SmoothMetaTriangles( void ){
|
void SmoothMetaTriangles( void ){
|
||||||
int i, j, k, f, fOld, start, numVerts, numVotes, numSmoothed;
|
int i, j, k, f, fOld, start, numSmoothed;
|
||||||
float shadeAngle, defaultShadeAngle, maxShadeAngle;
|
float shadeAngle, defaultShadeAngle, maxShadeAngle;
|
||||||
metaTriangle_t *tri;
|
metaTriangle_t *tri;
|
||||||
float *shadeAngles;
|
float *shadeAngles;
|
||||||
byte *smoothed;
|
byte *smoothed;
|
||||||
Vector3 average;
|
|
||||||
int indexes[ MAX_SAMPLES ];
|
int indexes[ MAX_SAMPLES ];
|
||||||
Vector3 votes[ MAX_SAMPLES ];
|
Vector3 votes[ MAX_SAMPLES ];
|
||||||
|
|
||||||
|
|
@ -1177,9 +1176,9 @@ void SmoothMetaTriangles( void ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear */
|
/* clear */
|
||||||
average.set( 0 );
|
Vector3 average( 0 );
|
||||||
numVerts = 0;
|
int numVerts = 0;
|
||||||
numVotes = 0;
|
int numVotes = 0;
|
||||||
|
|
||||||
/* build a table of coincident vertexes */
|
/* build a table of coincident vertexes */
|
||||||
for ( j = i; j < numMetaVerts && numVerts < MAX_SAMPLES; j++ )
|
for ( j = i; j < numMetaVerts && numVerts < MAX_SAMPLES; j++ )
|
||||||
|
|
@ -1727,8 +1726,8 @@ struct CompareMetaTriangles
|
||||||
/* then position in world */
|
/* then position in world */
|
||||||
|
|
||||||
/* find mins */
|
/* find mins */
|
||||||
Vector3 aMins( 999999, 999999, 999999 );
|
Vector3 aMins( 999999 );
|
||||||
Vector3 bMins( 999999, 999999, 999999 );
|
Vector3 bMins( 999999 );
|
||||||
for ( int i = 0; i < 3; i++ )
|
for ( int i = 0; i < 3; i++ )
|
||||||
{
|
{
|
||||||
const int av = a.indexes[ i ];
|
const int av = a.indexes[ i ];
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ void CalcVis( void ){
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void SetPortalSphere( vportal_t *p ){
|
void SetPortalSphere( vportal_t *p ){
|
||||||
Vector3 total( 0, 0, 0 );
|
Vector3 total( 0 );
|
||||||
fixedWinding_t *w;
|
fixedWinding_t *w;
|
||||||
|
|
||||||
w = p->winding;
|
w = p->winding;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user