소스 검색

*** empty log message ***

David Rose 25 년 전
부모
커밋
008b3197b8
4개의 변경된 파일77개의 추가작업 그리고 37개의 파일을 삭제
  1. 1 1
      panda/src/graph/Sources.pp
  2. 64 34
      panda/src/graph/wrt.I
  3. 10 0
      panda/src/graph/wrt.cxx
  4. 2 2
      panda/src/switchnode/LODNode.cxx

+ 1 - 1
panda/src/graph/Sources.pp

@@ -49,7 +49,7 @@
     pt_NamedNode.cxx pt_NamedNode.h pt_Node.N pt_Node.cxx pt_Node.h \
     setTransitionHelpers.I setTransitionHelpers.h \
     traverserVisitor.I traverserVisitor.h \
-    vector_PT_Node.cxx vector_PT_Node.h wrt.I wrt.h
+    vector_PT_Node.cxx vector_PT_Node.h wrt.I wrt.h wrt.cxx
 
   #define INSTALL_HEADERS \
     allAttributesWrapper.I allAttributesWrapper.h \

+ 64 - 34
panda/src/graph/wrt.I

@@ -3,6 +3,68 @@
 // 
 ////////////////////////////////////////////////////////////////////
 
+#ifndef NDEBUG
+////////////////////////////////////////////////////////////////////
+//     Function: describe_ambiguous_wrt
+//  Description: Writes an error message to wrt_cat describing an
+//               attempt to compute an ambiguous wrt() without
+//               specifying enough arcs to resolve the ambiguity.
+////////////////////////////////////////////////////////////////////
+template<class InputIterator>
+void
+describe_ambiguous_wrt(const Node *node,
+		       InputIterator arc_list_begin, 
+		       InputIterator arc_list_end,
+		       const UpRelationPointers &urp) {
+  if (wrt_cat.is_warning()) {
+    wrt_cat.warning()
+      << *node << " has " << urp.size() << " parents; wrt() ambiguous.\n"
+      << "  parents are: ";
+    UpRelationPointers::const_iterator urpi;
+    urpi = urp.begin();
+    wrt_cat.warning(false) << *(*urpi)->get_parent();
+    urpi++;
+    while (urpi != urp.end()) {  
+      wrt_cat.warning(false) << ", " << *(*urpi)->get_parent();
+      urpi++;
+    }
+    wrt_cat.warning(false) << "\n";
+    
+    // Show the chain of arcs specified.
+    if (arc_list_begin == arc_list_end) {
+      wrt_cat.warning(false)
+	<< "  no arcs specified.\n";
+    } else {
+      wrt_cat.warning(false)
+	<< "  arcs specified:\n";
+      InputIterator ri = arc_list_begin;
+      wrt_cat.warning(false)
+	<< "    " << *(*ri)->get_parent() << "/"
+	<< *(*ri)->get_child();
+      
+      InputIterator ri_last = ri;
+      ++ri;
+      while (ri != arc_list_end) {
+	if ((*ri)->get_parent() == (*ri_last)->get_child()) {
+	  wrt_cat.warning(false)
+	    << "/" << *(*ri)->get_child();
+	} else {
+	  wrt_cat.warning(false)
+	    << "\n    " << *(*ri)->get_parent() << "/"
+	    << *(*ri)->get_child();
+	}
+	++ri;
+      } 
+      wrt_cat.warning(false) << "\n";
+    }
+  }
+  if (ambiguous_wrt_abort) {
+    abort();
+  }
+}
+#endif
+
+
 ////////////////////////////////////////////////////////////////////
 //     Function: get_cached_net_transition
 //  Description: Returns the net transition from the root of the
@@ -212,23 +274,7 @@ get_cached_net_transition(const Node *node,
 #ifndef NDEBUG
       // No, it wasn't mentioned.  Issue a warning and use the first
       // one.
-      if (wrt_cat.is_warning()) {
-	wrt_cat.warning()
-	  << *node << " has " << urp.size() << " parents; wrt() ambiguous.\n"
-	  << "  parents are: ";
-	UpRelationPointers::const_iterator urpi;
-	urpi = urp.begin();
-	wrt_cat.warning(false) << *(*urpi)->get_parent();
-	urpi++;
-	while (urpi != urp.end()) {  
-	  wrt_cat.warning(false) << ", " << *(*urpi)->get_parent();
-	  urpi++;
-	}
-	wrt_cat.warning(false) << "\n";
-      }
-      if (ambiguous_wrt_abort) {
-	abort();
-      }
+      describe_ambiguous_wrt(node, arc_list_begin, arc_list_end, urp);
 #endif
       parent_arc = *(urp.begin());
     }
@@ -332,23 +378,7 @@ get_uncached_net_transition(const Node *node,
 #ifndef NDEBUG
       // No, it wasn't mentioned.  Issue a warning and use the first
       // one. 
-      if (wrt_cat.is_warning()) {
-	wrt_cat.warning()
-	  << *node << " has " << urp.size() << " parents; wrt() ambiguous.\n"
-	  << "  parents are:";
-	UpRelationPointers::const_iterator urpi;
-	urpi = urp.begin();
-	wrt_cat.warning(false) << *(*urpi)->get_parent();
-	urpi++;
-	while (urpi != urp.end()) {  
-	  wrt_cat.warning(false) << ", " << *(*urpi)->get_parent();
-	  urpi++;
-	}
-	wrt_cat.warning(false) << "\n";
-      }
-      if (ambiguous_wrt_abort) {
-	abort();
-      }
+      describe_ambiguous_wrt(node, arc_list_begin, arc_list_end, urp);
 #endif
       parent_arc = *(urp.begin());
     }

+ 10 - 0
panda/src/graph/wrt.cxx

@@ -0,0 +1,10 @@
+// Filename: wrt.cxx
+// Created by:  drose (16Apr01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "wrt.h"
+
+// There's no real need to have this file, but it's sometimes a little
+// cleaner to guarantee that every .h file gets scanned when this
+// directory is built.

+ 2 - 2
panda/src/switchnode/LODNode.cxx

@@ -81,8 +81,8 @@ sub_render(const AllAttributesWrapper &attrib, AllTransitionsWrapper &trans,
   LPoint3f LOD_pos;
 
   NodeTransitionWrapper ntw(TransformTransition::get_class_type());
-  wrt(this, camera, trav->begin(), trav->end(),
-      ntw, RenderRelation::get_class_type());
+  wrt(this, trav->begin(), trav->end(),
+      camera, ntw, RenderRelation::get_class_type());
   const TransformTransition *tt;
   if (get_transition_into(tt, ntw)) {
     LOD_pos = _lod._center * tt->get_matrix();