Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Hamalainen <blender@miikah.org>2011-11-09 19:46:53 +0400
committerMiika Hamalainen <blender@miikah.org>2011-11-09 19:46:53 +0400
commit1b4a54ad73c058baa59ffdc9e5f18b0b79030fb0 (patch)
treea5b84d392ea14b0d760a5e24f7a8e51f203d558c /source/blender/nodes/shader/node_shader_util.c
parentedec46b0a6aac18f406991b9e16228d4bd848c61 (diff)
parentbc5ec4e69cf3308c2563239c0e8372b853800a78 (diff)
Merge with trunk r41701soc-2011-carrot
Diffstat (limited to 'source/blender/nodes/shader/node_shader_util.c')
-rw-r--r--source/blender/nodes/shader/node_shader_util.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index dd72f7662d0..d601c205682 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -244,6 +244,29 @@ static void data_from_gpu_stack_list(ListBase *sockets, bNodeStack **ns, GPUNode
node_data_from_gpu_stack(ns[i], &gs[i]);
}
+bNode *nodeGetActiveTexture(bNodeTree *ntree)
+{
+ /* this is the node we texture paint and draw in textured draw */
+ bNode *node;
+
+ if(!ntree)
+ return NULL;
+
+ /* check for group edit */
+ for(node= ntree->nodes.first; node; node= node->next)
+ if(node->flag & NODE_GROUP_EDIT)
+ break;
+
+ if(node)
+ ntree= (bNodeTree*)node->id;
+
+ for(node= ntree->nodes.first; node; node= node->next)
+ if(node->flag & NODE_ACTIVE_TEXTURE)
+ return node;
+
+ return NULL;
+}
+
void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
{
bNodeExec *nodeexec;
@@ -287,3 +310,22 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
}
}
}
+
+void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *UNUSED(out))
+{
+ NodeTexBase *base= node->storage;
+ TexMapping *texmap= &base->tex_mapping;
+ float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0;
+ float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0;
+
+ if(domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
+ GPUNodeLink *tmat = GPU_uniform((float*)texmap->mat);
+ GPUNodeLink *tmin = GPU_uniform(texmap->min);
+ GPUNodeLink *tmax = GPU_uniform(texmap->max);
+ GPUNodeLink *tdomin = GPU_uniform(&domin);
+ GPUNodeLink *tdomax = GPU_uniform(&domax);
+
+ GPU_link(mat, "mapping", in[0].link, tmat, tmin, tmax, tdomin, tdomax, &in[0].link);
+ }
+}
+