Revision: 42675
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42675
Author:   campbellbarton
Date:     2011-12-16 23:26:29 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
svn merge ^/trunk/blender -r42660:42669

Revision Links:
--------------
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42660

Modified Paths:
--------------
    branches/bmesh/blender/intern/cycles/app/cycles_xml.cpp
    branches/bmesh/blender/intern/cycles/blender/blender_shader.cpp
    branches/bmesh/blender/intern/cycles/kernel/CMakeLists.txt
    branches/bmesh/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt
    branches/bmesh/blender/intern/cycles/kernel/svm/svm.h
    branches/bmesh/blender/intern/cycles/kernel/svm/svm_types.h
    branches/bmesh/blender/intern/cycles/render/nodes.cpp
    branches/bmesh/blender/intern/cycles/render/nodes.h
    branches/bmesh/blender/source/blender/blenkernel/BKE_object.h
    branches/bmesh/blender/source/blender/blenkernel/intern/image_gen.c
    branches/bmesh/blender/source/blender/blenkernel/intern/object.c
    branches/bmesh/blender/source/blender/blenkernel/intern/pointcache.c
    branches/bmesh/blender/source/blender/blenlib/BLI_math_base.h
    branches/bmesh/blender/source/blender/blenlib/intern/math_base_inline.c
    branches/bmesh/blender/source/blender/editors/animation/keyingsets.c
    branches/bmesh/blender/source/blender/editors/include/ED_mesh.h
    branches/bmesh/blender/source/blender/editors/interface/interface.c
    branches/bmesh/blender/source/blender/editors/mesh/meshtools.c
    branches/bmesh/blender/source/blender/editors/object/object_relations.c
    branches/bmesh/blender/source/blender/editors/space_action/action_select.c
    branches/bmesh/blender/source/blender/editors/space_graph/graph_select.c
    branches/bmesh/blender/source/blender/editors/space_view3d/drawanimviz.c
    branches/bmesh/blender/source/blender/editors/space_view3d/drawvolume.c
    branches/bmesh/blender/source/blender/editors/space_view3d/view3d_buttons.c
    branches/bmesh/blender/source/blender/gpu/intern/gpu_draw.c
    branches/bmesh/blender/source/blender/gpu/intern/gpu_extensions.c
    
branches/bmesh/blender/source/blender/nodes/shader/nodes/node_shader_normal.c
    branches/bmesh/blender/source/blender/windowmanager/intern/wm_draw.c
    branches/bmesh/blender/source/gameengine/Ketsji/BL_Texture.cpp

Added Paths:
-----------
    branches/bmesh/blender/intern/cycles/kernel/osl/nodes/node_normal.osl
    branches/bmesh/blender/intern/cycles/kernel/svm/svm_normal.h

Property Changed:
----------------
    branches/bmesh/blender/


Property changes on: branches/bmesh/blender
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/soc-2011-cucumber:37517
/branches/soc-2011-tomato:42376,42378-42379,42397,42400
/trunk/blender:39992-42660
   + /branches/soc-2011-cucumber:37517
/branches/soc-2011-tomato:42376,42378-42379,42397,42400
/trunk/blender:39992-42669

Modified: branches/bmesh/blender/intern/cycles/app/cycles_xml.cpp
===================================================================
--- branches/bmesh/blender/intern/cycles/app/cycles_xml.cpp     2011-12-16 
22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/app/cycles_xml.cpp     2011-12-16 
23:26:29 UTC (rev 42675)
@@ -368,6 +368,9 @@
                        xml_read_enum(&wood->type, WaveTextureNode::type_enum, 
node, "type");
                        snode = wood;
                }
+               else if(string_iequals(node.name(), "normal")) {
+                       snode = new NormalNode();
+               }
                else if(string_iequals(node.name(), "mapping")) {
                        snode = new MappingNode();
                }

Modified: branches/bmesh/blender/intern/cycles/blender/blender_shader.cpp
===================================================================
--- branches/bmesh/blender/intern/cycles/blender/blender_shader.cpp     
2011-12-16 22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/blender/blender_shader.cpp     
2011-12-16 23:26:29 UTC (rev 42675)
@@ -132,7 +132,6 @@
                case BL::ShaderNode::type_GEOMETRY: break;
                case BL::ShaderNode::type_MATERIAL: break;
                case BL::ShaderNode::type_MATERIAL_EXT: break;
-               case BL::ShaderNode::type_NORMAL: break;
                case BL::ShaderNode::type_OUTPUT: break;
                case BL::ShaderNode::type_SCRIPT: break;
                case BL::ShaderNode::type_SQUEEZE: break;
@@ -198,6 +197,17 @@
                        node = vmath;
                        break;
                }
+               case BL::ShaderNode::type_NORMAL: {
+                       BL::Node::outputs_iterator out_it;
+                       b_node.outputs.begin(out_it);
+                       BL::NodeSocketVectorNone vec_sock(*out_it);
+
+                       NormalNode *norm = new NormalNode();
+                       norm->direction = get_float3(vec_sock.default_value());
+
+                       node = norm;
+                       break;
+               }
                case BL::ShaderNode::type_MAPPING: {
                        BL::ShaderNodeMapping b_mapping_node(b_node);
                        MappingNode *mapping = new MappingNode();

Modified: branches/bmesh/blender/intern/cycles/kernel/CMakeLists.txt
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/CMakeLists.txt  2011-12-16 
22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/kernel/CMakeLists.txt  2011-12-16 
23:26:29 UTC (rev 42675)
@@ -72,6 +72,7 @@
        svm/svm_musgrave.h
        svm/svm_noise.h
        svm/svm_noisetex.h
+       svm/svm_normal.h
        svm/svm_sepcomb_rgb.h
        svm/svm_sky.h
        svm/svm_tex_coord.h

Modified: branches/bmesh/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt        
2011-12-16 22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/kernel/osl/nodes/CMakeLists.txt        
2011-12-16 23:26:29 UTC (rev 42675)
@@ -33,6 +33,7 @@
        node_mix.osl
        node_mix_closure.osl
        node_musgrave_texture.osl
+       node_normal.osl
        node_blend_weight_texture.osl
        node_noise_texture.osl
        node_output_displacement.osl

Copied: branches/bmesh/blender/intern/cycles/kernel/osl/nodes/node_normal.osl 
(from rev 42669, trunk/blender/intern/cycles/kernel/osl/nodes/node_normal.osl)
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/osl/nodes/node_normal.osl       
                        (rev 0)
+++ branches/bmesh/blender/intern/cycles/kernel/osl/nodes/node_normal.osl       
2011-12-16 23:26:29 UTC (rev 42675)
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "stdosl.h"
+
+shader node_normal(
+       normal Direction = normal(0.0, 0.0, 0.0),
+       normal NormalIn = normal(0.0, 0.0, 0.0),
+       output normal NormalOut = normal(0.0, 0.0, 0.0),
+       output float Dot = 1.0
+{
+       Direction = normalize(Direction);
+       NormalOut = Direction;
+       Dot = dot(Direction, NormalIn);
+}
+

Modified: branches/bmesh/blender/intern/cycles/kernel/svm/svm.h
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/svm/svm.h       2011-12-16 
22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/kernel/svm/svm.h       2011-12-16 
23:26:29 UTC (rev 42675)
@@ -134,6 +134,7 @@
 #include "svm_light_path.h"
 #include "svm_magic.h"
 #include "svm_mapping.h"
+#include "svm_normal.h"
 #include "svm_wave.h"
 #include "svm_math.h"
 #include "svm_mix.h"
@@ -300,6 +301,9 @@
                        case NODE_VECTOR_MATH:
                                svm_node_vector_math(kg, sd, stack, node.y, 
node.z, node.w, &offset);
                                break;
+                       case NODE_NORMAL:
+                               svm_node_normal(kg, sd, stack, node.y, node.z, 
node.w, &offset);
+                               break;
                        case NODE_MAPPING:
                                svm_node_mapping(kg, sd, stack, node.y, node.z, 
&offset);
                                break;

Copied: branches/bmesh/blender/intern/cycles/kernel/svm/svm_normal.h (from rev 
42669, trunk/blender/intern/cycles/kernel/svm/svm_normal.h)
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/svm/svm_normal.h                
                (rev 0)
+++ branches/bmesh/blender/intern/cycles/kernel/svm/svm_normal.h        
2011-12-16 23:26:29 UTC (rev 42675)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2011, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+CCL_NAMESPACE_BEGIN
+
+__device void svm_node_normal(KernelGlobals *kg, ShaderData *sd, float *stack, 
uint in_normal_offset, uint out_normal_offset, uint out_dot_offset, int *offset)
+{
+       /* read extra data */
+       uint4 node1 = read_node(kg, offset);
+       float3 normal = stack_load_float3(stack, in_normal_offset);
+
+       float3 direction;
+       direction.x = node1.x;
+       direction.y = node1.y;
+       direction.z = node1.z;
+       direction = normalize(direction);
+
+       if (stack_valid(out_normal_offset))
+               stack_store_float3(stack, out_normal_offset, direction);
+
+       if (stack_valid(out_dot_offset))
+               stack_store_float(stack, out_dot_offset, dot(direction, 
normalize(normal)));
+}
+
+CCL_NAMESPACE_END
+

Modified: branches/bmesh/blender/intern/cycles/kernel/svm/svm_types.h
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/svm/svm_types.h 2011-12-16 
22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/kernel/svm/svm_types.h 2011-12-16 
23:26:29 UTC (rev 42675)
@@ -84,7 +84,8 @@
        NODE_COMBINE_RGB = 5100,
        NODE_HSV = 5200,
        NODE_CAMERA = 5300,
-       NODE_INVERT = 5400
+       NODE_INVERT = 5400,
+       NODE_NORMAL = 5500
 } NodeType;
 
 typedef enum NodeAttributeType {

Modified: branches/bmesh/blender/intern/cycles/render/nodes.cpp
===================================================================
--- branches/bmesh/blender/intern/cycles/render/nodes.cpp       2011-12-16 
22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/intern/cycles/render/nodes.cpp       2011-12-16 
23:26:29 UTC (rev 42675)
@@ -713,6 +713,41 @@
        compiler.add(this, "node_magic_texture");
 }
 
+/* Normal */
+
+NormalNode::NormalNode()
+: ShaderNode("normal")
+{
+       direction = make_float3(0.0f, 0.0f, 1.0f);
+
+       add_input("Normal", SHADER_SOCKET_NORMAL);
+       add_output("Normal", SHADER_SOCKET_NORMAL);
+       add_output("Dot",  SHADER_SOCKET_FLOAT);
+}
+
+void NormalNode::compile(SVMCompiler& compiler)
+{
+       ShaderInput *normal_in = input("Normal");
+       ShaderOutput *normal_out = output("Normal");
+       ShaderOutput *dot_out = output("Dot");
+
+       compiler.stack_assign(normal_in);
+       compiler.stack_assign(normal_out);
+       compiler.stack_assign(dot_out);
+
+       compiler.add_node(NODE_NORMAL, normal_in->stack_offset, 
normal_out->stack_offset, dot_out->stack_offset);
+       compiler.add_node(
+               __float_as_int(direction.x),
+               __float_as_int(direction.y),
+               __float_as_int(direction.z));
+}
+
+void NormalNode::compile(OSLCompiler& compiler)
+{
+       compiler.parameter_vector("Direction", direction);
+       compiler.add(this, "node_normal");
+}
+
 /* Mapping */
 
 MappingNode::MappingNode()

Modified: branches/bmesh/blender/intern/cycles/render/nodes.h
===================================================================
--- branches/bmesh/blender/intern/cycles/render/nodes.h 2011-12-16 22:45:29 UTC 
(rev 42674)
+++ branches/bmesh/blender/intern/cycles/render/nodes.h 2011-12-16 23:26:29 UTC 
(rev 42675)
@@ -343,6 +343,13 @@
        static ShaderEnum type_enum;
 };
 
+class NormalNode : public ShaderNode {
+public:
+       SHADER_NODE_CLASS(NormalNode)
+
+       float3 direction;
+};
+
 class VectorMathNode : public ShaderNode {
 public:
        SHADER_NODE_CLASS(VectorMathNode)

Modified: branches/bmesh/blender/source/blender/blenkernel/BKE_object.h
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/BKE_object.h       
2011-12-16 22:45:29 UTC (rev 42674)
+++ branches/bmesh/blender/source/blender/blenkernel/BKE_object.h       
2011-12-16 23:26:29 UTC (rev 42675)
@@ -120,6 +120,8 @@
         const short flag,
         void (*func_cb)(const float[3], void *), void *user_data);
 

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to