mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
cce8ca381d
commit
f13329602f
@ -17,6 +17,8 @@
|
|||||||
#include <nodeRelation.h>
|
#include <nodeRelation.h>
|
||||||
#include <renderRelation.h>
|
#include <renderRelation.h>
|
||||||
#include <geomNode.h>
|
#include <geomNode.h>
|
||||||
|
#include <modelRoot.h>
|
||||||
|
#include <modelNode.h>
|
||||||
#include <LODNode.h>
|
#include <LODNode.h>
|
||||||
#include <sequenceNode.h>
|
#include <sequenceNode.h>
|
||||||
#include <eggGroup.h>
|
#include <eggGroup.h>
|
||||||
@ -121,7 +123,7 @@ build_graph() {
|
|||||||
load_textures();
|
load_textures();
|
||||||
|
|
||||||
// Now build up the scene graph.
|
// Now build up the scene graph.
|
||||||
_root = new NamedNode;
|
_root = new ModelRoot;
|
||||||
_root->set_name(_data.get_egg_filename().get_basename());
|
_root->set_name(_data.get_egg_filename().get_basename());
|
||||||
make_node(&_data, _root);
|
make_node(&_data, _root);
|
||||||
_builder.build();
|
_builder.build();
|
||||||
@ -1158,6 +1160,16 @@ make_node(EggGroup *egg_group, NamedNode *parent) {
|
|||||||
make_node(*ci, node);
|
make_node(*ci, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (egg_group->get_model_flag()) {
|
||||||
|
// A model flag; create a model node.
|
||||||
|
node = new ModelNode;
|
||||||
|
node->set_name(egg_group->get_name());
|
||||||
|
|
||||||
|
EggGroup::const_iterator ci;
|
||||||
|
for (ci = egg_group->begin(); ci != egg_group->end(); ++ci) {
|
||||||
|
make_node(*ci, node);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// A normal group; just create a normal node, and traverse.
|
// A normal group; just create a normal node, and traverse.
|
||||||
node = new NamedNode;
|
node = new NamedNode;
|
||||||
|
@ -8,13 +8,16 @@
|
|||||||
#define SOURCES \
|
#define SOURCES \
|
||||||
camera.I camera.cxx camera.h config_sgraph.cxx config_sgraph.h \
|
camera.I camera.cxx camera.h config_sgraph.cxx config_sgraph.h \
|
||||||
geomNode.I geomNode.cxx geomNode.h geomTransformer.I \
|
geomNode.I geomNode.cxx geomNode.h geomTransformer.I \
|
||||||
geomTransformer.cxx geomTransformer.h planeNode.I planeNode.cxx \
|
geomTransformer.cxx geomTransformer.h modelNode.I modelNode.cxx \
|
||||||
|
modelNode.h modelRoot.I modelRoot.cxx modelRoot.h \
|
||||||
|
planeNode.I planeNode.cxx \
|
||||||
planeNode.h projectionNode.I projectionNode.cxx projectionNode.h \
|
planeNode.h projectionNode.I projectionNode.cxx projectionNode.h \
|
||||||
renderTraverser.I renderTraverser.cxx renderTraverser.h
|
renderTraverser.I renderTraverser.cxx renderTraverser.h
|
||||||
|
|
||||||
#define INSTALL_HEADERS \
|
#define INSTALL_HEADERS \
|
||||||
camera.I camera.h geomNode.I geomNode.h geomTransformer.I \
|
camera.I camera.h geomNode.I geomNode.h geomTransformer.I \
|
||||||
geomTransformer.h planeNode.I planeNode.h projectionNode.I \
|
geomTransformer.h modelNode.I modelNode.h modelRoot.I \
|
||||||
|
modelRoot.h planeNode.I planeNode.h projectionNode.I \
|
||||||
projectionNode.h renderTraverser.I renderTraverser.h
|
projectionNode.h renderTraverser.I renderTraverser.h
|
||||||
|
|
||||||
#define IGATESCAN all
|
#define IGATESCAN all
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include "geomNode.h"
|
#include "geomNode.h"
|
||||||
#include "camera.h"
|
#include "camera.h"
|
||||||
#include "planeNode.h"
|
#include "planeNode.h"
|
||||||
|
#include "modelNode.h"
|
||||||
|
#include "modelRoot.h"
|
||||||
#include "projectionNode.h"
|
#include "projectionNode.h"
|
||||||
|
|
||||||
#include <dconfig.h>
|
#include <dconfig.h>
|
||||||
@ -20,9 +22,13 @@ ConfigureFn(config_sgraph) {
|
|||||||
GeomNode::init_type();
|
GeomNode::init_type();
|
||||||
Camera::init_type();
|
Camera::init_type();
|
||||||
PlaneNode::init_type();
|
PlaneNode::init_type();
|
||||||
|
ModelNode::init_type();
|
||||||
|
ModelRoot::init_type();
|
||||||
ProjectionNode::init_type();
|
ProjectionNode::init_type();
|
||||||
|
|
||||||
//Registration of writeable object's creation
|
//Registration of writeable object's creation
|
||||||
//functions with BamReader's factory
|
//functions with BamReader's factory
|
||||||
GeomNode::register_with_read_factory();
|
GeomNode::register_with_read_factory();
|
||||||
|
ModelNode::register_with_read_factory();
|
||||||
|
ModelRoot::register_with_read_factory();
|
||||||
}
|
}
|
||||||
|
36
panda/src/sgraph/modelNode.I
Normal file
36
panda/src/sgraph/modelNode.I
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Filename: modelNode.I
|
||||||
|
// Created by: drose (09Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelNode::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE ModelNode::
|
||||||
|
ModelNode(const string &name) :
|
||||||
|
NamedNode(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelNode::Copy Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE ModelNode::
|
||||||
|
ModelNode(const ModelNode ©) :
|
||||||
|
NamedNode(copy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelNode::Copy Assignment Operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void ModelNode::
|
||||||
|
operator = (const ModelNode ©) {
|
||||||
|
NamedNode::operator = (copy);
|
||||||
|
}
|
54
panda/src/sgraph/modelNode.cxx
Normal file
54
panda/src/sgraph/modelNode.cxx
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Filename: modelNode.cxx
|
||||||
|
// Created by: drose (09Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "modelNode.h"
|
||||||
|
|
||||||
|
#include <bamReader.h>
|
||||||
|
#include <datagram.h>
|
||||||
|
#include <datagramIterator.h>
|
||||||
|
|
||||||
|
TypeHandle ModelNode::_type_handle;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelNode::make_copy
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: Returns a newly-allocated Node that is a shallow copy
|
||||||
|
// of this one. It will be a different Node pointer,
|
||||||
|
// but its internal data may or may not be shared with
|
||||||
|
// that of the original Node.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Node *ModelNode::
|
||||||
|
make_copy() const {
|
||||||
|
return new ModelNode(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelNode::register_with_factory
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Factory method to generate a node object
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void ModelNode::
|
||||||
|
register_with_read_factory() {
|
||||||
|
BamReader::get_factory()->register_factory(get_class_type(), make_ModelNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelNode::make_ModelNode
|
||||||
|
// Access: Protected, Static
|
||||||
|
// Description: Factory method to generate a node object
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
TypedWriteable* ModelNode::
|
||||||
|
make_ModelNode(const FactoryParams ¶ms) {
|
||||||
|
ModelNode *me = new ModelNode;
|
||||||
|
BamReader *manager;
|
||||||
|
Datagram packet;
|
||||||
|
|
||||||
|
parse_params(params, manager, packet);
|
||||||
|
DatagramIterator scan(packet);
|
||||||
|
|
||||||
|
me->fillin(scan, manager);
|
||||||
|
return me;
|
||||||
|
}
|
61
panda/src/sgraph/modelNode.h
Normal file
61
panda/src/sgraph/modelNode.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Filename: modelNode.h
|
||||||
|
// Created by: drose (09Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef MODELNODE_H
|
||||||
|
#define MODELNODE_H
|
||||||
|
|
||||||
|
#include <pandabase.h>
|
||||||
|
|
||||||
|
#include <namedNode.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : ModelNode
|
||||||
|
// Description : This node is placed at key points within the scene
|
||||||
|
// graph to indicate the roots of "models": subtrees
|
||||||
|
// that are conceptually to be treated as a single unit,
|
||||||
|
// like a car or a room, for instance. It doesn't
|
||||||
|
// affect rendering or any other operations; it's
|
||||||
|
// primarily useful as a high-level model indication.
|
||||||
|
//
|
||||||
|
// ModelNodes are created in response to a <Model> { 1 }
|
||||||
|
// flag within an egg file.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EXPCL_PANDA ModelNode : public NamedNode {
|
||||||
|
public:
|
||||||
|
INLINE ModelNode(const string &name = "");
|
||||||
|
INLINE ModelNode(const ModelNode ©);
|
||||||
|
INLINE void operator = (const ModelNode ©);
|
||||||
|
|
||||||
|
virtual Node *make_copy() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void register_with_read_factory(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static TypedWriteable *make_ModelNode(const FactoryParams ¶ms);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static TypeHandle get_class_type() {
|
||||||
|
return _type_handle;
|
||||||
|
}
|
||||||
|
static void init_type() {
|
||||||
|
NamedNode::init_type();
|
||||||
|
register_type(_type_handle, "ModelNode",
|
||||||
|
NamedNode::get_class_type());
|
||||||
|
}
|
||||||
|
virtual TypeHandle get_type(void) const {
|
||||||
|
return get_class_type();
|
||||||
|
}
|
||||||
|
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static TypeHandle _type_handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "modelNode.I"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
36
panda/src/sgraph/modelRoot.I
Normal file
36
panda/src/sgraph/modelRoot.I
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Filename: modelRoot.I
|
||||||
|
// Created by: drose (09Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelRoot::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE ModelRoot::
|
||||||
|
ModelRoot(const string &name) :
|
||||||
|
ModelNode(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelRoot::Copy Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE ModelRoot::
|
||||||
|
ModelRoot(const ModelRoot ©) :
|
||||||
|
ModelNode(copy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelRoot::Copy Assignment Operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void ModelRoot::
|
||||||
|
operator = (const ModelRoot ©) {
|
||||||
|
ModelNode::operator = (copy);
|
||||||
|
}
|
50
panda/src/sgraph/modelRoot.cxx
Normal file
50
panda/src/sgraph/modelRoot.cxx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Filename: modelRoot.cxx
|
||||||
|
// Created by: drose (09Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "modelRoot.h"
|
||||||
|
|
||||||
|
TypeHandle ModelRoot::_type_handle;
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelRoot::make_copy
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: Returns a newly-allocated Node that is a shallow copy
|
||||||
|
// of this one. It will be a different Node pointer,
|
||||||
|
// but its internal data may or may not be shared with
|
||||||
|
// that of the original Node.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Node *ModelRoot::
|
||||||
|
make_copy() const {
|
||||||
|
return new ModelRoot(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelRoot::register_with_factory
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Factory method to generate a node object
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void ModelRoot::
|
||||||
|
register_with_read_factory() {
|
||||||
|
BamReader::get_factory()->register_factory(get_class_type(), make_ModelRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ModelRoot::make_ModelRoot
|
||||||
|
// Access: Protected, Static
|
||||||
|
// Description: Factory method to generate a node object
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
TypedWriteable* ModelRoot::
|
||||||
|
make_ModelRoot(const FactoryParams ¶ms) {
|
||||||
|
ModelRoot *me = new ModelRoot;
|
||||||
|
BamReader *manager;
|
||||||
|
Datagram packet;
|
||||||
|
|
||||||
|
parse_params(params, manager, packet);
|
||||||
|
DatagramIterator scan(packet);
|
||||||
|
|
||||||
|
me->fillin(scan, manager);
|
||||||
|
return me;
|
||||||
|
}
|
58
panda/src/sgraph/modelRoot.h
Normal file
58
panda/src/sgraph/modelRoot.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Filename: modelRoot.h
|
||||||
|
// Created by: drose (09Nov00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef MODELROOT_H
|
||||||
|
#define MODELROOT_H
|
||||||
|
|
||||||
|
#include <pandabase.h>
|
||||||
|
|
||||||
|
#include "modelNode.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : ModelRoot
|
||||||
|
// Description : A node of this type is created automatically at the
|
||||||
|
// root of each model file that is loaded. It may
|
||||||
|
// eventually contain some information about the
|
||||||
|
// contents of the model; at the moment, it contains no
|
||||||
|
// special information, but can be used as a flag to
|
||||||
|
// indicate the presence of a loaded model file.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EXPCL_PANDA ModelRoot : public ModelNode {
|
||||||
|
public:
|
||||||
|
INLINE ModelRoot(const string &name = "");
|
||||||
|
INLINE ModelRoot(const ModelRoot ©);
|
||||||
|
INLINE void operator = (const ModelRoot ©);
|
||||||
|
|
||||||
|
virtual Node *make_copy() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void register_with_read_factory(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static TypedWriteable *make_ModelRoot(const FactoryParams ¶ms);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static TypeHandle get_class_type() {
|
||||||
|
return _type_handle;
|
||||||
|
}
|
||||||
|
static void init_type() {
|
||||||
|
ModelNode::init_type();
|
||||||
|
register_type(_type_handle, "ModelRoot",
|
||||||
|
ModelNode::get_class_type());
|
||||||
|
}
|
||||||
|
virtual TypeHandle get_type(void) const {
|
||||||
|
return get_class_type();
|
||||||
|
}
|
||||||
|
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static TypeHandle _type_handle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "modelRoot.I"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user