]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
interface work for colormod
authorRudolf Polzer <divverent@xonotic.org>
Tue, 30 Aug 2011 19:49:21 +0000 (21:49 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 30 Aug 2011 19:49:21 +0000 (21:49 +0200)
tools/quake3/q3map2/map.c
tools/quake3/q3map2/model.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/surface.c
tools/quake3/q3map2/surface_foliage.c

index 9534bdb3111912190a8d972cb20133b116f6a4f1..9e1924455b6d5614e17db270899a9a81b7172b48 100644 (file)
@@ -1587,6 +1587,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
        parseMesh_t             *patch;
        qboolean                funcGroup;
        int                             castShadows, recvShadows;
+       vec3_t                  colormod;
        
        
        /* eof check */
@@ -1735,6 +1736,12 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
                if( lightmapScale > 0.0f )
                        Sys_Printf( "Entity %d (%s) has lightmap scale of %.4f\n", mapEnt->mapEntityNum, classname, lightmapScale );
        }
+
+       VectorClear(colormod);
+       if( strcmp( "", ValueForKey( mapEnt, "_color" ) ) )
+       {
+               GetVectorForKey( mapEnt, "_color", colormod );
+       }
        
        /* ydnar: get cel shader :) for this entity */
        value = ValueForKey( mapEnt, "_celshader" );
@@ -1797,6 +1804,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
                brush->lightmapScale = lightmapScale;
                brush->celShader = celShader;
                brush->shadeAngleDegrees = shadeAngle;
+               brush->colormod = colormod;
        }
        
        for( patch = mapEnt->patches; patch != NULL; patch = patch->next )
@@ -1807,6 +1815,7 @@ static qboolean ParseMapEntity( qboolean onlyLights, qboolean noCollapseGroups )
                patch->lightmapSampleSize = lightmapSampleSize;
                patch->lightmapScale = lightmapScale;
                patch->celShader = celShader;
+               patch->colormod = colormod;
        }
        
        /* ydnar: gs mods: set entity bounds */
index 2b3bb7ed5f0059d5c1cc18862c65e47517b36f08..b67fc4e35c381be51c12d62aed38d4ab854bf035 100644 (file)
@@ -206,7 +206,7 @@ InsertModel() - ydnar
 adds a picomodel into the bsp
 */
 
-void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle )
+void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, vec3_t colormod )
 {
        int                                     i, j, s, numSurfaces;
        m4x4_t                          identity, nTransform;
@@ -420,6 +420,9 @@ void InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap
                if( lightmapScale > 0.0f )
                        ds->lightmapScale = lightmapScale;
 
+               /* set color mod */
+               ds->colormod = colormod;
+
                /* set shading angle */
                if( shadeAngle > 0.0f )
                        ds->shadeAngleDegrees = shadeAngle;
@@ -899,7 +902,7 @@ void AddTriangleModels( entity_t *e )
                        skin = IntForKey(e2, "skin");
 
                /* insert the model */
-               InsertModel( model, skin, frame, transform, remap, celShader, mapEntityNum, castShadows, recvShadows, spawnFlags, lightmapScale, lightmapSampleSize, shadeAngle );
+               InsertModel( model, skin, frame, transform, remap, celShader, mapEntityNum, castShadows, recvShadows, spawnFlags, lightmapScale, lightmapSampleSize, shadeAngle, colormod );
                
                /* free shader remappings */
                while( remap != NULL )
index e912d15b26865f6b98d6ad01ddf6d6f1838606bd..6133243cb04e1988429f6674eff7ce8878d9039e 100644 (file)
@@ -911,6 +911,7 @@ typedef struct brush_s
        /* ydnar: gs mods */
        int                                     lightmapSampleSize; /* jal : entity based _lightmapsamplesize */
        float                           lightmapScale;
+       vec3_t                          colormod;
        float                           shadeAngleDegrees; /* jal : entity based _shadeangle */
        vec3_t                          eMins, eMaxs;
        indexMap_t                      *im;
@@ -924,7 +925,7 @@ typedef struct brush_s
 
        vec3_t                          mins, maxs;
        int                                     numsides;
-       
+
        side_t                          sides[ 6 ];                     /* variably sized */
 }
 brush_t;
@@ -964,6 +965,7 @@ typedef struct parseMesh_s
        /* ydnar: gs mods */
        int                                     lightmapSampleSize;             /* jal : entity based _lightmapsamplesize */
        float                           lightmapScale;
+       vec3_t                          colormod;
        vec3_t                          eMins, eMaxs;
        indexMap_t                      *im;
        
@@ -1061,6 +1063,9 @@ typedef struct mapDrawSurface_s
        /* ydnar: per-surface (per-entity, actually) lightmap sample size scaling */
        float                           lightmapScale;
 
+       /* divVerent: per-surface (per-entity, actually) color modding */
+       vec3_t                          colormod;
+
        /* jal: per-surface (per-entity, actually) shadeangle */
        float                           shadeAngleDegrees;
        
@@ -1669,7 +1674,7 @@ void                                              PicoPrintFunc( int level, const char *str );
 void                                           PicoLoadFileFunc( const char *name, byte **buffer, int *bufSize );
 picoModel_t                                    *FindModel( const char *name, int frame );
 picoModel_t                                    *LoadModel( const char *name, int frame );
-void                                           InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle );
+void                                           InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle, vec3_t colormod );
 void                                           AddTriangleModels( entity_t *e );
 
 
index b5dd724e15d9ee564b548f465129ec8d80108ff3..bc479b9386c0b3dc13dbb410caa14be07fcb4371 100644 (file)
@@ -921,6 +921,7 @@ mapDrawSurface_t *DrawSurfaceForSide( entity_t *e, brush_t *b, side_t *s, windin
        ds->fogNum = -1;
        ds->sampleSize = b->lightmapSampleSize;
        ds->lightmapScale = b->lightmapScale;
+       ds->colormod = b->colormod;
        ds->numVerts = w->numpoints;
        ds->verts = safe_malloc( ds->numVerts * sizeof( *ds->verts ) );
        memset( ds->verts, 0, ds->numVerts * sizeof( *ds->verts ) );
@@ -1109,6 +1110,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh
        ds->mapMesh = p;
        ds->sampleSize = p->lightmapSampleSize;
        ds->lightmapScale = p->lightmapScale;   /* ydnar */
+       ds->colormod = p->colormod;
        ds->patchWidth = mesh->width;
        ds->patchHeight = mesh->height;
        ds->numVerts = ds->patchWidth * ds->patchHeight;
@@ -3173,7 +3175,7 @@ int AddSurfaceModelsToTriangle_r( mapDrawSurface_t *ds, surfaceModel_t *model, b
                        }
                        
                        /* insert the model */
-                       InsertModel( (char *) model->model, 0, 0, transform, NULL, ds->celShader, ds->entityNum, ds->castShadows, ds->recvShadows, 0, ds->lightmapScale, 0, 0 );
+                       InsertModel( (char *) model->model, 0, 0, transform, NULL, ds->celShader, ds->entityNum, ds->castShadows, ds->recvShadows, 0, ds->lightmapScale, 0, 0, ds->colormod );
                        
                        /* return to sender */
                        return 1;
index cc5452aec5fed549352595233dcb56010a3ccbf4..f15fdef46a1b021e58810857fe0e8f980f68463a 100644 (file)
@@ -275,7 +275,7 @@ void Foliage( mapDrawSurface_t *src )
                m4x4_scale_for_vec3( transform, scale );
                
                /* add the model to the bsp */
-               InsertModel( foliage->model, 0, 0, transform, NULL, NULL, src->entityNum, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0 );
+               InsertModel( foliage->model, 0, 0, transform, NULL, NULL, src->entityNum, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, src->colormod );
                
                /* walk each new surface */
                for( i = oldNumMapDrawSurfs; i < numMapDrawSurfs; i++ )