Kaynağa Gözat

combine loader with pgraph

David Rose 23 yıl önce
ebeveyn
işleme
835e22a1e2

+ 1 - 1
panda/src/egg2pg/Sources.pp

@@ -6,7 +6,7 @@
 #begin lib_target
   #define TARGET egg2pg
   #define LOCAL_LIBS \
-    parametrics collide egg builder loader chan char
+    parametrics collide egg builder pgraph chan char
 
   #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx 
 

+ 1 - 1
panda/src/framework/Sources.pp

@@ -5,7 +5,7 @@
   #define TARGET framework
   #define BUILDING_DLL BUILDING_FRAMEWORK
   #define LOCAL_LIBS \
-    pgraph putil collide loader chan text chancfg \
+    pgraph putil collide chan text chancfg \
     pnmimage pnmimagetypes event
 
   #define SOURCES \

+ 0 - 30
panda/src/loader/Sources.pp

@@ -1,30 +0,0 @@
-#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
-                   dtoolutil:c dtoolbase:c dtool:m
-
-#begin lib_target
-  #define TARGET loader
-  #define LOCAL_LIBS \
-    event pgraph ipc putil express downloader
-    
-  #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
-
-  #define SOURCES \
-    bamFile.I bamFile.h config_loader.h loader.I loader.h  \
-    loaderFileType.h loaderFileTypeBam.h  \
-    loaderFileTypeRegistry.h \
-    modelPool.I modelPool.h  
-     
-  #define INCLUDED_SOURCES  \
-    bamFile.cxx config_loader.cxx loader.cxx loaderFileType.cxx  \
-    loaderFileTypeBam.cxx loaderFileTypeRegistry.cxx  \
-    modelPool.cxx
-
-  #define INSTALL_HEADERS \
-    bamFile.I bamFile.h loader.I loader.h loaderFileType.h \
-    loaderFileTypeBam.h loaderFileTypeRegistry.h \
-    modelPool.I modelPool.h  
-
-  #define IGATESCAN all
-
-#end lib_target
-

+ 0 - 55
panda/src/loader/config_loader.cxx

@@ -1,55 +0,0 @@
-// Filename: config_loader.cxx
-// Created by:  drose (19Mar00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "config_loader.h"
-#include "loaderFileType.h"
-#include "loaderFileTypeBam.h"
-#include "loaderFileTypeRegistry.h"
-
-#include <dconfig.h>
-#include <get_config_path.h>
-
-Configure(config_loader);
-NotifyCategoryDef(loader, "");
-
-// Set this true to support actual asynchronous loads via the
-// request_load()/fetch_load() interface to Loader.  Set it false to
-// map these to blocking, synchronous loads instead.  Currently, the
-// rest of Panda isn't quite ready for asynchronous loads, so leave
-// this false for now.
-const bool asynchronous_loads = config_loader.GetBool("asynchronous-loads", false);
-
-Config::ConfigTable::Symbol *load_file_type = (Config::ConfigTable::Symbol *)NULL;
-
-ConfigureFn(config_loader) {
-  load_file_type = new Config::ConfigTable::Symbol;
-  config_loader.GetAll("load-file-type", *load_file_type);
-
-  LoaderFileType::init_type();
-  LoaderFileTypeBam::init_type();
-
-  LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr();
-
-  reg->register_type(new LoaderFileTypeBam);
-}
-
-const DSearchPath &
-get_bam_path() {
-  static DSearchPath *bam_path = NULL;
-  return get_config_path("bam-path", bam_path);
-}

+ 0 - 36
panda/src/loader/config_loader.h

@@ -1,36 +0,0 @@
-// Filename: config_loader.h
-// Created by:  drose (19Mar00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef CONFIG_LOADER_H
-#define CONFIG_LOADER_H
-
-#include <pandabase.h>
-
-#include <dconfig.h>
-#include <notifyCategoryProxy.h>
-
-class DSearchPath;
-
-NotifyCategoryDecl(loader, EXPCL_PANDA, EXPTP_PANDA);
-
-extern const bool asynchronous_loads;
-const DSearchPath &get_bam_path();
-
-extern Config::ConfigTable::Symbol *load_file_type;
-
-#endif

+ 0 - 5
panda/src/loader/loader_composite1.cxx

@@ -1,5 +0,0 @@
-
-#include "bamFile.cxx"
-#include "config_loader.cxx"
-#include "loader.cxx"
-

+ 0 - 6
panda/src/loader/loader_composite2.cxx

@@ -1,6 +0,0 @@
-
-#include "modelPool.cxx"
-#include "loaderFileType.cxx"
-#include "loaderFileTypeBam.cxx"
-#include "loaderFileTypeRegistry.cxx"
-

+ 21 - 7
panda/src/pgraph/Sources.pp

@@ -1,6 +1,8 @@
 #define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
                    dtoolutil:c dtoolbase:c dtool:m
-#define LOCAL_LIBS lerp event gsgbase gobj putil linmath express pandabase
+#define LOCAL_LIBS \
+    lerp event gsgbase gobj putil linmath \
+    downloader express pandabase
 
 #begin lib_target
   #define TARGET pgraph
@@ -8,6 +10,7 @@
   #define SOURCES \
     alphaTestAttrib.I alphaTestAttrib.h \  
     ambientLight.I ambientLight.h \
+    bamFile.I bamFile.h \
     billboardEffect.I billboardEffect.h \
     binCullHandler.I binCullHandler.h \
     camera.I camera.h \
@@ -45,9 +48,14 @@
     lightAttrib.I lightAttrib.h \
     lightLensNode.I lightLensNode.h \
     lightNode.I lightNode.h \
+    loader.I loader.h  \
+    loaderFileType.h \
+    loaderFileTypeBam.h  \
+    loaderFileTypeRegistry.h \
     lodNode.I lodNode.h \
     materialAttrib.I materialAttrib.h \
     modelNode.I modelNode.h \
+    modelPool.I modelPool.h \
     modelRoot.I modelRoot.h \
     nodePath.I nodePath.h nodePath.cxx \
     nodePathCollection.I nodePathCollection.h \
@@ -79,6 +87,7 @@
   #define INCLUDED_SOURCES \
     alphaTestAttrib.cxx \  
     ambientLight.cxx \
+    bamFile.cxx \
     billboardEffect.cxx \
     binCullHandler.cxx \
     camera.cxx \
@@ -116,9 +125,14 @@
     lightAttrib.cxx \
     lightLensNode.cxx \
     lightNode.cxx \
+    loader.cxx \
+    loaderFileType.cxx  \
+    loaderFileTypeBam.cxx \
+    loaderFileTypeRegistry.cxx  \
     lodNode.cxx \
     materialAttrib.cxx \
     modelNode.cxx \
+    modelPool.cxx \
     modelRoot.cxx \
     nodePath.cxx \
     nodePathCollection.cxx \
@@ -146,15 +160,10 @@
     transparencyAttrib.cxx \
     workingNodePath.cxx
 
-  #if $[DONT_COMBINE_PGRAPH]    
-    #define SOURCES $[SOURCES] $[INCLUDED_SOURCES]
-    #define INCLUDED_SOURCES
-    #define COMBINED_SOURCES
-  #endif
-
   #define INSTALL_HEADERS \
     alphaTestAttrib.I alphaTestAttrib.h \  
     ambientLight.I ambientLight.h \
+    bamFile.I bamFile.h \
     billboardEffect.I billboardEffect.h \
     binCullHandler.I binCullHandler.h \
     camera.I camera.h \
@@ -189,9 +198,14 @@
     lightAttrib.I lightAttrib.h \
     lightLensNode.I lightLensNode.h \
     lightNode.I lightNode.h \
+    loader.I loader.h \
+    loaderFileType.h \
+    loaderFileTypeBam.h \
+    loaderFileTypeRegistry.h \
     lodNode.I lodNode.h \
     materialAttrib.I materialAttrib.h \
     modelNode.I modelNode.h \
+    modelPool.I modelPool.h \
     modelRoot.I modelRoot.h \
     nodePath.I nodePath.h \
     nodePathCollection.I nodePathCollection.h \

+ 0 - 0
panda/src/loader/bamFile.I → panda/src/pgraph/bamFile.I


+ 6 - 6
panda/src/loader/bamFile.cxx → panda/src/pgraph/bamFile.cxx

@@ -17,13 +17,13 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "bamFile.h"
-#include "config_loader.h"
+#include "config_pgraph.h"
 
-#include <bam.h>
-#include <config_util.h>
-#include <bamReader.h>
-#include <bamWriter.h>
-#include <filename.h>
+#include "bam.h"
+#include "config_util.h"
+#include "bamReader.h"
+#include "bamWriter.h"
+#include "filename.h"
 
 ////////////////////////////////////////////////////////////////////
 //     Function: BamFile::Constructor

+ 0 - 0
panda/src/loader/bamFile.h → panda/src/pgraph/bamFile.h


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

@@ -46,6 +46,9 @@
 #include "lightAttrib.h"
 #include "lightLensNode.h"
 #include "lightNode.h"
+#include "loaderFileType.h"
+#include "loaderFileTypeBam.h"
+#include "loaderFileTypeRegistry.h"
 #include "lodNode.h"
 #include "materialAttrib.h"
 #include "modelNode.h"
@@ -69,11 +72,13 @@
 #include "transformState.h"
 #include "transparencyAttrib.h"
 #include "nodePathLerps.h"
+#include "get_config_path.h"
 
 #include "dconfig.h"
 
 ConfigureDef(config_pgraph);
 NotifyCategoryDef(pgraph, "");
+NotifyCategoryDef(loader, "");
 
 ConfigureFn(config_pgraph) {
   init_libpgraph();
@@ -99,6 +104,21 @@ const bool m_dual_transparent = config_pgraph.GetBool("m-dual-transparent", true
 // Set this true to flash any objects that use M_dual, for debugging.
 const bool m_dual_flash = config_pgraph.GetBool("m-dual-flash", false);
 
+// Set this true to support actual asynchronous loads via the
+// request_load()/fetch_load() interface to Loader.  Set it false to
+// map these to blocking, synchronous loads instead.  Currently, the
+// rest of Panda isn't quite ready for asynchronous loads, so leave
+// this false for now.
+const bool asynchronous_loads = config_pgraph.GetBool("asynchronous-loads", false);
+
+Config::ConfigTable::Symbol *load_file_type = (Config::ConfigTable::Symbol *)NULL;
+
+const DSearchPath &
+get_bam_path() {
+  static DSearchPath *bam_path = NULL;
+  return get_config_path("bam-path", bam_path);
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: init_libpgraph
 //  Description: Initializes the library.  This must be called at
@@ -115,6 +135,9 @@ init_libpgraph() {
   }
   initialized = true;
 
+  load_file_type = new Config::ConfigTable::Symbol;
+  config_pgraph.GetAll("load-file-type", *load_file_type);
+
   AlphaTestAttrib::init_type();
   AmbientLight::init_type();
   BillboardEffect::init_type();
@@ -144,6 +167,8 @@ init_libpgraph() {
   LightLensNode::init_type();
   LightNode::init_type();
   LODNode::init_type();
+  LoaderFileType::init_type();
+  LoaderFileTypeBam::init_type();
   MaterialAttrib::init_type();
   ModelNode::init_type();
   ModelRoot::init_type();
@@ -211,4 +236,7 @@ init_libpgraph() {
   TextureAttrib::register_with_read_factory();
   TransformState::register_with_read_factory();
   TransparencyAttrib::register_with_read_factory();
+
+  LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr();
+  reg->register_type(new LoaderFileTypeBam);
 }

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

@@ -23,8 +23,11 @@
 #include "notifyCategoryProxy.h"
 #include "dconfig.h"
 
+class DSearchPath;
+
 ConfigureDecl(config_pgraph, EXPCL_PANDA, EXPTP_PANDA);
 NotifyCategoryDecl(pgraph, EXPCL_PANDA, EXPTP_PANDA);
+NotifyCategoryDecl(loader, EXPCL_PANDA, EXPTP_PANDA);
 
 extern const bool fake_view_frustum_cull;
 extern const bool unambiguous_graph;
@@ -34,6 +37,11 @@ extern const bool m_dual_opaque;
 extern const bool m_dual_transparent;
 extern const bool m_dual_flash;
 
+extern const bool asynchronous_loads;
+const DSearchPath &get_bam_path();
+
+extern Config::ConfigTable::Symbol *load_file_type;
+
 extern EXPCL_PANDA void init_libpgraph();
 
 #endif

+ 0 - 0
panda/src/loader/loader.I → panda/src/pgraph/loader.I


+ 1 - 1
panda/src/loader/loader.cxx → panda/src/pgraph/loader.cxx

@@ -19,7 +19,7 @@
 #include "loader.h"
 #include "loaderFileType.h"
 #include "loaderFileTypeRegistry.h"
-#include "config_loader.h"
+#include "config_pgraph.h"
 
 #include "event.h"
 #include "pt_Event.h"

+ 0 - 0
panda/src/loader/loader.h → panda/src/pgraph/loader.h


+ 0 - 0
panda/src/loader/loaderFileType.cxx → panda/src/pgraph/loaderFileType.cxx


+ 0 - 0
panda/src/loader/loaderFileType.h → panda/src/pgraph/loaderFileType.h


+ 4 - 7
panda/src/loader/loaderFileTypeBam.cxx → panda/src/pgraph/loaderFileTypeBam.cxx

@@ -17,7 +17,7 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "loaderFileTypeBam.h"
-#include "config_loader.h"
+#include "config_pgraph.h"
 #include "bamFile.h"
 
 #include "config_util.h"
@@ -31,8 +31,7 @@ TypeHandle LoaderFileTypeBam::_type_handle;
 //  Description:
 ////////////////////////////////////////////////////////////////////
 LoaderFileTypeBam::
-LoaderFileTypeBam()
-{
+LoaderFileTypeBam() {
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -41,8 +40,7 @@ LoaderFileTypeBam()
 //  Description:
 ////////////////////////////////////////////////////////////////////
 string LoaderFileTypeBam::
-get_name() const
-{
+get_name() const {
   return "Bam";
 }
 
@@ -52,8 +50,7 @@ get_name() const
 //  Description:
 ////////////////////////////////////////////////////////////////////
 string LoaderFileTypeBam::
-get_extension() const
-{
+get_extension() const {
   return "bam";
 }
 

+ 0 - 0
panda/src/loader/loaderFileTypeBam.h → panda/src/pgraph/loaderFileTypeBam.h


+ 1 - 1
panda/src/loader/loaderFileTypeRegistry.cxx → panda/src/pgraph/loaderFileTypeRegistry.cxx

@@ -18,7 +18,7 @@
 
 #include "loaderFileTypeRegistry.h"
 #include "loaderFileType.h"
-#include "config_loader.h"
+#include "config_pgraph.h"
 
 #include <string_utils.h>
 #include <indent.h>

+ 0 - 0
panda/src/loader/loaderFileTypeRegistry.h → panda/src/pgraph/loaderFileTypeRegistry.h


+ 0 - 0
panda/src/loader/modelPool.I → panda/src/pgraph/modelPool.I


+ 1 - 1
panda/src/loader/modelPool.cxx → panda/src/pgraph/modelPool.cxx

@@ -18,7 +18,7 @@
 
 #include "modelPool.h"
 #include "loader.h"
-#include "config_loader.h"
+#include "config_pgraph.h"
 
 
 ModelPool *ModelPool::_global_ptr = (ModelPool *)NULL;

+ 0 - 0
panda/src/loader/modelPool.h → panda/src/pgraph/modelPool.h


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

@@ -46,6 +46,7 @@
 #include "textureCollection.h"
 #include "globPattern.h"
 #include "config_gobj.h"
+#include "bamFile.h"
 #include "dcast.h"
 
 // stack seems to overflow on Intel C++ at 7000.  If we need more than 
@@ -2781,7 +2782,6 @@ bool NodePath::
 write_bam_file(const string &filename) const {
   nassertr_always(!is_empty(), false);
 
-  /*
   BamFile bam_file;
 
   bool okflag = false;
@@ -2793,12 +2793,6 @@ write_bam_file(const string &filename) const {
     bam_file.close();
   }
   return okflag;
-  */
-
-  // At the moment, we can't do this because BamFile is defined in
-  // loader and loader depends on pgraph.
-  nassertr(false, false);
-  return false;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 2
panda/src/pgraph/pgraph_composite1.cxx

@@ -1,4 +1,5 @@
 #include "ambientLight.cxx"
+#include "bamFile.cxx"
 #include "billboardEffect.cxx"
 #include "binCullHandler.cxx"
 #include "camera.cxx"
@@ -32,5 +33,3 @@
 #include "fogAttrib.cxx"
 #include "geomNode.cxx"
 #include "geomTransformer.cxx"
-
-

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

@@ -3,9 +3,14 @@
 #include "lightAttrib.cxx"
 #include "lightLensNode.cxx"
 #include "lightNode.cxx"
+#include "loader.cxx"
+#include "loaderFileType.cxx"
+#include "loaderFileTypeBam.cxx"
+#include "loaderFileTypeRegistry.cxx"
 #include "lodNode.cxx"
 #include "materialAttrib.cxx"
 #include "modelNode.cxx"
+#include "modelPool.cxx"
 #include "modelRoot.cxx"
 #include "nodePathCollection.cxx"
 #include "nodePathComponent.cxx"

+ 1 - 1
panda/src/testbed/Sources.pp

@@ -2,7 +2,7 @@
                    dtoolutil:c dtoolbase:c dtool:m pystub
 
 #define LOCAL_LIBS \
-    framework putil collide loader chan text chancfg \
+    framework putil collide pgraph chan text chancfg \
     pnmimage pnmimagetypes event effects gobj display \
     mathutil putil express dgraph device tform \
     linmath pstatclient panda