diff --git a/docs/shaderManual/general-directives.html b/docs/shaderManual/general-directives.html index 5c500570..25a6c0fd 100644 --- a/docs/shaderManual/general-directives.html +++ b/docs/shaderManual/general-directives.html @@ -181,7 +181,7 @@ textures/skies/xtoxicsky_dm9

sort value

Use this keyword to fine-tune the depth sorting of shaders as they are compared against other shaders in the game world. The basic concept is that if there is a question or a problem with shaders drawing in the wrong order against each other, this allows the designer to create a hierarchy of which shader draws in what order.

-

The default behavior is to put all blended shaders in sort "additive" and all other shaders in sort "opaque", so you only need to specify this when you are trying to work around a sorting problem with multiple transparent surfaces in a scene.

+

The default behavior is to put all blended shaders in sort 9 and all other shaders in sort "opaque", so you only need to specify this when you are trying to work around a sorting problem with multiple transparent surfaces in a scene.

The value here can be either a numerical value or one of the keywords in the following list (listed in order of ascending priority):

portal (1)
This surface is a portal, it draws over every other shader seen inside the portal, but before anything in the main view. Default for shaders marked as portal.
diff --git a/tools/quake3/common/qmath.h b/tools/quake3/common/qmath.h index 505c4ce0..1df21138 100644 --- a/tools/quake3/common/qmath.h +++ b/tools/quake3/common/qmath.h @@ -179,6 +179,11 @@ inline bool VectorIsOnAxis( const Vector3& v ){ return zeroComponentCount > 1; // The zero vector will be on axis. } +/* (pitch yaw roll) -> (roll pitch yaw) */ +inline Vector3 angles_pyr2rpy( const Vector3& angles ){ + return Vector3( angles.z(), angles.x(), angles.y() ); +} + /* ===================== PlaneFromPoints diff --git a/tools/quake3/q3map2/light_trace.cpp b/tools/quake3/q3map2/light_trace.cpp index 4cafaa41..ddbc0a35 100644 --- a/tools/quake3/q3map2/light_trace.cpp +++ b/tools/quake3/q3map2/light_trace.cpp @@ -1059,11 +1059,11 @@ static void PopulateTraceNodes(){ for ( std::size_t i = 1; i < entities.size(); ++i ) { /* get entity */ - entity_t *e = &entities[ i ]; + const entity_t& e = entities[ i ]; /* get shadow flags */ int castShadows = ENTITY_CAST_SHADOWS; - GetEntityShadowFlags( e, NULL, &castShadows, NULL ); + GetEntityShadowFlags( &e, NULL, &castShadows, NULL ); /* early out? */ if ( !castShadows ) { @@ -1071,19 +1071,18 @@ static void PopulateTraceNodes(){ } /* get entity origin */ - const Vector3 origin( e->vectorForKey( "origin" ) ); + const Vector3 origin( e.vectorForKey( "origin" ) ); /* get scale */ Vector3 scale( 1 ); - if( !e->read_keyvalue( scale, "modelscale_vec" ) ) - if( e->read_keyvalue( scale[0], "modelscale" ) ) + if( !e.read_keyvalue( scale, "modelscale_vec" ) ) + if( e.read_keyvalue( scale[0], "modelscale" ) ) scale[1] = scale[2] = scale[0]; /* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */ Vector3 angles( 0 ); - if ( !e->read_keyvalue( value, "angles" ) || - 3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) ) - e->read_keyvalue( angles[ 2 ], "angle" ); + if ( e.read_keyvalue( angles, "angles" ) || e.read_keyvalue( angles.y(), "angle" ) ) + angles = angles_pyr2rpy( angles ); /* set transform matrix (thanks spog) */ transform = g_matrix4_identity; @@ -1095,7 +1094,7 @@ static void PopulateTraceNodes(){ //% m4x4_transpose( transform ); /* get model */ - value = e->valueForKey( "model" ); + value = e.valueForKey( "model" ); /* switch on model type */ switch ( value[ 0 ] ) @@ -1115,12 +1114,12 @@ static void PopulateTraceNodes(){ /* external model */ default: - PopulateWithPicoModel( castShadows, LoadModelWalker( value, e->intForKey( "_frame", "frame" ) ), transform ); + PopulateWithPicoModel( castShadows, LoadModelWalker( value, e.intForKey( "_frame", "frame" ) ), transform ); continue; } /* get model2 */ - value = e->valueForKey( "model2" ); + value = e.valueForKey( "model2" ); /* switch on model type */ switch ( value[ 0 ] ) @@ -1140,7 +1139,7 @@ static void PopulateTraceNodes(){ /* external model */ default: - PopulateWithPicoModel( castShadows, LoadModelWalker( value, e->intForKey( "_frame2" ) ), transform ); + PopulateWithPicoModel( castShadows, LoadModelWalker( value, e.intForKey( "_frame2" ) ), transform ); continue; } } diff --git a/tools/quake3/q3map2/model.cpp b/tools/quake3/q3map2/model.cpp index 19034bea..150f0d70 100644 --- a/tools/quake3/q3map2/model.cpp +++ b/tools/quake3/q3map2/model.cpp @@ -1327,11 +1327,9 @@ void AddTriangleModels( entity_t& eparent ){ scale[1] = scale[2] = scale[0]; /* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */ - const char *value; Vector3 angles( 0 ); - if ( !e.read_keyvalue( value, "angles" ) || - 3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) ) - e.read_keyvalue( angles[ 2 ], "angle" ); + if ( e.read_keyvalue( angles, "angles" ) || e.read_keyvalue( angles.y(), "angle" ) ) + angles = angles_pyr2rpy( angles ); /* set transform matrix (thanks spog) */ Matrix4 transform( g_matrix4_identity ); @@ -1378,7 +1376,7 @@ void AddTriangleModels( entity_t& eparent ){ /* ydnar: cel shader support */ shaderInfo_t *celShader; - if( e.read_keyvalue( value, "_celshader" ) || + if( const char *value; e.read_keyvalue( value, "_celshader" ) || entities[ 0 ].read_keyvalue( value, "_celshader" ) ){ celShader = ShaderInfoForShader( String64()( "textures/", value ) ); } diff --git a/tools/quake3/q3map2/portals.cpp b/tools/quake3/q3map2/portals.cpp index 6c6e7b5b..e11e0716 100644 --- a/tools/quake3/q3map2/portals.cpp +++ b/tools/quake3/q3map2/portals.cpp @@ -542,7 +542,6 @@ static bool PlaceOccupant( node_t *headnode, const Vector3& origin, const entity EFloodEntities FloodEntities( tree_t& tree ){ bool r, inside, skybox; - const char *value; Sys_FPrintf( SYS_VRB, "--- FloodEntities ---\n" ); @@ -580,9 +579,8 @@ EFloodEntities FloodEntities( tree_t& tree ){ /* get "angle" (yaw) or "angles" (pitch yaw roll), store as (roll pitch yaw) */ Vector3 angles( 0 ); - if ( !e.read_keyvalue( value, "angles" ) || - 3 != sscanf( value, "%f %f %f", &angles[ 1 ], &angles[ 2 ], &angles[ 0 ] ) ) - e.read_keyvalue( angles[ 2 ], "angle" ); + if ( e.read_keyvalue( angles, "angles" ) || e.read_keyvalue( angles.y(), "angle" ) ) + angles = angles_pyr2rpy( angles ); /* set transform matrix (thanks spog) */ skyboxTransform = g_matrix4_identity;