autoblend key setup

This commit is contained in:
Garux
2024-05-22 08:16:41 +05:00
parent 648a836c5c
commit a456368a98
6 changed files with 18 additions and 5 deletions
+3
View File
@@ -1594,6 +1594,8 @@ static bool ParseMapEntity( bool onlyLights, bool noCollapseGroups, int mapEntit
if ( lightmapSampleSize != 0 )
Sys_Printf( "Entity %d (%s) has lightmap sample size of %d\n", mapEnt.mapEntityNum, classname, lightmapSampleSize );
const int autoblendIdx = mapEnt.boolForKey( "_autoblend" )? ++mapDrawSurface_t::autoblendMaxIdx : 0;
/* attach stuff to everything in the entity */
for ( brush_t& brush : mapEnt.brushes )
{
@@ -1604,6 +1606,7 @@ static bool ParseMapEntity( bool onlyLights, bool noCollapseGroups, int mapEntit
brush.lightmapScale = lightmapScale;
brush.celShader = celShader;
brush.shadeAngleDegrees = shadeAngle;
brush.autoblendIdx = autoblendIdx;
}
for ( parseMesh_t *patch = mapEnt.patches; patch != NULL; patch = patch->next )
+5 -2
View File
@@ -992,7 +992,7 @@ default_CLIPMODEL:
adds a picomodel into the bsp
*/
void InsertModel( const char *name, const char *skin, int frame, const Matrix4& transform, const std::list<remap_t> *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth ){
void InsertModel( const char *name, const char *skin, int frame, const Matrix4& transform, const std::list<remap_t> *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth, int autoblendIdx ){
int i, j;
const Matrix4 nTransform( matrix4_for_normal_transform( transform ) );
const bool transform_lefthanded = MATRIX4_LEFTHANDED == matrix4_handedness( transform );
@@ -1138,6 +1138,7 @@ void InsertModel( const char *name, const char *skin, int frame, const Matrix4&
ds->entityNum = entity.mapEntityNum;
ds->castShadows = castShadows;
ds->recvShadows = recvShadows;
ds->autoblendIdx = autoblendIdx;
/* set shader */
ds->shaderInfo = si;
@@ -1404,8 +1405,10 @@ void AddTriangleModels( entity_t& eparent ){
if ( e.read_keyvalue( clipDepth, "_clipdepth" ) )
Sys_Printf( "misc_model %s has autoclip depth of %.3f\n", model, clipDepth );
const int autoblendIdx = e.boolForKey( "_autoblend" )? ++mapDrawSurface_t::autoblendMaxIdx : 0;
/* insert the model */
InsertModel( model, skin, frame, transform, &remaps, celShader, eparent, castShadows, recvShadows, spawnFlags, lightmapScale, lightmapSampleSize, shadeAngle, clipDepth );
InsertModel( model, skin, frame, transform, &remaps, celShader, eparent, castShadows, recvShadows, spawnFlags, lightmapScale, lightmapSampleSize, shadeAngle, clipDepth, autoblendIdx );
}
}
+5 -1
View File
@@ -697,6 +697,7 @@ struct brush_t
int lightmapSampleSize; /* jal : entity based _lightmapsamplesize */
float lightmapScale;
float shadeAngleDegrees; /* jal : entity based _shadeangle */
int autoblendIdx;
MinMax eMinmax;
indexMap_t *im;
@@ -859,6 +860,9 @@ struct mapDrawSurface_t
/* ydnar: editor/useful numbering */
int entityNum;
int surfaceNum;
inline static int autoblendMaxIdx = 0;
int autoblendIdx = 0;
};
@@ -1532,7 +1536,7 @@ tree_t FaceBSP( facelist_t& list );
/* model.c */
void assimp_init();
void InsertModel( const char *name, const char *skin, int frame, const Matrix4& transform, const std::list<remap_t> *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth );
void InsertModel( const char *name, const char *skin, int frame, const Matrix4& transform, const std::list<remap_t> *remaps, shaderInfo_t *celShader, entity_t& entity, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, float clipDepth, int autoblendIdx );
void AddTriangleModels( entity_t& eparent );
+2 -1
View File
@@ -770,6 +770,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const
ds->entityNum = b.entityNum;
ds->castShadows = b.castShadows;
ds->recvShadows = b.recvShadows;
ds->autoblendIdx = b.autoblendIdx;
ds->planar = true;
ds->planeNum = s.planenum;
@@ -2806,7 +2807,7 @@ static int AddSurfaceModelsToTriangle_r( mapDrawSurface_t *ds, const surfaceMode
}
/* insert the model */
InsertModel( model.model.c_str(), NULL, 0, transform, NULL, ds->celShader, entity, ds->castShadows, ds->recvShadows, 0, ds->lightmapScale, 0, 0, clipDepthGlobal );
InsertModel( model.model.c_str(), NULL, 0, transform, NULL, ds->celShader, entity, ds->castShadows, ds->recvShadows, 0, ds->lightmapScale, 0, 0, clipDepthGlobal, 0 );
/* return to sender */
return 1;
+1 -1
View File
@@ -255,7 +255,7 @@ void Foliage( mapDrawSurface_t *src, entity_t& entity ){
oldNumMapDrawSurfs = numMapDrawSurfs;
/* add the model to the bsp */
InsertModel( foliage.model.c_str(), NULL, 0, matrix4_scale_for_vec3( Vector3( foliage.scale ) ), NULL, NULL, entity, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal );
InsertModel( foliage.model.c_str(), NULL, 0, matrix4_scale_for_vec3( Vector3( foliage.scale ) ), NULL, NULL, entity, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal, 0 );
/* walk each new surface */
for ( i = oldNumMapDrawSurfs; i < numMapDrawSurfs; i++ )
+2
View File
@@ -73,6 +73,7 @@ struct metaTriangle_t
const side_t *side;
int entityNum, surfaceNum, planeNum, fogNum, sampleSize, castShadows, recvShadows;
float shadeAngleDegrees;
int autoblendIdx;
Plane3f plane;
Vector3 lightmapAxis;
std::array<metaVertex_t*, 3> m_vertices;
@@ -319,6 +320,7 @@ static void SurfaceToMetaTriangles( mapDrawSurface_t *ds ){
src.fogNum = ds->fogNum;
src.sampleSize = ds->sampleSize;
src.shadeAngleDegrees = ds->shadeAngleDegrees;
src.autoblendIdx = ds->autoblendIdx;
src.lightmapAxis = ds->lightmapAxis;
metaTriangle_insert( src, { ds->verts[ ds->indexes[ i ] ],