瀏覽代碼

speedtree refinements

David Rose 15 年之前
父節點
當前提交
48c6a8756a

+ 6 - 0
panda/src/configfiles/panda.prc.pp

@@ -132,4 +132,10 @@ egg-object-type-glow            <Scalar> blend { add }
 # maya2egg itself.  So if it appears in an egg file, it means nothing.
 egg-object-type-keep-all-uvsets
 
+#if $[HAVE_SPEEDTREE]
+# If we have the SpeedTree library available, we'll want to use it
+# for loading compiled SpeedTree tree objects.
+load-file-type srt pandaspeedtree
+#endif
+
 #end 20_panda.prc

+ 5 - 5
panda/src/pandabase/pandasymbols.h

@@ -192,12 +192,12 @@
   #define EXPTP_PANDAPHYSX extern
 #endif
 
-#ifdef BUILDING_PANDARIB
-  #define EXPCL_PANDARIB __declspec(dllexport)
-  #define EXPTP_PANDARIB
+#ifdef BUILDING_PANDASPEEDTREE
+  #define EXPCL_PANDASPEEDTREE __declspec(dllexport)
+  #define EXPTP_PANDASPEEDTREE
 #else
-  #define EXPCL_PANDARIB __declspec(dllimport)
-  #define EXPTP_PANDARIB extern
+  #define EXPCL_PANDASPEEDTREE __declspec(dllimport)
+  #define EXPTP_PANDASPEEDTREE extern
 #endif
 
 #ifdef BUILDING_PANDASKEL

+ 2 - 2
panda/src/speedtree/Sources.pp

@@ -3,8 +3,8 @@
 #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                    dtoolutil:c dtoolbase:c dtool:m prc:c
 
-#define USE_PACKAGES speedtree $[if $[eq $[SPEEDTREE_API],opengl],gl cg cggl] $[if $[eq $[SPEEDTREE_API],directx9],dx9 cg cgdx9]
-#define BUILDING_DLL BUILDING_PANDASKEL
+#define USE_PACKAGES speedtree $[if $[eq $[SPEEDTREE_API],OpenGL],gl cg cggl] $[if $[eq $[SPEEDTREE_API],DirectX9],dx9 cg cgdx9]
+#define BUILDING_DLL BUILDING_PANDASPEEDTREE
 
 #begin lib_target
   #define TARGET pandaspeedtree

+ 2 - 2
panda/src/speedtree/config_speedtree.h

@@ -23,7 +23,7 @@
 #include "configVariableInt.h"
 #include "configVariableFilename.h"
 
-NotifyCategoryDecl(speedtree, EXPCL_PANDASKEL, EXPTP_PANDASKEL);
+NotifyCategoryDecl(speedtree, EXPCL_PANDASPEEDTREE, EXPTP_PANDASPEEDTREE);
 
 extern ConfigVariableString speedtree_license;
 extern ConfigVariableFilename speedtree_shaders_dir;
@@ -32,7 +32,7 @@ extern ConfigVariableInt speedtree_max_num_visible_cells;
 extern ConfigVariableInt speedtree_max_billboard_images_by_base;
 extern ConfigVariableDouble speedtree_cull_cell_size;
 
-extern EXPCL_PANDASKEL void init_libspeedtree();
+extern EXPCL_PANDASPEEDTREE void init_libspeedtree();
 
 #endif
 

+ 1 - 1
panda/src/speedtree/loaderFileTypeSrt.h

@@ -26,7 +26,7 @@
 //               returns a SpeedTreeNode with just a single tree
 //               within it.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDASKEL LoaderFileTypeSrt : public LoaderFileType {
+class EXPCL_PANDASPEEDTREE LoaderFileTypeSrt : public LoaderFileType {
 public:
   LoaderFileTypeSrt();
 

+ 9 - 5
panda/src/speedtree/speedTreeNode.cxx

@@ -388,10 +388,14 @@ safe_to_combine() const {
 ////////////////////////////////////////////////////////////////////
 bool SpeedTreeNode::
 cull_callback(CullTraverser *trav, CullTraverserData &data) {
+  if (!_is_valid) {
+    return false;
+  }
+
   GraphicsStateGuardian *gsg = DCAST(GraphicsStateGuardian, trav->get_gsg());
   nassertr(gsg != (GraphicsStateGuardian *)NULL, true);
   if (!validate_api(gsg)) {
-    return true;
+    return false;
   }
 
   ClockObject *clock = ClockObject::get_global_clock();
@@ -713,11 +717,11 @@ validate_api(GraphicsStateGuardian *gsg) {
 #endif
 
   if (pipe->get_interface_name() != compiled_api) {
-    ostringstream stream;
-    stream
+    speedtree_cat.error()
       << "SpeedTree is compiled for " << compiled_api
-      << ", cannot render with " << pipe->get_interface_name();
-    nassert_raise(stream.str());
+      << ", cannot render with " << pipe->get_interface_name()
+      << "\n";
+    _is_valid = false;
     return false;
   }
 

+ 1 - 1
panda/src/speedtree/speedTreeNode.h

@@ -30,7 +30,7 @@
 //               SpeedTree objects like a collection of trees,
 //               terrain, or grass within the Panda3D scene graph.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDASKEL SpeedTreeNode : public PandaNode {
+class EXPCL_PANDASPEEDTREE SpeedTreeNode : public PandaNode {
 private:
   // This definition is required by InstanceList, below.
   typedef pvector<SpeedTree::CInstance> STInstances;

+ 1 - 1
panda/src/speedtree/stTransform.h

@@ -26,7 +26,7 @@
 //               particular instance of a tree when added to the
 //               SpeedTreeNode.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDASKEL STTransform {
+class EXPCL_PANDASPEEDTREE STTransform {
 PUBLISHED:
   INLINE STTransform();
   STTransform(const TransformState *trans);

+ 1 - 1
panda/src/speedtree/stTree.h

@@ -27,7 +27,7 @@ class SpeedTreeNode;
 // Description : Encapsulates a single tree model in the SpeedTree
 //               library, as loaded from an SRT file.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDASKEL STTree : public TypedReferenceCount, public Namable {
+class EXPCL_PANDASPEEDTREE STTree : public TypedReferenceCount, public Namable {
 PUBLISHED:
   STTree(const Filename &fullpath, const Filename &filename = Filename());
 private: