]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
bug fix, sorry, mikeeusa... but make dotproduct*scale actually behave the intended...
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Wed, 10 Dec 2008 15:21:33 +0000 (15:21 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Wed, 10 Dec 2008 15:21:33 +0000 (15:21 +0000)
In existing shaders, replace

dotProduct2scale ( x y z min max )

by

dotProduct2scale ( x y z max 0 )

because that's what the old code actually caused

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

tools/quake3/q3map2/shaders.c

index 26d4b20d957374945aa118be5689474f376837fa..72d23b006d7811977d39ffb303d1dbb67ee897d6 100644 (file)
@@ -100,7 +100,7 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts )
                                
                                case CM_COLOR_DOT_PRODUCT_SCALE:
                                        c = DotProduct( dv->normal, cm2->data );
-                                       c = cm2->data[4] + c * (cm2->data[5] - cm2->data[4]);
+                                       c = (c - cm2->data[3]) / (cm2->data[4] - cm2->data[3]);
                                        VectorSet( mult, c, c, c );
                                        break;
                                
@@ -110,7 +110,7 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts )
                                
                                case CM_ALPHA_DOT_PRODUCT_SCALE:
                                        c = DotProduct( dv->normal, cm2->data );
-                                       c = cm2->data[4] + c * (cm2->data[5] - cm2->data[4]);
+                                       c = (c - cm2->data[3]) / (cm2->data[4] - cm2->data[3]);
                                        mult[ 3 ] = c;
                                        break;
                                
@@ -123,7 +123,7 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts )
                                case CM_COLOR_DOT_PRODUCT_2_SCALE:
                                        c = DotProduct( dv->normal, cm2->data );
                                        c *= c;
-                                       c = (c - cm2->data[4]) / (cm2->data[5] - cm2->data[4]);
+                                       c = (c - cm2->data[3]) / (cm2->data[4] - cm2->data[3]);
                                        VectorSet( mult, c, c, c );
                                        break;
                                
@@ -135,7 +135,7 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts )
                                case CM_ALPHA_DOT_PRODUCT_2_SCALE:
                                        c = DotProduct( dv->normal, cm2->data );
                                        c *= c;
-                                       c = (c - cm2->data[4]) / (cm2->data[5] - cm2->data[4]);
+                                       c = (c - cm2->data[3]) / (cm2->data[4] - cm2->data[3]);
                                        mult[ 3 ] = c;
                                        break;
                                
@@ -1776,7 +1776,7 @@ static void ParseShaderFile( const char *filename )
                                        else if( !Q_stricmp( token, "dotProductScale" ) )
                                        {
                                                cm->type = CM_COLOR_DOT_PRODUCT_SCALE + alpha;
-                                               Parse1DMatrixAppend( shaderText, 3, cm->data );
+                                               Parse1DMatrixAppend( shaderText, 5, cm->data );
                                        }
                                        
                                        /* dotProduct2 ( X Y Z ) */