Переглянути джерело

Add plane_x parameter and SSD_colorscale

rdb 16 роки тому
батько
коміт
76dba09efe
2 змінених файлів з 28 додано та 2 видалено
  1. 24 0
      panda/src/gobj/shader.cxx
  2. 4 2
      panda/src/gobj/shader.h

+ 24 - 0
panda/src/gobj/shader.cxx

@@ -339,6 +339,9 @@ cp_dependency(ShaderMatInput inp) {
   if (inp == SMO_attr_color) {
     dep |= SSD_color;
   }
+  if (inp == SMO_attr_colorscale) {
+    dep |= SSD_colorscale;
+  }
   if ((inp == SMO_model_to_view)||
       (inp == SMO_view_to_model)) {
     dep |= SSD_transform;
@@ -771,6 +774,27 @@ compile_parameter(const ShaderArgId  &arg_id,
     return true;
   }
   
+  if (pieces[0] == "plane") {
+    if ((!cp_errchk_parameter_words(p,2))||
+        (!cp_errchk_parameter_in(p)) ||
+        (!cp_errchk_parameter_uniform(p))||
+        (!cp_errchk_parameter_float(p,4,4))) {
+      return false;
+    }
+    ShaderMatSpec bind;
+    bind._id = arg_id;
+    bind._piece = SMP_row3;
+    bind._func = SMF_first;
+    bind._part[0] = SMO_plane_x;
+    bind._arg[0] = InternalName::make(pieces[1]);
+    bind._part[1] = SMO_identity;
+    bind._arg[1] = NULL;
+
+    cp_optimize_mat_spec(bind);
+    _mat_spec.push_back(bind);
+    return true;
+  }
+  
   // Keywords to access unusual parameters.
   
   if (pieces[0] == "sys") {

+ 4 - 2
panda/src/gobj/shader.h

@@ -78,6 +78,7 @@ public:
     SMO_plight_x,
     SMO_slight_x,
     SMO_satten_x,
+    SMO_plane_x,
     
     SMO_mat_constant_x,
     SMO_vec_constant_x,
@@ -150,8 +151,9 @@ public:
     SSD_general       =  1,
     SSD_transform     =  2,
     SSD_color         =  4,
-    SSD_material      =  8,
-    SSD_shaderinputs  = 16,
+    SSD_colorscale    =  8,
+    SSD_material      = 16,
+    SSD_shaderinputs  = 32,
   };
 
   enum ShaderBug {