*** empty log message ***

This commit is contained in:
David Rose 2000-11-10 04:47:22 +00:00
parent cce8ca381d
commit f13329602f
9 changed files with 319 additions and 3 deletions

View File

@ -17,6 +17,8 @@
#include <nodeRelation.h>
#include <renderRelation.h>
#include <geomNode.h>
#include <modelRoot.h>
#include <modelNode.h>
#include <LODNode.h>
#include <sequenceNode.h>
#include <eggGroup.h>
@ -121,7 +123,7 @@ build_graph() {
load_textures();
// Now build up the scene graph.
_root = new NamedNode;
_root = new ModelRoot;
_root->set_name(_data.get_egg_filename().get_basename());
make_node(&_data, _root);
_builder.build();
@ -1158,6 +1160,16 @@ make_node(EggGroup *egg_group, NamedNode *parent) {
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 {
// A normal group; just create a normal node, and traverse.
node = new NamedNode;

View File

@ -8,13 +8,16 @@
#define SOURCES \
camera.I camera.cxx camera.h config_sgraph.cxx config_sgraph.h \
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 \
renderTraverser.I renderTraverser.cxx renderTraverser.h
#define INSTALL_HEADERS \
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
#define IGATESCAN all

View File

@ -8,6 +8,8 @@
#include "geomNode.h"
#include "camera.h"
#include "planeNode.h"
#include "modelNode.h"
#include "modelRoot.h"
#include "projectionNode.h"
#include <dconfig.h>
@ -20,9 +22,13 @@ ConfigureFn(config_sgraph) {
GeomNode::init_type();
Camera::init_type();
PlaneNode::init_type();
ModelNode::init_type();
ModelRoot::init_type();
ProjectionNode::init_type();
//Registration of writeable object's creation
//functions with BamReader's factory
GeomNode::register_with_read_factory();
ModelNode::register_with_read_factory();
ModelRoot::register_with_read_factory();
}

View 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 &copy) :
NamedNode(copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: ModelNode::Copy Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE void ModelNode::
operator = (const ModelNode &copy) {
NamedNode::operator = (copy);
}

View 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 &params) {
ModelNode *me = new ModelNode;
BamReader *manager;
Datagram packet;
parse_params(params, manager, packet);
DatagramIterator scan(packet);
me->fillin(scan, manager);
return me;
}

View 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 &copy);
INLINE void operator = (const ModelNode &copy);
virtual Node *make_copy() const;
public:
static void register_with_read_factory(void);
protected:
static TypedWriteable *make_ModelNode(const FactoryParams &params);
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

View 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 &copy) :
ModelNode(copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: ModelRoot::Copy Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE void ModelRoot::
operator = (const ModelRoot &copy) {
ModelNode::operator = (copy);
}

View 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 &params) {
ModelRoot *me = new ModelRoot;
BamReader *manager;
Datagram packet;
parse_params(params, manager, packet);
DatagramIterator scan(packet);
me->fillin(scan, manager);
return me;
}

View 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 &copy);
INLINE void operator = (const ModelRoot &copy);
virtual Node *make_copy() const;
public:
static void register_with_read_factory(void);
protected:
static TypedWriteable *make_ModelRoot(const FactoryParams &params);
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