Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
9e1e9f09f6
3 changed files with 36 additions and 12 deletions
  1. 26 5
      panda/src/builder/mesherFanMaker.I
  2. 6 3
      panda/src/builder/mesherStrip.I
  3. 4 4
      panda/src/egg/eggTexture.h

+ 26 - 5
panda/src/builder/mesherFanMaker.I

@@ -59,7 +59,10 @@ template <class PrimType>
 MesherFanMaker<PrimType>::
 MesherFanMaker(const Vertex *vertex, Strip *tri, Mesher *mesher) {
   _vertex = vertex;
-  _edges.push_back(tri->find_opposite_edge(vertex));
+  const Edge *edge = tri->find_opposite_edge(vertex);
+  if (edge != (const Edge *)NULL) {
+    _edges.push_back(edge);
+  }
   _strips.push_back(tri);
   _planar = tri->_planar;
   _mesher = mesher;
@@ -73,19 +76,37 @@ join(MesherFanMaker &other) {
   nassertr(_mesher == other._mesher, false);
   nassertr(_bucket == other._bucket, false);
 
-  if (_edges.back()->_b == other._edges.front()->_a) {
+  nassertr(!_edges.empty() && !other._edges.empty(), false);
+
+  const Edge *my_back = _edges.back();
+  const Edge *other_front = other._edges.front();
+  nassertr(my_back != (Edge *)NULL && other_front != (Edge *)NULL, false);
+
+  const Vertex *my_back_b = my_back->_b;
+  const Vertex *other_front_a = other_front->_a;
+
+  if (my_back_b == other_front_a) {
     _planar = is_coplanar_with(other);
     _edges.splice(_edges.end(), other._edges);
     _strips.splice(_strips.end(), other._strips);
     return true;
-  } else if (_edges.front()->_a == other._edges.back()->_b) {
+  }
+
+  const Edge *my_front = _edges.front();
+  const Edge *other_back = other._edges.back();
+  nassertr(my_front != (Edge *)NULL && other_back != (Edge *)NULL, false);
+
+  const Vertex *my_front_a = my_front->_a;
+  const Vertex *other_back_b = other_back->_b;
+
+  if (my_front_a == other_back_b) {
     _planar = is_coplanar_with(other);
     _edges.splice(_edges.begin(), other._edges);
     _strips.splice(_strips.begin(), other._strips);
     return true;
-  } else {
-    return false;
   }
+
+  return false;
 }
 
 

+ 6 - 3
panda/src/builder/mesherStrip.I

@@ -251,7 +251,9 @@ make_prim(const BuilderBucket &bucket) {
     p.set_attrib(_prims.front());
     Verts::iterator vi;
     for (vi = _verts.begin(); vi != _verts.end(); ++vi) {
-      p.add_vertex(**vi);
+      const Vertex *v = *vi;
+      nassertr(v != (Vertex *)NULL, p);
+      p.add_vertex(*v);
     }
     p.set_type(dest_type);
 
@@ -271,7 +273,8 @@ make_prim(const BuilderBucket &bucket) {
     for (vi = _verts.begin();
 	 vi != _verts.end() && pi != _prims.end();
 	 ++vi) {
-      Vertex v = **vi;
+      const Vertex *v = *vi;
+      nassertr(v != (Vertex *)NULL, p);
       
       if (++count >= 3) {
 	// Beginning with the third vertex, we increment pi.  Thus, the
@@ -280,7 +283,7 @@ make_prim(const BuilderBucket &bucket) {
 	p.add_component(*pi);
 	++pi;
       }
-      p.add_vertex(v);
+      p.add_vertex(*v);
     }
     
     p.set_type(type);

+ 4 - 4
panda/src/egg/eggTexture.h

@@ -64,10 +64,10 @@ public:
     FT_linear,
  
     // Min Filter Only
-    FT_nearest_mipmap_nearest,
-    FT_linear_mipmap_nearest,
-    FT_nearest_mipmap_linear,
-    FT_linear_mipmap_linear,
+    FT_nearest_mipmap_nearest,   // "mipmap point"
+    FT_linear_mipmap_nearest,    // "mipmap linear"
+    FT_nearest_mipmap_linear,    // "mipmap bilinear"
+    FT_linear_mipmap_linear,     // "mipmap trilinear"
   };
   enum EnvType {
     ET_unspecified, ET_modulate, ET_decal