Browse Source

move lodNodes and sceneGraphAnalyzer to pgraphnodes, in an attempt to reduce size of pgraph some more

David Rose 16 years ago
parent
commit
f1f496cc29

+ 1 - 1
panda/src/downloader/httpChannel.I

@@ -329,7 +329,7 @@ get_connect_timeout() const {
 //               false, a socket connect will not block for
 //               nonblocking I/O calls, but will block for blocking
 //               I/O calls (get_document(), connect_to(), etc.).
-
+//
 //               Setting this true is useful when you want to use
 //               non-blocking I/O once you have established the
 //               connection, but you don't want to bother with polling

+ 20 - 0
panda/src/express/ramfile.I

@@ -55,3 +55,23 @@ INLINE const string &Ramfile::
 get_data() const {
   return _data;
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: Ramfile::get_data_size
+//       Access: Published
+//  Description: Returns the size of the entire buffer contents.
+////////////////////////////////////////////////////////////////////
+INLINE size_t Ramfile::
+get_data_size() const {
+  return _data.size();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Ramfile::clear
+//       Access: Published
+//  Description: Empties the current buffer contents.
+////////////////////////////////////////////////////////////////////
+INLINE void Ramfile::
+clear() {
+  _data.clear();
+}

+ 2 - 0
panda/src/express/ramfile.h

@@ -34,6 +34,8 @@ PUBLISHED:
   string readline();
 
   INLINE const string &get_data() const;
+  INLINE size_t get_data_size() const;
+  INLINE void clear();
 
 public:
   size_t _pos;

+ 4 - 1
panda/src/framework/pandaFramework.cxx

@@ -27,6 +27,7 @@
 #include "mouseRecorder.h"
 #include "throw_event.h"
 #include "executionEnvironment.h"
+#include "sceneGraphAnalyzer.h"
 
 LoaderOptions PandaFramework::_loader_options;
 
@@ -1199,7 +1200,9 @@ event_A(const Event *, void *data) {
     node = self->get_models();
   }
 
-  node.analyze();
+  SceneGraphAnalyzer sga;
+  sga.add_node(node.node());
+  sga.write(nout);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 0 - 15
panda/src/pgraph/Sources.pp

@@ -47,8 +47,6 @@
     depthTestAttrib.I depthTestAttrib.h \
     depthWriteAttrib.I depthWriteAttrib.h \
     eventStorePandaNode.I eventStorePandaNode.h \
-    fadeLodNode.I fadeLodNode.h \
-    fadeLodNodeData.h \
     findApproxLevelEntry.I findApproxLevelEntry.h \
     findApproxPath.I findApproxPath.h \
     fog.I fog.h \
@@ -65,8 +63,6 @@
     loaderFileType.h \
     loaderFileTypeBam.h  \
     loaderFileTypeRegistry.h \
-    lodNode.I lodNode.h \
-    lodNodeType.h \
     materialAttrib.I materialAttrib.h \
     materialCollection.I materialCollection.h \
     modelFlattenRequest.I modelFlattenRequest.h \
@@ -92,7 +88,6 @@
     renderModeAttrib.I renderModeAttrib.h \
     renderState.I renderState.h \
     rescaleNormalAttrib.I rescaleNormalAttrib.h \
-    sceneGraphAnalyzer.h sceneGraphAnalyzer.I \
     sceneGraphReducer.I sceneGraphReducer.h \
     sceneSetup.I sceneSetup.h \
     scissorAttrib.I scissorAttrib.h \
@@ -150,8 +145,6 @@
     depthTestAttrib.cxx \
     depthWriteAttrib.cxx \
     eventStorePandaNode.cxx \
-    fadeLodNode.cxx \
-    fadeLodNodeData.cxx \
     findApproxLevelEntry.cxx \
     findApproxPath.cxx \
     fog.cxx \
@@ -168,8 +161,6 @@
     loaderFileType.cxx  \
     loaderFileTypeBam.cxx \
     loaderFileTypeRegistry.cxx  \
-    lodNode.cxx \
-    lodNodeType.cxx \
     materialAttrib.cxx \
     materialCollection.cxx \
     modelFlattenRequest.cxx \
@@ -194,7 +185,6 @@
     renderModeAttrib.cxx \
     renderState.cxx \
     rescaleNormalAttrib.cxx \
-    sceneGraphAnalyzer.cxx \
     sceneGraphReducer.cxx \
     sceneSetup.cxx \
     scissorAttrib.cxx \
@@ -251,8 +241,6 @@
     depthTestAttrib.I depthTestAttrib.h \
     depthWriteAttrib.I depthWriteAttrib.h \
     eventStorePandaNode.I eventStorePandaNode.h \
-    fadeLodNode.I fadeLodNode.h \
-    fadeLodNodeData.h \
     fog.I fog.h \
     fogAttrib.I fogAttrib.h \
     geomDrawCallbackData.I geomDrawCallbackData.h \
@@ -267,8 +255,6 @@
     loaderFileType.h \
     loaderFileTypeBam.h \
     loaderFileTypeRegistry.h \
-    lodNode.I lodNode.h \
-    lodNodeType.h \
     materialAttrib.I materialAttrib.h \
     materialCollection.I materialCollection.h \
     modelFlattenRequest.I modelFlattenRequest.h \
@@ -294,7 +280,6 @@
     renderModeAttrib.I renderModeAttrib.h \
     renderState.I renderState.h \
     rescaleNormalAttrib.I rescaleNormalAttrib.h \
-    sceneGraphAnalyzer.h sceneGraphAnalyzer.I \
     sceneGraphReducer.I sceneGraphReducer.h \
     sceneSetup.I sceneSetup.h \
     scissorAttrib.I scissorAttrib.h \

+ 0 - 13
panda/src/pgraph/config_pgraph.cxx

@@ -38,8 +38,6 @@
 #include "depthWriteAttrib.h"
 #include "eventStorePandaNode.h"
 #include "findApproxLevelEntry.h"
-#include "fadeLodNode.h"
-#include "fadeLodNodeData.h"
 #include "fog.h"
 #include "fogAttrib.h"
 #include "geomDrawCallbackData.h"
@@ -53,7 +51,6 @@
 #include "loaderFileType.h"
 #include "loaderFileTypeBam.h"
 #include "loaderFileTypeRegistry.h"
-#include "lodNode.h"
 #include "materialAttrib.h"
 #include "modelFlattenRequest.h"
 #include "modelLoadRequest.h"
@@ -382,11 +379,6 @@ ConfigVariableString default_model_extension
           "Panda's loader; new code should probably give the correct name "
           "for each model file they intend to load."));
 
-ConfigVariableEnum<LODNodeType> default_lod_type
-("default-lod-type", LNT_pop,
- PRC_DESC("Set this to either 'pop' or 'fade' to determine the type of "
-          "LODNode that is created by LODNode::make_default_lod()."));
-
 ConfigVariableBool allow_live_flatten
 ("allow-live-flatten", true,
  PRC_DESC("Set this true to allow the use of flatten_strong() or any "
@@ -435,8 +427,6 @@ init_libpgraph() {
   DepthTestAttrib::init_type();
   DepthWriteAttrib::init_type();
   EventStorePandaNode::init_type();
-  FadeLODNode::init_type();
-  FadeLODNodeData::init_type();
   FindApproxLevelEntry::init_type();
   Fog::init_type();
   FogAttrib::init_type();
@@ -448,7 +438,6 @@ init_libpgraph() {
   LightAttrib::init_type();
   LightRampAttrib::init_type();
   Loader::init_type();
-  LODNode::init_type();
   LoaderFileType::init_type();
   LoaderFileTypeBam::init_type();
   MaterialAttrib::init_type();
@@ -512,14 +501,12 @@ init_libpgraph() {
   DepthOffsetAttrib::register_with_read_factory();
   DepthTestAttrib::register_with_read_factory();
   DepthWriteAttrib::register_with_read_factory();
-  FadeLODNode::register_with_read_factory();
   Fog::register_with_read_factory();
   FogAttrib::register_with_read_factory();
   GeomNode::register_with_read_factory();
   LensNode::register_with_read_factory();
   LightAttrib::register_with_read_factory();
   LightRampAttrib::register_with_read_factory();
-  LODNode::register_with_read_factory();
   MaterialAttrib::register_with_read_factory();
   ModelNode::register_with_read_factory();
   ModelRoot::register_with_read_factory();

+ 0 - 2
panda/src/pgraph/config_pgraph.h

@@ -22,7 +22,6 @@
 #include "configVariableInt.h"
 #include "configVariableDouble.h"
 #include "configVariableList.h"
-#include "lodNodeType.h"
 
 class DSearchPath;
 
@@ -77,7 +76,6 @@ extern ConfigVariableBool m_dual_flash;
 extern ConfigVariableList load_file_type;
 extern ConfigVariableString default_model_extension;
 
-extern ConfigVariableEnum<LODNodeType> default_lod_type;
 extern ConfigVariableBool allow_live_flatten;
 
 extern EXPCL_PANDA_PGRAPH void init_libpgraph();

+ 8 - 1
panda/src/pgraph/nodePath.cxx

@@ -52,7 +52,6 @@
 #include "plist.h"
 #include "boundingSphere.h"
 #include "geomNode.h"
-#include "sceneGraphAnalyzer.h"
 #include "sceneGraphReducer.h"
 #include "textureCollection.h"
 #include "textureStageCollection.h"
@@ -6056,6 +6055,13 @@ calc_tight_bounds(LPoint3f &min_point, LPoint3f &max_point,
   return found_any;
 }
 
+/*
+
+NB: Had to remove this function to avoid circular dependency when
+moving SceneGraphAnalyzer into pgraphnodes, attempting to reduce size
+of pgraph.  This function is now defined as a Python extension
+function instead.
+
 ////////////////////////////////////////////////////////////////////
 //     Function: NodePath::analyze
 //       Access: Published
@@ -6089,6 +6095,7 @@ analyze() const {
     sga.write(nout);
   }
 }
+*/
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NodePath::flatten_light

+ 1 - 1
panda/src/pgraph/nodePath.h

@@ -821,7 +821,7 @@ PUBLISHED:
   bool calc_tight_bounds(LPoint3f &min_point, LPoint3f &max_point,
                          Thread *current_thread = Thread::get_current_thread()) const;
 
-  void analyze() const;
+  //  void analyze() const;
 
   int flatten_light();
   int flatten_medium();

+ 0 - 2
panda/src/pgraph/pgraph_composite2.cxx

@@ -14,8 +14,6 @@
 #include "depthWriteAttrib.cxx"
 #include "alphaTestAttrib.cxx"
 #include "eventStorePandaNode.cxx"
-#include "fadeLodNode.cxx"
-#include "fadeLodNodeData.cxx"
 #include "findApproxPath.cxx"
 #include "findApproxLevelEntry.cxx"
 #include "fog.cxx"

+ 0 - 2
panda/src/pgraph/pgraph_composite3.cxx

@@ -7,8 +7,6 @@
 #include "loaderFileType.cxx"
 #include "loaderFileTypeBam.cxx"
 #include "loaderFileTypeRegistry.cxx"
-#include "lodNode.cxx"
-#include "lodNodeType.cxx"
 #include "materialAttrib.cxx"
 #include "materialCollection.cxx"
 #include "modelFlattenRequest.cxx"

+ 0 - 1
panda/src/pgraph/pgraph_composite4.cxx

@@ -5,7 +5,6 @@
 #include "renderModeAttrib.cxx"
 #include "renderState.cxx"
 #include "rescaleNormalAttrib.cxx"
-#include "sceneGraphAnalyzer.cxx"
 #include "sceneGraphReducer.cxx"
 #include "scissorAttrib.cxx"
 #include "scissorEffect.cxx"

+ 9 - 0
panda/src/pgraphnodes/Sources.pp

@@ -16,10 +16,13 @@
     callbackNode.h callbackNode.I \
     config_pgraphnodes.h \
     directionalLight.h directionalLight.I \
+    fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \
     lightLensNode.h lightLensNode.I \
     lightNode.h lightNode.I \
+    lodNode.I lodNode.h lodNodeType.h \
     nodeCullCallbackData.h nodeCullCallbackData.I \
     pointLight.h pointLight.I \
+    sceneGraphAnalyzer.h sceneGraphAnalyzer.I \
     selectiveChildNode.h selectiveChildNode.I \
     sequenceNode.h sequenceNode.I \
     shaderGenerator.h shaderGenerator.I \
@@ -31,10 +34,13 @@
     callbackNode.cxx \
     config_pgraphnodes.cxx \
     directionalLight.cxx \
+    fadeLodNode.cxx fadeLodNodeData.cxx \
     lightLensNode.cxx \
     lightNode.cxx \
+    lodNode.cxx lodNodeType.cxx \
     nodeCullCallbackData.cxx \
     pointLight.cxx \
+    sceneGraphAnalyzer.cxx \
     selectiveChildNode.cxx \
     sequenceNode.cxx \
     shaderGenerator.cxx \
@@ -46,10 +52,13 @@
     callbackNode.h callbackNode.I \
     config_pgraphnodes.h \
     directionalLight.h directionalLight.I \
+    fadeLodNode.I fadeLodNode.h fadeLodNodeData.h \
     lightLensNode.h lightLensNode.I \
     lightNode.h lightNode.I \
+    lodNode.I lodNode.h lodNodeType.h \
     nodeCullCallbackData.h nodeCullCallbackData.I \
     pointLight.h pointLight.I \
+    sceneGraphAnalyzer.h sceneGraphAnalyzer.I \
     selectiveChildNode.h selectiveChildNode.I \
     sequenceNode.h sequenceNode.I \
     shaderGenerator.h shaderGenerator.I \

+ 13 - 0
panda/src/pgraphnodes/config_pgraphnodes.cxx

@@ -19,8 +19,11 @@
 #include "callbackNode.h"
 #include "callbackObject.h"
 #include "directionalLight.h"
+#include "fadeLodNode.h"
+#include "fadeLodNodeData.h"
 #include "lightLensNode.h"
 #include "lightNode.h"
+#include "lodNode.h"
 #include "nodeCullCallbackData.h"
 #include "pointLight.h"
 #include "selectiveChildNode.h"
@@ -38,6 +41,11 @@ ConfigureFn(config_pgraphnodes) {
   init_libpgraphnodes();
 }
 
+ConfigVariableEnum<LODNodeType> default_lod_type
+("default-lod-type", LNT_pop,
+ PRC_DESC("Set this to either 'pop' or 'fade' to determine the type of "
+          "LODNode that is created by LODNode::make_default_lod()."));
+
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpgraphnodes
 //  Description: Initializes the library.  This must be called at
@@ -59,8 +67,11 @@ init_libpgraphnodes() {
   CallbackNode::init_type();
   CallbackObject::init_type();
   DirectionalLight::init_type();
+  FadeLODNode::init_type();
+  FadeLODNodeData::init_type();
   LightLensNode::init_type();
   LightNode::init_type();
+  LODNode::init_type();
   NodeCullCallbackData::init_type();
   PointLight::init_type();
   SelectiveChildNode::init_type();
@@ -72,8 +83,10 @@ init_libpgraphnodes() {
   AmbientLight::register_with_read_factory();
   CallbackNode::register_with_read_factory();
   DirectionalLight::register_with_read_factory();
+  FadeLODNode::register_with_read_factory();
   LightLensNode::register_with_read_factory();
   LightNode::register_with_read_factory();
+  LODNode::register_with_read_factory();
   PointLight::register_with_read_factory();
   SelectiveChildNode::register_with_read_factory();
   SequenceNode::register_with_read_factory();

+ 4 - 0
panda/src/pgraphnodes/config_pgraphnodes.h

@@ -16,12 +16,16 @@
 #define CONFIG_PGRAPHNODES_H
 
 #include "pandabase.h"
+#include "lodNodeType.h"
+#include "configVariableEnum.h"
 
 class DSearchPath;
 
 ConfigureDecl(config_pgraphnodes, EXPCL_PANDA_PGRAPHNODES, EXPTP_PANDA_PGRAPHNODES);
 NotifyCategoryDecl(pgraphnodes, EXPCL_PANDA_PGRAPHNODES, EXPTP_PANDA_PGRAPHNODES);
 
+extern ConfigVariableEnum<LODNodeType> default_lod_type;
+
 extern EXPCL_PANDA_PGRAPHNODES void init_libpgraphnodes();
 
 #endif

+ 0 - 0
panda/src/pgraph/fadeLodNode.I → panda/src/pgraphnodes/fadeLodNode.I


+ 1 - 0
panda/src/pgraph/fadeLodNode.cxx → panda/src/pgraphnodes/fadeLodNode.cxx

@@ -21,6 +21,7 @@
 #include "depthWriteAttrib.h"
 #include "transparencyAttrib.h"
 #include "cullBinAttrib.h"
+#include "depthOffsetAttrib.h"
 
 TypeHandle FadeLODNode::_type_handle;
 

+ 1 - 1
panda/src/pgraph/fadeLodNode.h → panda/src/pgraphnodes/fadeLodNode.h

@@ -23,7 +23,7 @@
 //       Class : FadeLODNode
 // Description : A Level-of-Detail node with alpha based switching.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA_PGRAPH FadeLODNode : public LODNode {
+class EXPCL_PANDA_PGRAPHNODES FadeLODNode : public LODNode {
 PUBLISHED:
   FadeLODNode(const string &name);
 

+ 0 - 0
panda/src/pgraph/fadeLodNodeData.cxx → panda/src/pgraphnodes/fadeLodNodeData.cxx


+ 1 - 1
panda/src/pgraph/fadeLodNodeData.h → panda/src/pgraphnodes/fadeLodNodeData.h

@@ -24,7 +24,7 @@
 // Description : This is the data that is associated with a particular
 //               instance of the FadeLODNode for the scene graph.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA_PGRAPH FadeLODNodeData : public AuxSceneData {
+class EXPCL_PANDA_PGRAPHNODES FadeLODNodeData : public AuxSceneData {
 public:
   enum FadeMode {
     FM_solid,

+ 0 - 0
panda/src/pgraph/lodNode.I → panda/src/pgraphnodes/lodNode.I


+ 1 - 1
panda/src/pgraph/lodNode.cxx → panda/src/pgraphnodes/lodNode.cxx

@@ -16,7 +16,7 @@
 #include "fadeLodNode.h"
 #include "cullTraverserData.h"
 #include "cullTraverser.h"
-#include "config_pgraph.h"
+#include "config_pgraphnodes.h"
 #include "geomVertexData.h"
 #include "geomVertexWriter.h"
 #include "geomVertexFormat.h"

+ 1 - 1
panda/src/pgraph/lodNode.h → panda/src/pgraphnodes/lodNode.h

@@ -28,7 +28,7 @@
 //               from the camera and the table indicated in the
 //               associated LOD object.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA_PGRAPH LODNode : public PandaNode {
+class EXPCL_PANDA_PGRAPHNODES LODNode : public PandaNode {
 PUBLISHED:
   INLINE LODNode(const string &name);
 

+ 0 - 0
panda/src/pgraph/lodNodeType.cxx → panda/src/pgraphnodes/lodNodeType.cxx


+ 0 - 0
panda/src/pgraph/lodNodeType.h → panda/src/pgraphnodes/lodNodeType.h


+ 2 - 0
panda/src/pgraphnodes/pgraphnodes_composite1.cxx

@@ -2,5 +2,7 @@
 #include "callbackNode.cxx"
 #include "config_pgraphnodes.cxx"
 #include "directionalLight.cxx"
+#include "fadeLodNode.cxx"
+#include "fadeLodNodeData.cxx"
 #include "lightLensNode.cxx"
 #include "lightNode.cxx"

+ 3 - 0
panda/src/pgraphnodes/pgraphnodes_composite2.cxx

@@ -1,5 +1,8 @@
+#include "lodNode.cxx"
+#include "lodNodeType.cxx"
 #include "nodeCullCallbackData.cxx"
 #include "pointLight.cxx"
+#include "sceneGraphAnalyzer.cxx"
 #include "selectiveChildNode.cxx"
 #include "sequenceNode.cxx"
 #include "shaderGenerator.cxx"

+ 0 - 0
panda/src/pgraph/sceneGraphAnalyzer.I → panda/src/pgraphnodes/sceneGraphAnalyzer.I


+ 0 - 0
panda/src/pgraph/sceneGraphAnalyzer.cxx → panda/src/pgraphnodes/sceneGraphAnalyzer.cxx


+ 1 - 1
panda/src/pgraph/sceneGraphAnalyzer.h → panda/src/pgraphnodes/sceneGraphAnalyzer.h

@@ -36,7 +36,7 @@ class Texture;
 // Description : A handy class that can scrub over a scene graph and
 //               collect interesting statistics on it.
 ////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA_PGRAPH SceneGraphAnalyzer {
+class EXPCL_PANDA_PGRAPHNODES SceneGraphAnalyzer {
 PUBLISHED:
   SceneGraphAnalyzer();
   ~SceneGraphAnalyzer();

+ 6 - 0
panda/src/pipeline/thread.cxx

@@ -222,6 +222,12 @@ write_status(ostream &out) {
 //               joinable should be set true if you intend to call
 //               join() to wait for the thread to terminate, or false
 //               if you don't care and you will never call join().
+//               Note that the reference count on the Thread object is
+//               incremented while the thread itself is running, so if
+//               you just want to fire and forget a thread, you may
+//               pass joinable = false, and never store the Thread
+//               object.  It will automatically destruct itself when
+//               it finishes.
 //
 //               The return value is true if the thread is
 //               successfully started, false otherwise.