Преглед изворни кода

added set_color_scale to nodepathCollection

Asad M. Zaman пре 19 година
родитељ
комит
4d949e95a6

+ 26 - 1
panda/src/pgraph/nodePathCollection.cxx

@@ -441,7 +441,32 @@ set_color(float r, float g, float b, float a, int priority) {
 void NodePathCollection::
 set_color(const Colorf &color, int priority) {
   for (int i = 0; i < get_num_paths(); i++) {
-    get_path(i).node()->set_attrib(ColorAttrib::make_flat(color), priority);
+    get_path(i).set_color(color, priority);
+    //get_path(i).node()->set_attrib(ColorAttrib::make_flat(color), priority);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: NodePathCollection::set_color_scale
+//       Access: Published
+//  Description: Applies color scales to all NodePaths in the collection
+////////////////////////////////////////////////////////////////////
+void NodePathCollection::
+set_color_scale(float r, float g, float b, float a, int priority) {
+  for (int i = 0; i < get_num_paths(); i++) {
+    get_path(i).set_color_scale(Colorf(r, g, b, a), priority);
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: NodePathCollection::set_color_scale
+//       Access: Published
+//  Description: Applies color scales to all NodePaths in the collection
+////////////////////////////////////////////////////////////////////
+void NodePathCollection::
+set_color_scale(const Colorf &color, int priority) {
+  for (int i = 0; i < get_num_paths(); i++) {
+    get_path(i).set_color_scale(color, priority);
   }
 }
 

+ 4 - 0
panda/src/pgraph/nodePathCollection.h

@@ -72,6 +72,10 @@ PUBLISHED:
                  int priority = 0);
   void set_color(const Colorf &color, int priority = 0);
 
+  void set_color_scale(float r, float g, float b, float a = 1.0,
+                       int priority = 0);
+  void set_color_scale(const Colorf &color, int priority = 0);
+
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
 

+ 2 - 1
panda/src/pgraph/portalNode.cxx

@@ -286,7 +286,8 @@ cull_callback(CullTraverser *trav, CullTraverserData &data) {
 
       // Get the net trasform of the _cell_out as seen from the camera.
       CPT(TransformState) cell_transform = 
-        trav->get_camera_transform()->invert_compose(_cell_out.get_net_transform());
+        //        trav->get_camera_transform()->invert_compose(_cell_out.get_net_transform());
+        _cell_out.get_net_transform();
 
       CPT(TransformState) frustum_transform = 
         _cell_out.get_net_transform()->invert_compose(portal_viewer->_scene_setup->get_cull_center().get_net_transform());