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.53 diff -u -b -B -u -r1.53 texture.c --- source/blender/render/intern/source/texture.c 21 Nov 2005 22:47:23 -0000 1.53 +++ source/blender/render/intern/source/texture.c 10 Dec 2005 01:26:40 -0000 @@ -363,6 +363,16 @@ return a; } +/* creates a rectified sine (cup) wave */ +static float tex_cup(float a) +{ + a = sin(a/2.0); + if (a < 0.0) a = -a; + a = 1.0 - a; + + return a; +} + /* creates a saw wave */ static float tex_saw(float a) { @@ -389,29 +399,54 @@ static float wood_int(Tex *tex, float x, float y, float z) { float wi=0; - short wf = tex->noisebasis2; /* wave form: TEX_SIN=0, TEX_SAW=1, TEX_TRI=2 */ - short wt = tex->stype; /* wood type: TEX_BAND=0, TEX_RING=1, TEX_BANDNOISE=2, TEX_RINGNOISE=3 */ + short wf = tex->noisebasis2; /* wave form: TEX_SIN=0, TEX_SAW=1, TEX_TRI=2, etc. */ + short wt = tex->stype; /* wood type: TEX_BAND=0, TEX_RING=1, TEX_BANDNOISE=2, etc. */ - float (*waveform[3])(float); /* create array of pointers to waveform functions */ - waveform[0] = tex_sin; /* assign address of tex_sin() function to pointer array */ - waveform[1] = tex_saw; - waveform[2] = tex_tri; - - if ((wf>TEX_TRI) || (wfturbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + float (*waveform[4])(float); /* create array of pointers to waveform functions */ + waveform[TEX_SIN] = tex_sin; /* assign address of tex_sin() function to pointer array */ + waveform[TEX_SAW] = tex_saw; + waveform[TEX_TRI] = tex_tri; + waveform[TEX_CUP] = tex_cup; + + /* check to be sure noisebasis2 is initialized ahead of time */ + if (wf < TEX_SIN || wf > TEX_CUP) + wf= TEX_SIN; + + /* review: disappointing that this is two enums per kind instead of + * using a noise flag and a simple kind; but for backwards compatibility + * we won't fix this right now + */ + + switch (wt) { + + case TEX_BANDNOISE: + wi= tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + /* and */ + case TEX_BAND: wi = waveform[wf]((x + y + z)*10.0 + wi); - } - else if (wt==TEX_RINGNOISE) { - wi = tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + break; + + case TEX_TUBENOISE: + wi= tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + /* and */ + case TEX_TUBE: + wi = waveform[wf](sqrt(x*x + z*z)*20.0 + wi); + break; + + case TEX_CONENOISE: + wi= tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + /* and */ + case TEX_CONE: + wi = waveform[wf]((sqrt(x*x + z*z) + y)*20.0 + wi); + break; + + case TEX_RINGNOISE: + wi= tex->turbul*BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis); + /* and */ + case TEX_RING: wi = waveform[wf](sqrt(x*x + y*y + z*z)*20.0 + wi); + break; + } return wi; Index: source/blender/makesdna/DNA_texture_types.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_texture_types.h,v retrieving revision 1.20 diff -u -b -B -u -r1.20 DNA_texture_types.h --- source/blender/makesdna/DNA_texture_types.h 19 Sep 2005 13:00:44 -0000 1.20 +++ source/blender/makesdna/DNA_texture_types.h 10 Dec 2005 01:26:40 -0000 @@ -247,12 +247,17 @@ #define TEX_SIN 0 #define TEX_SAW 1 #define TEX_TRI 2 +#define TEX_CUP 3 /* tex->stype in texture.c - wood types */ #define TEX_BAND 0 #define TEX_RING 1 #define TEX_BANDNOISE 2 #define TEX_RINGNOISE 3 +#define TEX_TUBE 4 +#define TEX_TUBENOISE 5 +#define TEX_CONE 6 +#define TEX_CONENOISE 7 /* tex->stype in texture.c - marble types */ #define TEX_SOFT 0 Index: source/blender/src/buttons_shading.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_shading.c,v retrieving revision 1.158 diff -u -b -B -u -r1.158 buttons_shading.c --- source/blender/src/buttons_shading.c 27 Nov 2005 12:19:12 -0000 1.158 +++ source/blender/src/buttons_shading.c 10 Dec 2005 01:26:41 -0000 @@ -910,20 +910,28 @@ uiSetButLock(tex->id.lib!=0, "Can't edit library data"); uiBlockBeginAlign(block); - uiDefButS(block, ROW, B_TEXPRV, "Bands", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses standard wood texture in bands"); - uiDefButS(block, ROW, B_TEXPRV, "Rings", 85, 180, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Uses wood texture in rings"); - uiDefButS(block, ROW, B_TEXPRV, "BandNoise", 160, 180, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Adds noise to standard wood"); - uiDefButS(block, ROW, B_TEXPRV, "RingNoise", 235, 180, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Adds noise to rings"); - - uiDefButS(block, ROW, B_TEXPRV, "Sin", 10, 160, 50, 19, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce bands"); - uiDefButS(block, ROW, B_TEXPRV, "Saw", 60, 160, 50, 19, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce bands"); - uiDefButS(block, ROW, B_TEXPRV, "Tri", 110, 160, 50, 19, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce bands"); - uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 160, 160, 75, 19, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise"); - uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 235, 160, 75, 19, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise"); + uiDefButS(block, ROW, B_TEXPRV, "Bands", 10, 180, 75, 18, &tex->stype, 2.0, 0.0, 0, 0, "Uses wood texture in planar bands"); + uiDefButS(block, ROW, B_TEXPRV, "Rings", 85, 180, 75, 18, &tex->stype, 2.0, 1.0, 0, 0, "Uses wood texture in spherical rings"); + uiDefButS(block, ROW, B_TEXPRV, "Tubes", 160, 180, 75, 18, &tex->stype, 2.0, 4.0, 0, 0, "Uses wood texture in concentric cylinders"); + uiDefButS(block, ROW, B_TEXPRV, "Cones", 235, 180, 75, 18, &tex->stype, 2.0, 6.0, 0, 0, "Uses wood texture in concentric cones"); + uiDefButS(block, ROW, B_TEXPRV, "BandNoise", 10, 160, 75, 18, &tex->stype, 2.0, 2.0, 0, 0, "Adds noise to wood texture in planar bands"); + uiDefButS(block, ROW, B_TEXPRV, "RingNoise", 85, 160, 75, 18, &tex->stype, 2.0, 3.0, 0, 0, "Adds noise to wood texture in spherical rings"); + uiDefButS(block, ROW, B_TEXPRV, "TubeNoise", 160, 160, 75, 18, &tex->stype, 2.0, 5.0, 0, 0, "Adds noise to wood texture in concentric cylinders"); + uiDefButS(block, ROW, B_TEXPRV, "ConeNoise", 235, 160, 75, 18, &tex->stype, 2.0, 7.0, 0, 0, "Adds noise to wood texture in concentric cones"); uiBlockBeginAlign(block); - uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 130, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input"); - uiDefButF(block, NUM, B_TEXPRV, "Turbulence:", 160, 130, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Sets the turbulence of the bandnoise and ringnoise types"); + uiDefButS(block, ROW, B_TEXPRV, "Sin", 10, 135, 37, 18, &tex->noisebasis2, 8.0, 0.0, 0, 0, "Uses a sine wave to produce smooth bands"); + uiDefButS(block, ROW, B_TEXPRV, "Saw", 48, 135, 37, 18, &tex->noisebasis2, 8.0, 1.0, 0, 0, "Uses a saw wave to produce ramped bands"); + uiDefButS(block, ROW, B_TEXPRV, "Tri", 85, 135, 37, 18, &tex->noisebasis2, 8.0, 2.0, 0, 0, "Uses a triangle wave to produce sharpened bands"); + uiDefButS(block, ROW, B_TEXPRV, "Cup", 122, 135, 37, 18, &tex->noisebasis2, 8.0, 3.0, 0, 0, "Uses a rectified sine wave to produce peaked bands"); + + uiBlockBeginAlign(block); + uiDefButS(block, ROW, B_TEXPRV, "Soft noise", 162, 135, 74, 18, &tex->noisetype, 12.0, 0.0, 0, 0, "Generates soft noise"); + uiDefButS(block, ROW, B_TEXPRV, "Hard noise", 236, 135, 74, 18, &tex->noisetype, 12.0, 1.0, 0, 0, "Generates hard noise"); + + uiBlockBeginAlign(block); + uiDefButF(block, NUM, B_TEXPRV, "NoiseSize :", 10, 105, 150, 19, &tex->noisesize, 0.0001, 2.0, 10, 0, "Sets scaling for noise input"); + uiDefButF(block, NUM, B_TEXPRV, "Turbulence:", 160, 105, 150, 19, &tex->turbul, 0.0, 200.0, 10, 0, "Sets the turbulence of the bandnoise and ringnoise types"); uiBlockEndAlign(block); /* newnoise: noisebasis menu */ Index: source/blender/python/api2_2x/Texture.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Texture.c,v retrieving revision 1.19 diff -u -b -B -u -r1.19 Texture.c --- source/blender/python/api2_2x/Texture.c 26 Nov 2005 02:10:42 -0000 1.19 +++ source/blender/python/api2_2x/Texture.c 10 Dec 2005 01:26:41 -0000 @@ -120,6 +120,10 @@ #define EXPP_TEX_STYPE_WOD_RINGS 1 #define EXPP_TEX_STYPE_WOD_BANDNOISE 2 #define EXPP_TEX_STYPE_WOD_RINGNOISE 3 +#define EXPP_TEX_STYPE_WOD_TUBES 4 +#define EXPP_TEX_STYPE_WOD_TUBENOISE 5 +#define EXPP_TEX_STYPE_WOD_CONES 6 +#define EXPP_TEX_STYPE_WOD_CONENOISE 7 /* magic stype */ #define EXPP_TEX_STYPE_MAG_DEFAULT 0 /* marble stype */ @@ -165,6 +169,7 @@ #define EXPP_TEX_NOISE_SINE 0 #define EXPP_TEX_NOISE_SAW 1 #define EXPP_TEX_NOISE_TRI 2 +#define EXPP_TEX_NOISE_CUP 3 #define EXPP_TEX_NOISEBASIS2 0xffff /****************************************************************************/