Parcourir la source

show collision polygons that were loaded from pre-4.7 bam files

David Rose il y a 22 ans
Parent
commit
1c638ea9ba
2 fichiers modifiés avec 16 ajouts et 4 suppressions
  1. 14 4
      panda/src/collide/collisionSolid.cxx
  2. 2 0
      panda/src/collide/collisionSolid.h

+ 14 - 4
panda/src/collide/collisionSolid.cxx

@@ -277,11 +277,21 @@ write_datagram(BamWriter *, Datagram &me) {
 //               place
 ////////////////////////////////////////////////////////////////////
 void CollisionSolid::
-fillin(DatagramIterator &scan, BamReader*) {
-  _flags = scan.get_uint8();
-  if ((_flags & F_effective_normal) != 0) {
-    _effective_normal.read_datagram(scan);
+fillin(DatagramIterator &scan, BamReader *manager) {
+  if (manager->get_file_minor_ver() < 7) {
+    bool tangible = scan.get_bool();
+    if (!tangible) {
+      _flags &= ~F_tangible;
+    }
+  } else {
+    _flags = scan.get_uint8();
+    if ((_flags & F_effective_normal) != 0) {
+      _effective_normal.read_datagram(scan);
+    }
   }
+
+  // The viz is always stale after reading from a bam file.
+  _flags |= F_viz_geom_stale;
 }
 
 

+ 2 - 0
panda/src/collide/collisionSolid.h

@@ -103,6 +103,8 @@ protected:
 private:
   LVector3f _effective_normal;
 
+  // Be careful reordering these bits, since they are written to a bam
+  // file.
   enum Flags {
     F_tangible         = 0x01,
     F_effective_normal = 0x02,