diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-06-09 00:08:19 +0400 |
commit | c8b4cf92067ffeb625aa39003baf5d8f7c3f0025 (patch) | |
tree | c6c50dbc3d90a65fca6c1ca56a93e4a57cf7e154 /source/blender/nodes/intern/TEX_nodes | |
parent | e93db433a086a3e739c0f4026cd500f0b595b0f1 (diff) | |
parent | d76a6f5231c015c35123d22e1f5c3ffcdfbf9bbd (diff) |
2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD
Notes:
* Game and sequencer RNA, and sequencer header are now out of date
a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
not needed anymore.
* Fix "duplicate strip" always increase the user count for ipo.
* IPO pinning on sequencer strips was lost during Undo.
Diffstat (limited to 'source/blender/nodes/intern/TEX_nodes')
-rw-r--r-- | source/blender/nodes/intern/TEX_nodes/TEX_bricks.c | 18 | ||||
-rw-r--r-- | source/blender/nodes/intern/TEX_nodes/TEX_translate.c | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c index c9fa3528b02..80cbd6188ee 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_bricks.c @@ -49,12 +49,21 @@ static void init(bNode *node) { node->custom4 = 1.0; /* squash */ } +static float noise(int n) /* fast integer noise */ +{ + int nn; + n = (n >> 13) ^ n; + nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff; + return 0.5f * ((float)nn / 1073741824.0f); +} + static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread) { float x = coord[0]; float y = coord[1]; - float bricknum, rownum, offset = 0; + int bricknum, rownum; + float offset = 0; float ins_x, ins_y; float tint; @@ -71,20 +80,19 @@ static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, shor tex_input_rgba(bricks2, in[1], coord, thread); tex_input_rgba(mortar, in[2], coord, thread); - rownum = floor(y / row_height); + rownum = (int)floor(y / row_height); if( node->custom1 && node->custom2 ) { brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4; /* squash */ offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */ } - bricknum = floor((x+offset) / brick_width); + bricknum = (int)floor((x+offset) / brick_width); ins_x = (x+offset) - brick_width*bricknum; ins_y = y - row_height*rownum; - srand( (123456*rownum) + bricknum ); - tint = rand() / (float)RAND_MAX + bias; + tint = noise((rownum << 16) + (bricknum & 0xFFFF)) + bias; CLAMP(tint,0.0f,1.0f); if( ins_x < mortar_thickness || ins_y < mortar_thickness || diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c index 0e903301789..cadd27612f4 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_translate.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_translate.c @@ -31,7 +31,7 @@ static bNodeSocketType inputs[]= { { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - { SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f }, + { SOCK_VECTOR, 1, "Offset", 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f }, { -1, 0, "" } }; |