speedtree refinements

This commit is contained in:
David Rose 2010-10-07 23:17:28 +00:00
parent d0db1d1f07
commit 48c6a8756a
9 changed files with 28 additions and 18 deletions

View File

@ -132,4 +132,10 @@ egg-object-type-glow <Scalar> blend { add }
# maya2egg itself. So if it appears in an egg file, it means nothing. # maya2egg itself. So if it appears in an egg file, it means nothing.
egg-object-type-keep-all-uvsets 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 #end 20_panda.prc

View File

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

View File

@ -3,8 +3,8 @@
#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \ #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
dtoolutil:c dtoolbase:c dtool:m prc:c 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 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 BUILDING_DLL BUILDING_PANDASPEEDTREE
#begin lib_target #begin lib_target
#define TARGET pandaspeedtree #define TARGET pandaspeedtree

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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