dotProduct2scale, dotProductScale shader parameters
authorrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Mon, 22 Sep 2008 05:46:42 +0000 (05:46 +0000)
committerrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Mon, 22 Sep 2008 05:46:42 +0000 (05:46 +0000)
(two extra args for the min/max of the range to map 0..1 to)

git-svn-id: svn://svn.icculus.org/netradiant/trunk@98 61c419a2-8eb2-4b30-bcec-8cead039b335

tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/shaders.c

index b5525fd..18db5b1 100644 (file)
@@ -635,8 +635,12 @@ typedef enum
        CM_ALPHA_SCALE,
        CM_COLOR_DOT_PRODUCT,
        CM_ALPHA_DOT_PRODUCT,
+       CM_COLOR_DOT_PRODUCT_SCALE,
+       CM_ALPHA_DOT_PRODUCT_SCALE,
        CM_COLOR_DOT_PRODUCT_2,
-       CM_ALPHA_DOT_PRODUCT_2
+       CM_ALPHA_DOT_PRODUCT_2,
+       CM_COLOR_DOT_PRODUCT_2_SCALE,
+       CM_ALPHA_DOT_PRODUCT_2_SCALE
 }
 colorModType_t;
 
index a0d5d79..da86549 100644 (file)
@@ -98,21 +98,47 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts )
                                        VectorSet( mult, c, c, c );
                                        break;
                                
+                               case CM_COLOR_DOT_PRODUCT_SCALE:
+                                       c = DotProduct( dv->normal, cm2->data );
+                                       c = cm2->data[4] + c * (cm2->data[5] - cm2->data[4]);
+                                       VectorSet( mult, c, c, c );
+                                       break;
+                               
                                case CM_ALPHA_DOT_PRODUCT:
                                        mult[ 3 ] = DotProduct( dv->normal, cm2->data );
                                        break;
                                
+                               case CM_ALPHA_DOT_PRODUCT_SCALE:
+                                       c = DotProduct( dv->normal, cm2->data );
+                                       c = cm2->data[4] + c * (cm2->data[5] - cm2->data[4]);
+                                       mult[ 3 ] = c;
+                                       break;
+                               
                                case CM_COLOR_DOT_PRODUCT_2:
                                        c = DotProduct( dv->normal, cm2->data );
                                        c *= c;
                                        VectorSet( mult, c, c, c );
                                        break;
                                
+                               case CM_COLOR_DOT_PRODUCT_2_SCALE:
+                                       c = DotProduct( dv->normal, cm2->data );
+                                       c *= c;
+                                       c = cm2->data[4] + c * (cm2->data[5] - cm2->data[4]);
+                                       VectorSet( mult, c, c, c );
+                                       break;
+                               
                                case CM_ALPHA_DOT_PRODUCT_2:
                                        mult[ 3 ] = DotProduct( dv->normal, cm2->data );
                                        mult[ 3 ] *= mult[ 3 ];
                                        break;
                                
+                               case CM_ALPHA_DOT_PRODUCT_2_SCALE:
+                                       c = DotProduct( dv->normal, cm2->data );
+                                       c *= c;
+                                       c = cm2->data[4] + c * (cm2->data[5] - cm2->data[4]);
+                                       mult[ 3 ] = c;
+                                       break;
+                               
                                default:
                                        break;
                        }
@@ -1753,6 +1779,13 @@ static void ParseShaderFile( const char *filename )
                                                Parse1DMatrixAppend( shaderText, 3, cm->data );
                                        }
                                        
+                                       /* dotProduct2scale ( X Y Z MIN MAX ) */
+                                       else if( !Q_stricmp( token, "dotProduct2scale" ) )
+                                       {
+                                               cm->type = CM_COLOR_DOT_PRODUCT_2_SCALE + alpha;
+                                               Parse1DMatrixAppend( shaderText, 5, cm->data );
+                                       }
+                                       
                                        /* volume */
                                        else if( !Q_stricmp( token, "volume" ) )
                                        {