Browse Source

Added tangent computation and removed dead vertices

Josh Yelon 17 years ago
parent
commit
b98db4a8d8

+ 8 - 1
pandatool/src/maxegg/maxToEggConverter.cxx

@@ -131,7 +131,12 @@ bool MaxToEggConverter::convert(MaxEggOptions *options) {
         
         reparent_decals(_egg_data);
     }
-    
+
+    if (all_ok) {
+        _egg_data->recompute_tangent_binormal_auto();
+        _egg_data->remove_unused_vertices(true);
+    }
+
     if (all_ok) {
         Filename fn = Filename::from_os_specific(_options->_file_name);
         return _egg_data->write_egg(fn);
@@ -869,6 +874,7 @@ get_panda_material(Mtl *mtl, MtlID matID) {
     pandaMat._any_diffuse = false;
     pandaMat._any_opacity = false;
     pandaMat._any_gloss = false;
+    pandaMat._any_normal = false;
 
     // If it's a multi-material, dig down.
         
@@ -1120,6 +1126,7 @@ void MaxToEggConverter::analyze_normal_maps(PandaMaterial &pandaMat, Texmap *mat
     if (mat == 0) return;
     
     if (mat->ClassID() == Class_ID(BMTEX_CLASS_ID, 0)) {
+        pandaMat._any_normal = true;
         BitmapTex *ntex = (BitmapTex *)mat;
 
         Filename fullpath, outpath;

+ 1 - 0
pandatool/src/maxegg/maxToEggConverter.h

@@ -52,6 +52,7 @@ class MaxToEggConverter {
         bool _any_diffuse;
         bool _any_opacity;
         bool _any_gloss;
+        bool _any_normal;
     };
     typedef std::map<Mtl*,PandaMaterial> MaterialMap;
     MaxEggOptions    *_options;