[Bf-committers] Texture.c patch for hard coded values

Kent Mein mein at cs.umn.edu
Tue Mar 8 14:57:15 CET 2005


In reply to Emilie McDavid (hmetalcowgirl at cowgirl.exenex.com):

> Hey guys,
> 
>    This is a simple patch, I just changed the hard coded return values 
> for textures to defines as listed in DNA_texture_type.h. Desoto will 
> probably commit, but if you want to get it before he does, here it is. 
> No hurry.

While I haven't totally looked at this a couple of places you did this change:
-               rv += 2;
+               rv=TEX_NOR;

which I'm guessing is wrong.

Kent

> Index: source/blender/render/intern/source/texture.c
> ===================================================================
> RCS file: /cvsroot/bf-blender/blender/source/blender/render/intern/source/texture.c,v
> retrieving revision 1.40
> diff -u -r1.40 texture.c
> --- source/blender/render/intern/source/texture.c	7 Mar 2005 12:41:23 -0000	1.40
> +++ source/blender/render/intern/source/texture.c	7 Mar 2005 22:04:49 -0000
> @@ -88,7 +88,7 @@
>  	
>  	/* here (+fie_ima/2-1) makes sure that division happens correctly */
>  	
> -	if(tex->frames==0) return 1;
> +	if(tex->frames==0) return TEX_RGB;
>  	
>  	cfra= cfra-tex->sfra+1;
>  	
> @@ -313,7 +313,7 @@
>  
>  	BRICONT;
>  
> -	return 0;
> +	return TEX_INT;
>  }
>  
>  /* ------------------------------------------------------------------------- */
> @@ -323,7 +323,7 @@
>  
>  static int clouds(Tex *tex, float *texvec, TexResult *texres)
>  {
> -	int rv=0;	/* return value, int:0, col:1, nor:2, everything:3 */
> +	int rv=TEX_INT;	/* return value, int:0, col:1, nor:2, everything:3 */
>  	
>  	texres->tin = BLI_gTurbulence(tex->noisesize, texvec[0], texvec[1], texvec[2], tex->noisedepth, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
>  
> @@ -334,7 +334,7 @@
>  		texres->nor[2] = BLI_gTurbulence(tex->noisesize, texvec[0], texvec[1], texvec[2] + tex->nabla, tex->noisedepth,  (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
>  		
>  		tex_normal_derivate(tex, texres);
> -		rv += 2;
> +		rv=TEX_NOR;
>  	}
>  
>  	if (tex->stype==1) {
> @@ -428,7 +428,7 @@
>  		texres->nor[2] = wood_int(tex, texvec[0], texvec[1], texvec[2] + tex->nabla);
>  		
>  		tex_normal_derivate(tex, texres);
> -		rv = TEX_NOR;
> +		rv=TEX_NOR;
>  	}
>  
>  	BRICONT;
> @@ -481,7 +481,7 @@
>  		
>  		tex_normal_derivate(tex, texres);
>  		
> -		rv = TEX_NOR;
> +		rv=TEX_NOR;
>  	}
>  
>  	BRICONT;
> @@ -561,7 +561,7 @@
>  	BRICONTRGB;
>  	texres->ta= 1.0;
>  	
> -	return 1;
> +	return TEX_RGB;
>  }
>  
>  /* ------------------------------------------------------------------------- */
> @@ -571,7 +571,7 @@
>  {
>  	float b2, ofs;
>  
> -	if(texres->nor == NULL) return 0;
> +	if(texres->nor == NULL) return TEX_INT;
>  
>  	ofs= tex->turbul/200.0;
>  
> @@ -589,7 +589,7 @@
>  		texres->nor[2]= -texres->nor[2];
>  	}
>  
> -	return 2;
> +	return TEX_NOR;
>  }
>  
>  /* ------------------------------------------------------------------------- */
> @@ -597,7 +597,7 @@
>  
>  static float mg_mFractalOrfBmTex(Tex *tex, float *texvec, TexResult *texres)
>  {
> -	int rv=0;	/* return value, int:0, col:1, nor:2, everything:3 */
> +	int rv=TEX_INT;	/* return value, int:0, col:1, nor:2, everything:3 */
>  	float (*mgravefunc)(float, float, float, float, float, float, int);
>  
>  	if (tex->stype==TEX_MFRACTAL)
> @@ -616,7 +616,7 @@
>  		texres->nor[2] = tex->ns_outscale*mgravefunc(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->noisebasis);
>  		
>  		tex_normal_derivate(tex, texres);
> -		rv += 2;
> +		rv=TEX_NOR;
>  	}
>  
>  	BRICONT;
> @@ -627,7 +627,7 @@
>  
>  static float mg_ridgedOrHybridMFTex(Tex *tex, float *texvec, TexResult *texres)
>  {
> -	int rv=0;	/* return value, int:0, col:1, nor:2, everything:3 */
> +	int rv=TEX_INT;	/* return value, int:0, col:1, nor:2, everything:3 */
>  	float (*mgravefunc)(float, float, float, float, float, float, float, float, int);
>  
>  	if (tex->stype==TEX_RIDGEDMF)
> @@ -646,7 +646,7 @@
>  		texres->nor[2] = tex->ns_outscale*mgravefunc(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->mg_gain, tex->noisebasis);
>  		
>  		tex_normal_derivate(tex, texres);
> -		rv += 2;
> +		rv=TEX_NOR;
>  	}
>  
>  	BRICONT;
> @@ -658,7 +658,7 @@
>  
>  static float mg_HTerrainTex(Tex *tex, float *texvec, TexResult *texres)
>  {
> -	int rv=0;	/* return value, int:0, col:1, nor:2, everything:3 */
> +	int rv=TEX_INT;	/* return value, int:0, col:1, nor:2, everything:3 */
>  
>  	texres->tin = tex->ns_outscale*mg_HeteroTerrain(texvec[0], texvec[1], texvec[2], tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis);
>  
> @@ -671,7 +671,7 @@
>  		texres->nor[2] = tex->ns_outscale*mg_HeteroTerrain(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, tex->mg_lacunarity, tex->mg_octaves, tex->mg_offset, tex->noisebasis);
>  		
>  		tex_normal_derivate(tex, texres);
> -		rv += 2;
> +		rv=TEX_NOR;
>  	}
>  
>  	BRICONT;
> @@ -683,7 +683,7 @@
>  
>  static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres)
>  {
> -	int rv=0;	/* return value, int:0, col:1, nor:2, everything:3 */
> +	int rv=TEX_INT;	/* return value, int:0, col:1, nor:2, everything:3 */
>  
>  	texres->tin = mg_VLNoise(texvec[0], texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2);
>  
> @@ -696,7 +696,7 @@
>  		texres->nor[2] = mg_VLNoise(texvec[0], texvec[1], texvec[2] + offs, tex->dist_amount, tex->noisebasis, tex->noisebasis2);
>  
>  		tex_normal_derivate(tex, texres);
> -		rv += 2;
> +		rv=TEX_NOR;
>  	}
>  
>  	BRICONT;
> @@ -712,7 +712,7 @@
>  
>  static float voronoiTex(Tex *tex, float *texvec, TexResult *texres)
>  {
> -	int rv=0;	/* return value, int:0, col:1, nor:2, everything:3 */
> +	int rv=TEX_INT;	/* return value, int:0, col:1, nor:2, everything:3 */
>  	float da[4], pa[12];	/* distance and point coordinate arrays of 4 nearest neighbours */
>  	float aw1 = fabs(tex->vn_w1);
>  	float aw2 = fabs(tex->vn_w2);
> @@ -769,7 +769,7 @@
>  		texres->nor[2] = sc * fabs(tex->vn_w1*da[0] + tex->vn_w2*da[1] + tex->vn_w3*da[2] + tex->vn_w4*da[3]);
>  		
>  		tex_normal_derivate(tex, texres);
> -		rv += 2;
> +		rv=TEX_NOR;
>  	}
>  
>  	if (tex->vn_coltype) {
> @@ -805,7 +805,7 @@
>  	texres->tin= ((float)val)/div;;
>  
>  	BRICONT;
> -	return 0;
> +	return TEX_INT;
>  }
>  
>  /* ------------------------------------------------------------------------- */

> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers


-- 
mein at cs.umn.edu
http://www.cs.umn.edu/~mein


More information about the Bf-committers mailing list