[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49589] branches/ge_harmony: Exposing the input and output modes for custom geometry shaders.

Daniel Stokes kupomail at gmail.com
Mon Aug 6 00:26:59 CEST 2012


Revision: 49589
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49589
Author:   kupoman
Date:     2012-08-05 22:26:57 +0000 (Sun, 05 Aug 2012)
Log Message:
-----------
Exposing the input and output modes for custom geometry shaders.

Modified Paths:
--------------
    branches/ge_harmony/release/scripts/startup/bl_ui/properties_material.py
    branches/ge_harmony/source/blender/makesdna/DNA_shader_types.h
    branches/ge_harmony/source/blender/makesrna/intern/rna_shader.c

Modified: branches/ge_harmony/release/scripts/startup/bl_ui/properties_material.py
===================================================================
--- branches/ge_harmony/release/scripts/startup/bl_ui/properties_material.py	2012-08-05 21:35:09 UTC (rev 49588)
+++ branches/ge_harmony/release/scripts/startup/bl_ui/properties_material.py	2012-08-05 22:26:57 UTC (rev 49589)
@@ -648,6 +648,10 @@
                 col.prop(shader, "source_text", text="")
             elif shader.shader_location == "EXTERNAL":
                 col.prop(shader, "source_path", text="")
+                
+            if shader.type == "GEOMETRY":
+                col.prop(shader, "geometry_input")
+                col.prop(shader, "geometry_output")
 
             if shader.uniforms:
                 col.label("Uniforms:")

Modified: branches/ge_harmony/source/blender/makesdna/DNA_shader_types.h
===================================================================
--- branches/ge_harmony/source/blender/makesdna/DNA_shader_types.h	2012-08-05 21:35:09 UTC (rev 49588)
+++ branches/ge_harmony/source/blender/makesdna/DNA_shader_types.h	2012-08-05 22:26:57 UTC (rev 49589)
@@ -81,16 +81,16 @@
 
 
 /* geom_in */
-#define SHADER_GEOM_IN_POINTS	1
-#define SHADER_GEOM_IN_LINES		2
-#define SHADER_GEOM_IN_LINES_ADJ	4
-#define SHADER_GEOM_IN_TRIS		32
-#define SHADER_GEOM_IN_TRIS_ADJ	64
+#define SHADER_GEOM_IN_TRIS			0
+#define SHADER_GEOM_IN_LINES		1
+#define SHADER_GEOM_IN_LINES_ADJ	2
+#define SHADER_GEOM_IN_POINTS		3
+#define SHADER_GEOM_IN_TRIS_ADJ		4
 
 /* geom_out */
-#define SHADER_GEOM_OUT_POINTS	1
-#define SHADER_GEOM_OUT_LINE_STRIP 2
-#define SHADER_GEOM_OUT_TRIANGLE_STRIP 4
+#define SHADER_GEOM_OUT_TRIANGLE_STRIP	0
+#define SHADER_GEOM_OUT_LINE_STRIP		1
+#define SHADER_GEOM_OUT_POINTS			2
 
 /* uniform types */
 #define SHADER_UNF_FLOAT	1

Modified: branches/ge_harmony/source/blender/makesrna/intern/rna_shader.c
===================================================================
--- branches/ge_harmony/source/blender/makesrna/intern/rna_shader.c	2012-08-05 21:35:09 UTC (rev 49588)
+++ branches/ge_harmony/source/blender/makesrna/intern/rna_shader.c	2012-08-05 22:26:57 UTC (rev 49589)
@@ -312,6 +312,20 @@
 		{0, NULL, 0, NULL, NULL}
 	};
 
+	static EnumPropertyItem prop_geomin_items[] = {
+		{SHADER_GEOM_IN_POINTS, "POINTS", 0, "Points", "Use points as input"},
+		{SHADER_GEOM_IN_LINES, "LINES", 0, "Lines", "Use lines as input"},
+		{SHADER_GEOM_IN_LINES_ADJ, "LINES_ADJ", 0, "Lines Adjacency", "Use adjacent lines as input"},
+		{SHADER_GEOM_IN_TRIS, "TRIS", 0, "Triangles", "Use triangles as input"},
+		{SHADER_GEOM_IN_TRIS_ADJ, "TRIS_ADJ", 0, "Triangles Adjacency", "Use adjacent triangles as input"},
+		{0, NULL, 0, NULL, NULL}};
+
+	static EnumPropertyItem prop_geomout_items[] = {
+		{SHADER_GEOM_OUT_POINTS, "POINTS", 0, "Points", "Output points"},
+		{SHADER_GEOM_OUT_LINE_STRIP, "LINE_STRIP", 0, "Line Strip", "Output line strips"},
+		{SHADER_GEOM_OUT_TRIANGLE_STRIP, "TRIANGLE_STRIP", 0, "Triangle Strip", "Output triangle strips"},
+		{0, NULL, 0, NULL, NULL}};
+
 	srna = RNA_def_struct(brna, "Shader", "ID");
 	RNA_def_struct_ui_text(srna, "Shader", "Shader datablock to define custom shading for a material");
 	RNA_def_struct_ui_icon(srna, ICON_TEXT);
@@ -346,6 +360,18 @@
 	RNA_def_property_ui_text(prop, "Source", "The path to the shader to use");
 	RNA_def_property_update(prop, 0, "rna_Shader_source_update");
 
+	prop= RNA_def_property(srna, "geometry_input", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "geom_in");
+	RNA_def_property_enum_items(prop, prop_geomin_items);
+	RNA_def_property_ui_text(prop, "Input", "The input type for the geometry shader");
+	RNA_def_property_update(prop, 0, "rna_Shader_update");
+
+	prop= RNA_def_property(srna, "geometry_output", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "geom_out");
+	RNA_def_property_enum_items(prop, prop_geomout_items);
+	RNA_def_property_ui_text(prop, "Output", "The output type for the geometry shader");
+	RNA_def_property_update(prop, 0, "rna_Shader_update");
+
 	prop= RNA_def_property(srna, "uniforms", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "uniforms", NULL);
 	RNA_def_property_struct_type(prop, "Uniform");




More information about the Bf-blender-cvs mailing list