rename out qp's
This commit is contained in:
parent
f712adeb44
commit
a23a7572a2
|
|
@ -22,7 +22,7 @@
|
|||
#include "pmap.h"
|
||||
#include "builder.h"
|
||||
#include "pandaNode.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "dcast.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -66,12 +66,12 @@ Builder::
|
|||
// with the same Node pointer have different names, then they should
|
||||
// be given two different GeomNodes.
|
||||
|
||||
class qpNodeMap : public Namable {
|
||||
class NodeMap : public Namable {
|
||||
public:
|
||||
qpNodeMap(PandaNode *node, const BuilderBucket *bucket)
|
||||
NodeMap(PandaNode *node, const BuilderBucket *bucket)
|
||||
: _node(node), _bucket(bucket) { }
|
||||
|
||||
bool operator < (const qpNodeMap &other) const {
|
||||
bool operator < (const NodeMap &other) const {
|
||||
if (_node != other._node) {
|
||||
return _node < other._node;
|
||||
}
|
||||
|
|
@ -113,9 +113,9 @@ public:
|
|||
// have different names, then two different GeomNodes
|
||||
// are created, one with each name.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpGeomNode *Builder::
|
||||
qpbuild(const string &default_name) {
|
||||
typedef pmap<qpNodeMap, qpGeomNode *> GeomNodeMap;
|
||||
GeomNode *Builder::
|
||||
build(const string &default_name) {
|
||||
typedef pmap<NodeMap, GeomNode *> GeomNodeMap;
|
||||
GeomNodeMap geom_nodes;
|
||||
|
||||
// First, build all the Geoms and create GeomNodes for them. Each
|
||||
|
|
@ -126,15 +126,15 @@ qpbuild(const string &default_name) {
|
|||
i != _buckets.end();
|
||||
++i) {
|
||||
BuilderBucket *bucket = (*i).get_bucket();
|
||||
PandaNode *node = bucket->_qpnode;
|
||||
PandaNode *node = bucket->_node;
|
||||
// const string &name = bucket->get_name();
|
||||
qpGeomNode *geom_node = NULL;
|
||||
GeomNode *geom_node = NULL;
|
||||
|
||||
if (node!=NULL && node->is_of_type(qpGeomNode::get_class_type())) {
|
||||
if (node!=NULL && node->is_of_type(GeomNode::get_class_type())) {
|
||||
// The node is a GeomNode. In this case, we simply use that
|
||||
// node. We can't separate them out by name in this case; we'll
|
||||
// just assign to it the first nonempty name we encounter.
|
||||
geom_node = DCAST(qpGeomNode, node);
|
||||
geom_node = DCAST(GeomNode, node);
|
||||
|
||||
// Since the caller already created this GeomNode and passed it
|
||||
// in, we'll leave it up to the caller to name the node and set
|
||||
|
|
@ -142,15 +142,15 @@ qpbuild(const string &default_name) {
|
|||
|
||||
} else {
|
||||
// The node is not a GeomNode, so look it up in the map.
|
||||
GeomNodeMap::iterator f = geom_nodes.find(qpNodeMap(node, bucket));
|
||||
GeomNodeMap::iterator f = geom_nodes.find(NodeMap(node, bucket));
|
||||
if (f != geom_nodes.end()) {
|
||||
geom_node = (*f).second;
|
||||
|
||||
} else {
|
||||
// No such node/name combination. Create a new one.
|
||||
geom_node = bucket->qpmake_geom_node();
|
||||
geom_node = bucket->make_geom_node();
|
||||
if (geom_node != NULL) {
|
||||
geom_nodes[qpNodeMap(node, bucket)] = geom_node;
|
||||
geom_nodes[NodeMap(node, bucket)] = geom_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -164,15 +164,15 @@ qpbuild(const string &default_name) {
|
|||
// group nodes. Save out the geom_node associated with a NULL Node;
|
||||
// this one is returned from this function.
|
||||
|
||||
qpGeomNode *base_geom_node = NULL;
|
||||
GeomNode *base_geom_node = NULL;
|
||||
|
||||
GeomNodeMap::iterator gi;
|
||||
|
||||
for (gi = geom_nodes.begin();
|
||||
gi != geom_nodes.end();
|
||||
++gi) {
|
||||
const qpNodeMap &nm = (*gi).first;
|
||||
qpGeomNode *geom_node = (*gi).second;
|
||||
const NodeMap &nm = (*gi).first;
|
||||
GeomNode *geom_node = (*gi).second;
|
||||
|
||||
PandaNode *node = nm._node;
|
||||
const string &name = nm._bucket->get_name();
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@
|
|||
#include "pset.h"
|
||||
|
||||
|
||||
class qpGeomNode;
|
||||
class GeomNode;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
|
@ -195,7 +195,7 @@ public:
|
|||
INLINE bool add_prim_nonindexed(const BuilderBucket &bucket,
|
||||
const BuilderPrimI &prim);
|
||||
|
||||
qpGeomNode *qpbuild(const string &default_name = "");
|
||||
GeomNode *build(const string &default_name = "");
|
||||
|
||||
protected:
|
||||
void add_bucket(const BuilderBucket &bucket);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "builderBucket.h"
|
||||
#include "builderFuncs.h"
|
||||
#include "builderMisc.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
|
||||
|
||||
BuilderBucket *BuilderBucket::_default_bucket = NULL;
|
||||
|
|
@ -34,7 +34,7 @@ BuilderBucket *BuilderBucket::_default_bucket = NULL;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
BuilderBucket::
|
||||
BuilderBucket() {
|
||||
_qpnode = NULL;
|
||||
_node = NULL;
|
||||
(*this) = (*get_default_bucket());
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ BuilderBucket() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
BuilderBucket::
|
||||
BuilderBucket(const BuilderBucket ©) {
|
||||
_qpnode = NULL;
|
||||
_node = NULL;
|
||||
(*this) = copy;
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ operator = (const BuilderBucket ©) {
|
|||
set_texcoords(copy._texcoords);
|
||||
set_colors(copy._colors);
|
||||
|
||||
_qpnode = copy._qpnode;
|
||||
_node = copy._node;
|
||||
_drawBin = copy._drawBin;
|
||||
_drawOrder = copy._drawOrder;
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ make_copy() const {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BuilderBucket::qpmake_geom_node
|
||||
// Function: BuilderBucket::make_geom_node
|
||||
// Access: Public, Virtual
|
||||
// Description: Called by the builder when it is time to create a new
|
||||
// GeomNode. This function should allocate and return a
|
||||
|
|
@ -111,9 +111,9 @@ make_copy() const {
|
|||
// may redefine it to return a subclass of GeomNode, or
|
||||
// to do some initialization to the node.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpGeomNode *BuilderBucket::
|
||||
qpmake_geom_node() {
|
||||
return new qpGeomNode("");
|
||||
GeomNode *BuilderBucket::
|
||||
make_geom_node() {
|
||||
return new GeomNode("");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -163,8 +163,8 @@ operator < (const BuilderBucket &other) const {
|
|||
return get_name() < other.get_name();
|
||||
}
|
||||
|
||||
if (_qpnode != other._qpnode) {
|
||||
return _qpnode < other._qpnode;
|
||||
if (_node != other._node) {
|
||||
return _node < other._node;
|
||||
}
|
||||
|
||||
if (_coords != other._coords)
|
||||
|
|
@ -197,8 +197,8 @@ void BuilderBucket::
|
|||
output(ostream &out) const {
|
||||
out << "Bucket \"" << get_name() << "\"";
|
||||
|
||||
if (_qpnode != (PandaNode *)NULL) {
|
||||
out << " attached to " << *_qpnode << "\n";
|
||||
if (_node != (PandaNode *)NULL) {
|
||||
out << " attached to " << *_node << "\n";
|
||||
}
|
||||
out << "\n";
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ output(ostream &out) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
BuilderBucket::
|
||||
BuilderBucket(int) {
|
||||
_qpnode = NULL;
|
||||
_node = NULL;
|
||||
|
||||
_drawBin = -1;
|
||||
_drawOrder = 0;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
class Geom;
|
||||
class PandaNode;
|
||||
class qpGeomNode;
|
||||
class GeomNode;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : BuilderBucket
|
||||
|
|
@ -64,7 +64,7 @@ public:
|
|||
virtual ~BuilderBucket();
|
||||
|
||||
virtual BuilderBucket *make_copy() const;
|
||||
virtual qpGeomNode *qpmake_geom_node();
|
||||
virtual GeomNode *make_geom_node();
|
||||
virtual Geom *done_geom(Geom *geom);
|
||||
void add_attrib(const RenderAttrib *attrib);
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
virtual void output(ostream &out) const;
|
||||
|
||||
PandaNode *_qpnode;
|
||||
PandaNode *_node;
|
||||
|
||||
short _drawBin;
|
||||
unsigned int _drawOrder;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#include "builderFuncs.h"
|
||||
#include "builderBucketNode.h"
|
||||
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BuilderBucketNode::add_prim
|
||||
|
|
@ -58,7 +58,7 @@ add_prim(const BuilderPrimI &prim) {
|
|||
// Returns the number of Geoms created.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int BuilderBucketNode::
|
||||
build(qpGeomNode *geom_node) const {
|
||||
build(GeomNode *geom_node) const {
|
||||
int count = 0;
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "pset.h"
|
||||
|
||||
class GeomNode;
|
||||
class qpGeomNode;
|
||||
class GeomNode;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
|
@ -57,7 +57,7 @@ public:
|
|||
INLINE bool operator == (const BuilderBucketNode &other) const;
|
||||
INLINE bool operator != (const BuilderBucketNode &other) const;
|
||||
|
||||
int build(qpGeomNode *geom_node) const;
|
||||
int build(GeomNode *geom_node) const;
|
||||
|
||||
protected:
|
||||
typedef pmultiset<BuilderPrim, less<BuilderPrim> > Prims;
|
||||
|
|
|
|||
|
|
@ -487,7 +487,7 @@ expand(const PrimType &prim, BuilderBucket &bucket, OutputIterator result) {
|
|||
template<class InputIterator, class PrimType>
|
||||
static int
|
||||
build_geoms(InputIterator first, InputIterator last,
|
||||
BuilderBucket &bucket, qpGeomNode *geom_node,
|
||||
BuilderBucket &bucket, GeomNode *geom_node,
|
||||
PrimType *) {
|
||||
if (first==last) {
|
||||
return 0;
|
||||
|
|
@ -797,7 +797,7 @@ public:
|
|||
template<class InputIterator, class PrimType>
|
||||
static int
|
||||
__mesh_and_build(InputIterator first, InputIterator last,
|
||||
BuilderBucket &bucket, qpGeomNode *geom_node,
|
||||
BuilderBucket &bucket, GeomNode *geom_node,
|
||||
PrimType *) {
|
||||
if (first==last) {
|
||||
return 0;
|
||||
|
|
@ -880,7 +880,7 @@ __mesh_and_build(InputIterator first, InputIterator last,
|
|||
template<class InputIterator, class value_type>
|
||||
int
|
||||
mesh_and_build(InputIterator first, InputIterator last,
|
||||
BuilderBucket &bucket, qpGeomNode *geom_node,
|
||||
BuilderBucket &bucket, GeomNode *geom_node,
|
||||
value_type *value_type_ptr) {
|
||||
return __mesh_and_build(first, last, bucket, geom_node, value_type_ptr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include "pvector.h"
|
||||
|
||||
class BuilderBucket;
|
||||
class qpGeomNode;
|
||||
class GeomNode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -57,7 +57,7 @@ expand(const PrimType &prim, BuilderBucket &bucket,
|
|||
template<class InputIterator>
|
||||
int
|
||||
mesh_and_build(InputIterator first, InputIterator last,
|
||||
BuilderBucket &bucket, qpGeomNode *geom_node);
|
||||
BuilderBucket &bucket, GeomNode *geom_node);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "builderFuncs.h"
|
||||
#include "builderNormalVisualizer.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
|
||||
#ifdef SUPPORT_SHOW_NORMALS
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ add_prim(const BuilderPrimI &prim) {
|
|||
}
|
||||
|
||||
void BuilderNormalVisualizer::
|
||||
show_normals(qpGeomNode *node) {
|
||||
show_normals(GeomNode *node) {
|
||||
// Ok, now we've got a bunch of normals saved up; create some geometry.
|
||||
mesh_and_build(_lines.begin(), _lines.end(), _bucket, node, (BuilderPrim *)0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
void add_prim(const BuilderPrim &prim);
|
||||
void add_prim(const BuilderPrimI &prim);
|
||||
|
||||
void show_normals(qpGeomNode *node);
|
||||
void show_normals(GeomNode *node);
|
||||
|
||||
private:
|
||||
void add_normal(const BuilderV ¢er, const BuilderN &normal);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#define SOURCES \
|
||||
animBundle.I animBundle.h \
|
||||
qpanimBundleNode.I qpanimBundleNode.h \
|
||||
animBundleNode.I animBundleNode.h \
|
||||
animChannel.I animChannel.h animChannelBase.I \
|
||||
animChannelBase.h animChannelMatrixXfmTable.I \
|
||||
animChannelMatrixXfmTable.h animChannelScalarTable.I \
|
||||
|
|
@ -20,25 +20,25 @@
|
|||
config_chan.h movingPartBase.I movingPartBase.h \
|
||||
movingPartMatrix.I movingPartMatrix.h movingPartScalar.I \
|
||||
movingPartScalar.h partBundle.I partBundle.N partBundle.h \
|
||||
qppartBundleNode.I qppartBundleNode.h \
|
||||
partBundleNode.I partBundleNode.h \
|
||||
partGroup.I partGroup.h \
|
||||
vector_PartGroupStar.h
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
animBundle.cxx \
|
||||
qpanimBundleNode.cxx \
|
||||
animBundleNode.cxx \
|
||||
animChannel.cxx \
|
||||
animChannelBase.cxx animChannelMatrixXfmTable.cxx \
|
||||
animChannelScalarTable.cxx animControl.cxx \
|
||||
animControlCollection.cxx animGroup.cxx auto_bind.cxx \
|
||||
config_chan.cxx movingPartBase.cxx movingPartMatrix.cxx \
|
||||
movingPartScalar.cxx partBundle.cxx \
|
||||
qppartBundleNode.cxx \
|
||||
partBundleNode.cxx \
|
||||
partGroup.cxx vector_PartGroupStar.cxx
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
animBundle.I animBundle.h \
|
||||
qpanimBundleNode.I qpanimBundleNode.h \
|
||||
animBundleNode.I animBundleNode.h \
|
||||
animChannel.I animChannel.h animChannelBase.I animChannelBase.h \
|
||||
animChannelFixed.I animChannelFixed.h animChannelMatrixXfmTable.I \
|
||||
animChannelMatrixXfmTable.h animChannelScalarTable.I \
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
movingPart.I movingPart.h movingPartBase.I \
|
||||
movingPartBase.h movingPartMatrix.I movingPartMatrix.h \
|
||||
movingPartScalar.I movingPartScalar.h partBundle.I partBundle.h \
|
||||
qppartBundleNode.I qppartBundleNode.h \
|
||||
partBundleNode.I partBundleNode.h \
|
||||
partGroup.I partGroup.h \
|
||||
vector_PartGroupStar.h
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@
|
|||
#ifndef ANIMBUNDLE_H
|
||||
#define ANIMBUNDLE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "animGroup.h"
|
||||
#include "pointerTo.h"
|
||||
|
||||
#include <pointerTo.h>
|
||||
class FactoryParams;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : AnimBundle
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpanimBundleNode.I
|
||||
// Filename: animBundleNode.I
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,50 +18,50 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::Constructor
|
||||
// Function: AnimBundleNode::Constructor
|
||||
// Access: Public
|
||||
// Description: The AnimBundle and its node should be constructed
|
||||
// together. Generally, the derived classes of
|
||||
// qpAnimBundleNode will automatically create a AnimBundle
|
||||
// AnimBundleNode will automatically create a AnimBundle
|
||||
// of the appropriate type, and pass it up to this
|
||||
// constructor.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpAnimBundleNode::
|
||||
qpAnimBundleNode(const string &name, AnimBundle *bundle) :
|
||||
INLINE AnimBundleNode::
|
||||
AnimBundleNode(const string &name, AnimBundle *bundle) :
|
||||
PandaNode(name),
|
||||
_bundle(bundle)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::Default Constructor
|
||||
// Function: AnimBundleNode::Default Constructor
|
||||
// Access: Protected
|
||||
// Description: For internal use only.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpAnimBundleNode::
|
||||
qpAnimBundleNode() : PandaNode("") {
|
||||
INLINE AnimBundleNode::
|
||||
AnimBundleNode() : PandaNode("") {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::Copy Constructor
|
||||
// Function: AnimBundleNode::Copy Constructor
|
||||
// Access: Protected
|
||||
// Description: Use make_copy() or copy_subgraph() to copy one of
|
||||
// these. Copying a qpAnimBundleNode will always force a
|
||||
// these. Copying a AnimBundleNode will always force a
|
||||
// deep copy of the PartGroup hierarchy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpAnimBundleNode::
|
||||
qpAnimBundleNode(const qpAnimBundleNode ©) :
|
||||
INLINE AnimBundleNode::
|
||||
AnimBundleNode(const AnimBundleNode ©) :
|
||||
PandaNode(copy),
|
||||
_bundle(copy._bundle)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::get_bundle
|
||||
// Function: AnimBundleNode::get_bundle
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE AnimBundle *qpAnimBundleNode::
|
||||
INLINE AnimBundle *AnimBundleNode::
|
||||
get_bundle() const {
|
||||
return _bundle;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpanimBundleNode.cxx
|
||||
// Filename: animBundleNode.cxx
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,17 +16,17 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpanimBundleNode.h"
|
||||
#include "animBundleNode.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
#include "bamReader.h"
|
||||
#include "bamWriter.h"
|
||||
|
||||
TypeHandle qpAnimBundleNode::_type_handle;
|
||||
TypeHandle AnimBundleNode::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::safe_to_flatten
|
||||
// Function: AnimBundleNode::safe_to_flatten
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if it is generally safe to flatten out
|
||||
// this particular kind of Node by duplicating
|
||||
|
|
@ -34,42 +34,42 @@ TypeHandle qpAnimBundleNode::_type_handle;
|
|||
// cannot be safely flattened, because the Camera
|
||||
// pointer itself is meaningful).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpAnimBundleNode::
|
||||
bool AnimBundleNode::
|
||||
safe_to_flatten() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::register_with_read_factory
|
||||
// Function: AnimBundleNode::register_with_read_factory
|
||||
// Access: Public, Static
|
||||
// Description: Tells the BamReader how to create objects of type
|
||||
// qpAnimBundleNode.
|
||||
// AnimBundleNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpAnimBundleNode::
|
||||
void AnimBundleNode::
|
||||
register_with_read_factory() {
|
||||
BamReader::get_factory()->register_factory(get_class_type(), make_from_bam);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::write_datagram
|
||||
// Function: AnimBundleNode::write_datagram
|
||||
// Access: Public, Virtual
|
||||
// Description: Writes the contents of this object to the datagram
|
||||
// for shipping out to a Bam file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpAnimBundleNode::
|
||||
void AnimBundleNode::
|
||||
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||
PandaNode::write_datagram(manager, dg);
|
||||
manager->write_pointer(dg, _bundle);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::complete_pointers
|
||||
// Function: AnimBundleNode::complete_pointers
|
||||
// Access: Public, Virtual
|
||||
// Description: Receives an array of pointers, one for each time
|
||||
// manager->read_pointer() was called in fillin().
|
||||
// Returns the number of pointers processed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int qpAnimBundleNode::
|
||||
int AnimBundleNode::
|
||||
complete_pointers(TypedWritable **p_list, BamReader* manager) {
|
||||
int pi = PandaNode::complete_pointers(p_list, manager);
|
||||
_bundle = DCAST(AnimBundle, p_list[pi++]);
|
||||
|
|
@ -77,16 +77,16 @@ complete_pointers(TypedWritable **p_list, BamReader* manager) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::make_from_bam
|
||||
// Function: AnimBundleNode::make_from_bam
|
||||
// Access: Protected, Static
|
||||
// Description: This function is called by the BamReader's factory
|
||||
// when a new object of this type is encountered
|
||||
// in the Bam file. It should create the object
|
||||
// and extract its information from the file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
TypedWritable *qpAnimBundleNode::
|
||||
TypedWritable *AnimBundleNode::
|
||||
make_from_bam(const FactoryParams ¶ms) {
|
||||
qpAnimBundleNode *node = new qpAnimBundleNode;
|
||||
AnimBundleNode *node = new AnimBundleNode;
|
||||
DatagramIterator scan;
|
||||
BamReader *manager;
|
||||
|
||||
|
|
@ -97,13 +97,13 @@ make_from_bam(const FactoryParams ¶ms) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnimBundleNode::fillin
|
||||
// Function: AnimBundleNode::fillin
|
||||
// Access: Protected
|
||||
// Description: This internal function is called by make_from_bam to
|
||||
// read in all of the relevant data from the BamFile for
|
||||
// the new PandaNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpAnimBundleNode::
|
||||
void AnimBundleNode::
|
||||
fillin(DatagramIterator &scan, BamReader* manager) {
|
||||
PandaNode::fillin(scan, manager);
|
||||
manager->read_pointer(scan);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpanimBundleNode.h
|
||||
// Filename: animBundleNode.h
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpANIMBUNDLENODE_H
|
||||
#define qpANIMBUNDLENODE_H
|
||||
#ifndef ANIMBUNDLENODE_H
|
||||
#define ANIMBUNDLENODE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
|
|
@ -27,18 +27,18 @@
|
|||
#include "dcast.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpAnimBundleNode
|
||||
// Class : AnimBundleNode
|
||||
// Description : This is a node that contains a pointer to an
|
||||
// AnimBundle. Like AnimBundleNode, it exists solely to
|
||||
// make it easy to store AnimBundles in the scene graph.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpAnimBundleNode : public PandaNode {
|
||||
class EXPCL_PANDA AnimBundleNode : public PandaNode {
|
||||
public:
|
||||
INLINE qpAnimBundleNode(const string &name, AnimBundle *bundle);
|
||||
INLINE AnimBundleNode(const string &name, AnimBundle *bundle);
|
||||
|
||||
protected:
|
||||
INLINE qpAnimBundleNode();
|
||||
INLINE qpAnimBundleNode(const qpAnimBundleNode ©);
|
||||
INLINE AnimBundleNode();
|
||||
INLINE AnimBundleNode(const AnimBundleNode ©);
|
||||
|
||||
public:
|
||||
virtual bool safe_to_flatten() const;
|
||||
|
|
@ -69,7 +69,7 @@ public:
|
|||
}
|
||||
static void init_type() {
|
||||
PandaNode::init_type();
|
||||
register_type(_type_handle, "qpAnimBundleNode",
|
||||
register_type(_type_handle, "AnimBundleNode",
|
||||
PandaNode::get_class_type());
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +77,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpanimBundleNode.I"
|
||||
#include "animBundleNode.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -319,13 +319,6 @@ fillin(DatagramIterator& scan, BamReader* manager)
|
|||
|
||||
} else {
|
||||
// Compressed channels.
|
||||
if (manager->get_file_minor_ver() < 1) {
|
||||
chan_cat.error()
|
||||
<< "Cannot read old-style quantized channels.\n";
|
||||
clear_all_tables();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!read_compressed_channels) {
|
||||
chan_cat.info()
|
||||
<< "Not reading compressed animation channels.\n";
|
||||
|
|
@ -334,11 +327,6 @@ fillin(DatagramIterator& scan, BamReader* manager)
|
|||
}
|
||||
|
||||
FFTCompressor compressor;
|
||||
if (manager->get_file_minor_ver() < 4) {
|
||||
// Prior to bam version 3.4, the quaternion code had been
|
||||
// inadvertently transposed.
|
||||
compressor.set_transpose_quats(true);
|
||||
}
|
||||
compressor.read_header(scan);
|
||||
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -258,12 +258,6 @@ fillin(DatagramIterator& scan, BamReader* manager)
|
|||
|
||||
} else {
|
||||
// Compressed channels.
|
||||
if (manager->get_file_minor_ver() < 1) {
|
||||
chan_cat.error()
|
||||
<< "Cannot read old-style quantized channels.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Did we write them as discrete or continuous channel values?
|
||||
int index_length = scan.get_uint8();
|
||||
|
||||
|
|
|
|||
|
|
@ -19,14 +19,15 @@
|
|||
#ifndef ANIMGROUP_H
|
||||
#define ANIMGROUP_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
#include <typedWritableReferenceCount.h>
|
||||
#include <pointerTo.h>
|
||||
#include <namable.h>
|
||||
#include "typedWritableReferenceCount.h"
|
||||
#include "pointerTo.h"
|
||||
#include "namable.h"
|
||||
|
||||
class AnimBundle;
|
||||
class BamReader;
|
||||
class FactoryParams;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : AnimGroup
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
|
||||
#include "auto_bind.h"
|
||||
#include "qpanimBundleNode.h"
|
||||
#include "qppartBundleNode.h"
|
||||
#include "animBundleNode.h"
|
||||
#include "partBundleNode.h"
|
||||
#include "config_chan.h"
|
||||
#include "string_utils.h"
|
||||
|
||||
typedef pset<qpAnimBundleNode *> qpAnimNodes;
|
||||
typedef pmap<string, qpAnimNodes> qpAnims;
|
||||
typedef pset<AnimBundleNode *> AnimNodes;
|
||||
typedef pmap<string, AnimNodes> Anims;
|
||||
|
||||
typedef pset<qpPartBundleNode *> qpPartNodes;
|
||||
typedef pmap<string, qpPartNodes> qpParts;
|
||||
typedef pset<PartBundleNode *> PartNodes;
|
||||
typedef pmap<string, PartNodes> Parts;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -38,16 +38,16 @@ typedef pmap<string, qpPartNodes> qpParts;
|
|||
// sense.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
static void
|
||||
qpbind_anims(const qpPartNodes &parts, const qpAnimNodes &anims,
|
||||
bind_anims(const PartNodes &parts, const AnimNodes &anims,
|
||||
AnimControlCollection &controls,
|
||||
int hierarchy_match_flags) {
|
||||
|
||||
qpPartNodes::const_iterator pni;
|
||||
PartNodes::const_iterator pni;
|
||||
|
||||
for (pni = parts.begin(); pni != parts.end(); ++pni) {
|
||||
PartBundle *part = (*pni)->get_bundle();
|
||||
|
||||
qpAnimNodes::const_iterator ani;
|
||||
AnimNodes::const_iterator ani;
|
||||
for (ani = anims.begin(); ani != anims.end(); ++ani) {
|
||||
AnimBundle *anim = (*ani)->get_bundle();
|
||||
|
||||
|
|
@ -96,13 +96,13 @@ qpbind_anims(const qpPartNodes &parts, const qpAnimNodes &anims,
|
|||
// PartBundles and AnimBundles.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
static void
|
||||
r_find_bundles(PandaNode *node, qpAnims &anims, qpParts &parts) {
|
||||
if (node->is_of_type(qpAnimBundleNode::get_class_type())) {
|
||||
qpAnimBundleNode *bn = DCAST(qpAnimBundleNode, node);
|
||||
r_find_bundles(PandaNode *node, Anims &anims, Parts &parts) {
|
||||
if (node->is_of_type(AnimBundleNode::get_class_type())) {
|
||||
AnimBundleNode *bn = DCAST(AnimBundleNode, node);
|
||||
anims[bn->get_bundle()->get_name()].insert(bn);
|
||||
|
||||
} else if (node->is_of_type(qpPartBundleNode::get_class_type())) {
|
||||
qpPartBundleNode *bn = DCAST(qpPartBundleNode, node);
|
||||
} else if (node->is_of_type(PartBundleNode::get_class_type())) {
|
||||
PartBundleNode *bn = DCAST(PartBundleNode, node);
|
||||
parts[bn->get_bundle()->get_name()].insert(bn);
|
||||
}
|
||||
|
||||
|
|
@ -127,14 +127,14 @@ void
|
|||
auto_bind(PandaNode *root_node, AnimControlCollection &controls,
|
||||
int hierarchy_match_flags) {
|
||||
// First, locate all the bundles in the subgraph.
|
||||
qpAnims anims;
|
||||
qpParts parts;
|
||||
Anims anims;
|
||||
Parts parts;
|
||||
r_find_bundles(root_node, anims, parts);
|
||||
|
||||
// Now, match up the bundles by name.
|
||||
|
||||
qpAnims::const_iterator ai = anims.begin();
|
||||
qpParts::const_iterator pi = parts.begin();
|
||||
Anims::const_iterator ai = anims.begin();
|
||||
Parts::const_iterator pi = parts.begin();
|
||||
|
||||
while (ai != anims.end() && pi != parts.end()) {
|
||||
if ((*ai).first < (*pi).first) {
|
||||
|
|
@ -147,7 +147,7 @@ auto_bind(PandaNode *root_node, AnimControlCollection &controls,
|
|||
|
||||
} else {
|
||||
// But here we have (at least one) match!
|
||||
qpbind_anims((*pi).second, (*ai).second, controls,
|
||||
bind_anims((*pi).second, (*ai).second, controls,
|
||||
hierarchy_match_flags);
|
||||
++pi;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "movingPartMatrix.cxx"
|
||||
#include "movingPartScalar.cxx"
|
||||
#include "partBundle.cxx"
|
||||
#include "qppartBundleNode.cxx"
|
||||
#include "partBundleNode.cxx"
|
||||
#include "partGroup.cxx"
|
||||
#include "vector_PartGroupStar.cxx"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "animBundle.cxx"
|
||||
#include "qpanimBundleNode.cxx"
|
||||
#include "animBundleNode.cxx"
|
||||
#include "animChannel.cxx"
|
||||
#include "animChannelBase.cxx"
|
||||
#include "animChannelMatrixXfmTable.cxx"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "config_chan.h"
|
||||
#include "animBundle.h"
|
||||
#include "qpanimBundleNode.h"
|
||||
#include "animBundleNode.h"
|
||||
#include "animChannelBase.h"
|
||||
#include "animChannelMatrixXfmTable.h"
|
||||
#include "animChannelScalarTable.h"
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
#include "movingPartMatrix.h"
|
||||
#include "movingPartScalar.h"
|
||||
#include "partBundle.h"
|
||||
#include "qppartBundleNode.h"
|
||||
#include "partBundleNode.h"
|
||||
#include "partGroup.h"
|
||||
|
||||
#include "luse.h"
|
||||
|
|
@ -78,7 +78,7 @@ bool read_compressed_channels = config_chan.GetBool("read-compressed-channels",
|
|||
|
||||
ConfigureFn(config_chan) {
|
||||
AnimBundle::init_type();
|
||||
qpAnimBundleNode::init_type();
|
||||
AnimBundleNode::init_type();
|
||||
AnimChannelBase::init_type();
|
||||
AnimChannelMatrixXfmTable::init_type();
|
||||
AnimChannelScalarTable::init_type();
|
||||
|
|
@ -88,7 +88,7 @@ ConfigureFn(config_chan) {
|
|||
MovingPartMatrix::init_type();
|
||||
MovingPartScalar::init_type();
|
||||
PartBundle::init_type();
|
||||
qpPartBundleNode::init_type();
|
||||
PartBundleNode::init_type();
|
||||
PartGroup::init_type();
|
||||
|
||||
// This isn't defined in this package, but it *is* essential that it
|
||||
|
|
@ -106,7 +106,7 @@ ConfigureFn(config_chan) {
|
|||
|
||||
AnimGroup::register_with_read_factory();
|
||||
AnimBundle::register_with_read_factory();
|
||||
qpAnimBundleNode::register_with_read_factory();
|
||||
AnimBundleNode::register_with_read_factory();
|
||||
AnimChannelMatrixXfmTable::register_with_read_factory();
|
||||
AnimChannelScalarTable::register_with_read_factory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,17 +39,6 @@ get_node() const {
|
|||
return _node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PartBundle::get_qpnode
|
||||
// Access: Published
|
||||
// Description: Returns the PartBundleNode associated with this
|
||||
// PartBundle.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpPartBundleNode *PartBundle::
|
||||
get_qpnode() const {
|
||||
return _qpnode;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PartBundle::control_begin
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@
|
|||
#include "animControl.h"
|
||||
#include "config_chan.h"
|
||||
|
||||
#include <indent.h>
|
||||
#include <datagram.h>
|
||||
#include <datagramIterator.h>
|
||||
#include <bamReader.h>
|
||||
#include <bamWriter.h>
|
||||
#include "indent.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
#include "bamReader.h"
|
||||
#include "bamWriter.h"
|
||||
|
||||
TypeHandle PartBundle::_type_handle;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
class AnimBundle;
|
||||
class PartBundleNode;
|
||||
class qpPartBundleNode;
|
||||
class PartBundleNode;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : PartBundle
|
||||
|
|
@ -94,7 +94,6 @@ PUBLISHED:
|
|||
INLINE BlendType get_blend_type() const;
|
||||
|
||||
INLINE PartBundleNode *get_node() const;
|
||||
INLINE qpPartBundleNode *get_qpnode() const;
|
||||
|
||||
void clear_control_effects();
|
||||
void set_control_effect(AnimControl *control, float effect);
|
||||
|
|
@ -133,7 +132,6 @@ protected:
|
|||
|
||||
BlendType _blend_type;
|
||||
PartBundleNode *_node;
|
||||
qpPartBundleNode *_qpnode;
|
||||
|
||||
AnimControl *_last_control_set;
|
||||
ChannelBlend _blend;
|
||||
|
|
@ -165,7 +163,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
|
||||
friend class PartBundleNode;
|
||||
friend class qpPartBundleNode;
|
||||
};
|
||||
|
||||
inline ostream &operator <<(ostream &out, const PartBundle &bundle) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qppartBundleNode.I
|
||||
// Filename: partBundleNode.I
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,52 +18,52 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::Constructor
|
||||
// Function: PartBundleNode::Constructor
|
||||
// Access: Public
|
||||
// Description: The PartBundle and its node should be constructed
|
||||
// together. Generally, the derived classes of
|
||||
// qpPartBundleNode will automatically create a PartBundle
|
||||
// PartBundleNode will automatically create a PartBundle
|
||||
// of the appropriate type, and pass it up to this
|
||||
// constructor.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpPartBundleNode::
|
||||
qpPartBundleNode(const string &name, PartBundle *bundle) :
|
||||
INLINE PartBundleNode::
|
||||
PartBundleNode(const string &name, PartBundle *bundle) :
|
||||
PandaNode(name),
|
||||
_bundle(bundle)
|
||||
{
|
||||
_bundle->_qpnode = this;
|
||||
_bundle->_node = this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::Default Constructor
|
||||
// Function: PartBundleNode::Default Constructor
|
||||
// Access: Protected
|
||||
// Description: For internal use only.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpPartBundleNode::
|
||||
qpPartBundleNode() : PandaNode("") {
|
||||
INLINE PartBundleNode::
|
||||
PartBundleNode() : PandaNode("") {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::Copy Constructor
|
||||
// Function: PartBundleNode::Copy Constructor
|
||||
// Access: Protected
|
||||
// Description: Use make_copy() or copy_subgraph() to copy one of
|
||||
// these. Copying a qpPartBundleNode will always force a
|
||||
// these. Copying a PartBundleNode will always force a
|
||||
// deep copy of the PartGroup hierarchy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpPartBundleNode::
|
||||
qpPartBundleNode(const qpPartBundleNode ©) :
|
||||
INLINE PartBundleNode::
|
||||
PartBundleNode(const PartBundleNode ©) :
|
||||
PandaNode(copy),
|
||||
_bundle(DCAST(PartBundle, copy._bundle->copy_subgraph()))
|
||||
{
|
||||
_bundle->_qpnode = this;
|
||||
_bundle->_node = this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::get_bundle
|
||||
// Function: PartBundleNode::get_bundle
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PartBundle *qpPartBundleNode::
|
||||
INLINE PartBundle *PartBundleNode::
|
||||
get_bundle() const {
|
||||
return _bundle;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qppartBundleNode.cxx
|
||||
// Filename: partBundleNode.cxx
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,17 +16,17 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qppartBundleNode.h"
|
||||
#include "partBundleNode.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
#include "bamReader.h"
|
||||
#include "bamWriter.h"
|
||||
|
||||
TypeHandle qpPartBundleNode::_type_handle;
|
||||
TypeHandle PartBundleNode::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::safe_to_flatten
|
||||
// Function: PartBundleNode::safe_to_flatten
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if it is generally safe to flatten out
|
||||
// this particular kind of Node by duplicating
|
||||
|
|
@ -34,46 +34,46 @@ TypeHandle qpPartBundleNode::_type_handle;
|
|||
// cannot be safely flattened, because the Camera
|
||||
// pointer itself is meaningful).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpPartBundleNode::
|
||||
bool PartBundleNode::
|
||||
safe_to_flatten() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::write_datagram
|
||||
// Function: PartBundleNode::write_datagram
|
||||
// Access: Public, Virtual
|
||||
// Description: Writes the contents of this object to the datagram
|
||||
// for shipping out to a Bam file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpPartBundleNode::
|
||||
void PartBundleNode::
|
||||
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||
PandaNode::write_datagram(manager, dg);
|
||||
manager->write_pointer(dg, _bundle);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::complete_pointers
|
||||
// Function: PartBundleNode::complete_pointers
|
||||
// Access: Public, Virtual
|
||||
// Description: Receives an array of pointers, one for each time
|
||||
// manager->read_pointer() was called in fillin().
|
||||
// Returns the number of pointers processed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int qpPartBundleNode::
|
||||
int PartBundleNode::
|
||||
complete_pointers(TypedWritable **p_list, BamReader* manager) {
|
||||
int pi = PandaNode::complete_pointers(p_list, manager);
|
||||
_bundle = DCAST(PartBundle, p_list[pi++]);
|
||||
_bundle->_qpnode = this;
|
||||
_bundle->_node = this;
|
||||
return pi;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpPartBundleNode::fillin
|
||||
// Function: PartBundleNode::fillin
|
||||
// Access: Protected
|
||||
// Description: This internal function is called by make_from_bam to
|
||||
// read in all of the relevant data from the BamFile for
|
||||
// the new PandaNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpPartBundleNode::
|
||||
void PartBundleNode::
|
||||
fillin(DatagramIterator &scan, BamReader* manager) {
|
||||
PandaNode::fillin(scan, manager);
|
||||
manager->read_pointer(scan);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qppartBundleNode.h
|
||||
// Filename: partBundleNode.h
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpPARTBUNDLENODE_H
|
||||
#define qpPARTBUNDLENODE_H
|
||||
#ifndef PARTBUNDLENODE_H
|
||||
#define PARTBUNDLENODE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
|
|
@ -27,18 +27,18 @@
|
|||
#include "dcast.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpPartBundleNode
|
||||
// Class : PartBundleNode
|
||||
// Description : This is a node that contains a pointer to an
|
||||
// PartBundle. Like AnimBundleNode, it exists solely to
|
||||
// make it easy to store PartBundles in the scene graph.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpPartBundleNode : public PandaNode {
|
||||
class EXPCL_PANDA PartBundleNode : public PandaNode {
|
||||
public:
|
||||
INLINE qpPartBundleNode(const string &name, PartBundle *bundle);
|
||||
INLINE PartBundleNode(const string &name, PartBundle *bundle);
|
||||
|
||||
protected:
|
||||
INLINE qpPartBundleNode();
|
||||
INLINE qpPartBundleNode(const qpPartBundleNode ©);
|
||||
INLINE PartBundleNode();
|
||||
INLINE PartBundleNode(const PartBundleNode ©);
|
||||
|
||||
public:
|
||||
virtual bool safe_to_flatten() const;
|
||||
|
|
@ -67,7 +67,7 @@ public:
|
|||
}
|
||||
static void init_type() {
|
||||
PandaNode::init_type();
|
||||
register_type(_type_handle, "qpPartBundleNode",
|
||||
register_type(_type_handle, "PartBundleNode",
|
||||
PandaNode::get_class_type());
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +75,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qppartBundleNode.I"
|
||||
#include "partBundleNode.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -19,12 +19,12 @@
|
|||
#ifndef PARTGROUP_H
|
||||
#define PARTGROUP_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
#include <typedWritableReferenceCount.h>
|
||||
#include <pointerTo.h>
|
||||
#include <namable.h>
|
||||
#include <typedef.h>
|
||||
#include "typedWritableReferenceCount.h"
|
||||
#include "pointerTo.h"
|
||||
#include "namable.h"
|
||||
#include "typedef.h"
|
||||
|
||||
#include "plist.h"
|
||||
|
||||
|
|
@ -32,6 +32,7 @@ class AnimControl;
|
|||
class AnimGroup;
|
||||
class PartBundle;
|
||||
class BamReader;
|
||||
class FactoryParams;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : PartGroup
|
||||
|
|
@ -130,7 +131,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
|
||||
friend class Character;
|
||||
friend class qpCharacter;
|
||||
};
|
||||
|
||||
#include "partGroup.I"
|
||||
|
|
|
|||
|
|
@ -16,22 +16,22 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE PandaNode *qpChanConfig::get_group_node(const int node_index) const {
|
||||
INLINE PandaNode *ChanConfig::get_group_node(const int node_index) const {
|
||||
return _group_node[node_index];
|
||||
}
|
||||
INLINE int qpChanConfig::get_group_membership(const int dr_index) const {
|
||||
INLINE int ChanConfig::get_group_membership(const int dr_index) const {
|
||||
return _group_membership[dr_index];
|
||||
}
|
||||
INLINE int qpChanConfig::get_num_groups(void) const {
|
||||
INLINE int ChanConfig::get_num_groups(void) const {
|
||||
return _group_node.size();
|
||||
}
|
||||
INLINE int qpChanConfig::get_num_drs(void) const {
|
||||
INLINE int ChanConfig::get_num_drs(void) const {
|
||||
return _display_region.size();
|
||||
}
|
||||
INLINE PT(DisplayRegion) qpChanConfig::get_dr(const int dr_index) const {
|
||||
INLINE PT(DisplayRegion) ChanConfig::get_dr(const int dr_index) const {
|
||||
return _display_region[dr_index];
|
||||
}
|
||||
INLINE PT(GraphicsWindow) qpChanConfig::get_win(void) const {
|
||||
INLINE PT(GraphicsWindow) ChanConfig::get_win(void) const {
|
||||
return _graphics_window;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "displayRegion.h"
|
||||
#include "graphicsChannel.h"
|
||||
#include "hardwareChannel.h"
|
||||
#include "qpcamera.h"
|
||||
#include "camera.h"
|
||||
#include "frustum.h"
|
||||
#include "perspectiveLens.h"
|
||||
#include "dSearchPath.h"
|
||||
|
|
@ -206,10 +206,10 @@ SetupFOV ChanResolveFOV(SetupFOV& fov, float sizeX, float sizeY) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void qpChanConfig::chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L,
|
||||
void ChanConfig::chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L,
|
||||
SVec& S,
|
||||
ChanViewport& V, int hw_offset, int xsize, int ysize,
|
||||
const qpNodePath &render, bool want_cameras) {
|
||||
const NodePath &render, bool want_cameras) {
|
||||
int i = min(L.GetNumRegions(), int(S.size()));
|
||||
int j;
|
||||
SVec::iterator k;
|
||||
|
|
@ -243,8 +243,8 @@ void qpChanConfig::chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L,
|
|||
v2.bottom(), v2.top());
|
||||
if (want_cameras && camera[0] != (PandaNode *)NULL) {
|
||||
// now make a camera for it
|
||||
PT(qpCamera) cam = new qpCamera("");
|
||||
dr->set_qpcamera(qpNodePath(cam));
|
||||
PT(Camera) cam = new Camera("");
|
||||
dr->set_camera(NodePath(cam));
|
||||
_display_region.push_back(dr);
|
||||
SetupFOV fov = (*k).getFOV();
|
||||
// The distinction between ConsoleSize and DisplaySize
|
||||
|
|
@ -322,7 +322,7 @@ void qpChanConfig::chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L,
|
|||
return;
|
||||
}
|
||||
|
||||
qpChanConfig::qpChanConfig(GraphicsPipe* pipe, std::string cfg, const qpNodePath &render,
|
||||
ChanConfig::ChanConfig(GraphicsPipe* pipe, std::string cfg, const NodePath &render,
|
||||
ChanCfgOverrides& overrides) {
|
||||
ReadChanConfigData();
|
||||
// check to make sure we know everything we need to
|
||||
|
|
@ -465,10 +465,10 @@ qpChanConfig::qpChanConfig(GraphicsPipe* pipe, std::string cfg, const qpNodePath
|
|||
float ll, rr, bb, tt;
|
||||
dr->get_dimensions(ll, rr, bb, tt);
|
||||
nout << " (" << ll << " " << rr << " " << bb << " " << tt << ")" << endl
|
||||
<< " camera = " << dr->get_qpcamera() << endl;
|
||||
qpNodePath cmm = dr->get_qpcamera();
|
||||
<< " camera = " << dr->get_camera() << endl;
|
||||
NodePath cmm = dr->get_camera();
|
||||
if (!cmm.is_empty()) {
|
||||
qpCamera *cmm_node = DCAST(qpCamera, cmm.node());
|
||||
Camera *cmm_node = DCAST(Camera, cmm.node());
|
||||
nout << " active = " << cmm_node->is_active() << endl;
|
||||
int num_cam_drs = cmm_node->get_num_display_regions();
|
||||
for (int cd = 0; cd < num_cam_drs; cd++)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "graphicsPipe.h"
|
||||
#include "graphicsWindow.h"
|
||||
#include "pandaNode.h"
|
||||
#include "qpnodePath.h"
|
||||
#include "nodePath.h"
|
||||
|
||||
#include "pmap.h"
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ extern ChanCfgOverrides ChanOverrideNone;
|
|||
|
||||
typedef pvector<SetupItem> SVec;
|
||||
|
||||
class EXPCL_PANDA qpChanConfig
|
||||
class EXPCL_PANDA ChanConfig
|
||||
{
|
||||
private:
|
||||
std::vector< PT(PandaNode) > _group_node;
|
||||
|
|
@ -112,9 +112,9 @@ private:
|
|||
PT(GraphicsWindow) _graphics_window;
|
||||
void chan_eval(GraphicsWindow* win, WindowItem& W, LayoutItem& L,
|
||||
SVec& S, ChanViewport& V, int hw_offset,
|
||||
int xsize, int ysize, const qpNodePath &render, bool want_cameras);
|
||||
int xsize, int ysize, const NodePath &render, bool want_cameras);
|
||||
PUBLISHED:
|
||||
qpChanConfig(GraphicsPipe*, std::string, const qpNodePath &render,
|
||||
ChanConfig(GraphicsPipe*, std::string, const NodePath &render,
|
||||
ChanCfgOverrides& = ChanOverrideNone);
|
||||
INLINE PandaNode *get_group_node(const int node_index) const;
|
||||
INLINE int get_group_membership(const int dr_index) const;
|
||||
|
|
|
|||
|
|
@ -10,21 +10,21 @@
|
|||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
||||
|
||||
#define SOURCES \
|
||||
qpcharacter.I qpcharacter.h \
|
||||
character.I character.h \
|
||||
characterJoint.h characterJointBundle.I \
|
||||
characterJointBundle.h characterSlider.h computedVertices.I \
|
||||
computedVertices.h computedVerticesMorph.I \
|
||||
computedVerticesMorph.h config_char.h dynamicVertices.h
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
qpcharacter.cxx \
|
||||
character.cxx \
|
||||
characterJoint.cxx characterJointBundle.cxx \
|
||||
characterSlider.cxx computedVertices.cxx \
|
||||
computedVerticesMorph.cxx config_char.cxx \
|
||||
dynamicVertices.cxx
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
qpcharacter.I qpcharacter.h \
|
||||
character.I character.h \
|
||||
characterJoint.h characterJointBundle.I \
|
||||
characterJointBundle.h characterSlider.h computedVertices.I \
|
||||
computedVertices.h computedVerticesMorph.I computedVerticesMorph.h \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "config_char.cxx"
|
||||
#include "qpcharacter.cxx"
|
||||
#include "character.cxx"
|
||||
#include "characterJoint.cxx"
|
||||
#include "characterJointBundle.cxx"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcharacter.I
|
||||
// Filename: character.I
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -19,69 +19,69 @@
|
|||
#include "characterJointBundle.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::get_bundle
|
||||
// Function: Character::get_bundle
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CharacterJointBundle *qpCharacter::
|
||||
INLINE CharacterJointBundle *Character::
|
||||
get_bundle() const {
|
||||
return DCAST(CharacterJointBundle, qpPartBundleNode::get_bundle());
|
||||
return DCAST(CharacterJointBundle, PartBundleNode::get_bundle());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::get_computed_vertices
|
||||
// Function: Character::get_computed_vertices
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ComputedVertices *qpCharacter::
|
||||
INLINE ComputedVertices *Character::
|
||||
get_computed_vertices() const {
|
||||
return _computed_vertices;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::get_num_parts
|
||||
// Function: Character::get_num_parts
|
||||
// Access: Public
|
||||
// Description: Returns the total number of moving parts (e.g. joints
|
||||
// and sliders) associated with the qpCharacter.
|
||||
// and sliders) associated with the Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpCharacter::
|
||||
INLINE int Character::
|
||||
get_num_parts() const {
|
||||
return _parts.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::get_part
|
||||
// Function: Character::get_part
|
||||
// Access: Public
|
||||
// Description: Returns the nth moving part associated with the
|
||||
// qpCharacter.
|
||||
// Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PartGroup *qpCharacter::
|
||||
INLINE PartGroup *Character::
|
||||
get_part(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_parts.size(), NULL);
|
||||
return _parts[n];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::write_parts
|
||||
// Function: Character::write_parts
|
||||
// Access: Public
|
||||
// Description: Writes a list of the qpCharacter's joints and sliders,
|
||||
// Description: Writes a list of the Character's joints and sliders,
|
||||
// in their hierchical structure, to the indicated
|
||||
// output stream.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCharacter::
|
||||
INLINE void Character::
|
||||
write_parts(ostream &out) const {
|
||||
get_bundle()->write(out, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::write_part_values
|
||||
// Function: Character::write_part_values
|
||||
// Access: Public
|
||||
// Description: Writes a list of the qpCharacter's joints and sliders,
|
||||
// Description: Writes a list of the Character's joints and sliders,
|
||||
// along with each current position, in their hierchical
|
||||
// structure, to the indicated output stream.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCharacter::
|
||||
INLINE void Character::
|
||||
write_part_values(ostream &out) const {
|
||||
get_bundle()->write_with_value(out, 0);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcharacter.cxx
|
||||
// Filename: character.cxx
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,12 +16,12 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcharacter.h"
|
||||
#include "character.h"
|
||||
#include "characterJoint.h"
|
||||
#include "computedVertices.h"
|
||||
#include "config_char.h"
|
||||
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
#include "bamReader.h"
|
||||
|
|
@ -31,20 +31,20 @@
|
|||
#include "clockObject.h"
|
||||
#include "pStatTimer.h"
|
||||
|
||||
TypeHandle qpCharacter::_type_handle;
|
||||
TypeHandle Character::_type_handle;
|
||||
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector qpCharacter::_anim_pcollector("App:Animation");
|
||||
PStatCollector Character::_anim_pcollector("App:Animation");
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::Copy Constructor
|
||||
// Function: Character::Copy Constructor
|
||||
// Access: Protected
|
||||
// Description: Use make_copy() or copy_subgraph() to copy a qpCharacter.
|
||||
// Description: Use make_copy() or copy_subgraph() to copy a Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCharacter::
|
||||
qpCharacter(const qpCharacter ©) :
|
||||
qpPartBundleNode(copy.get_name(), new CharacterJointBundle(copy.get_bundle()->get_name())),
|
||||
Character::
|
||||
Character(const Character ©) :
|
||||
PartBundleNode(copy.get_name(), new CharacterJointBundle(copy.get_bundle()->get_name())),
|
||||
_cv(DynamicVertices::deep_copy(copy._cv)),
|
||||
_computed_vertices(copy._computed_vertices),
|
||||
_parts(copy._parts),
|
||||
|
|
@ -58,57 +58,57 @@ qpCharacter(const qpCharacter ©) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::Constructor
|
||||
// Function: Character::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCharacter::
|
||||
qpCharacter(const string &name) :
|
||||
qpPartBundleNode(name, new CharacterJointBundle(name)),
|
||||
Character::
|
||||
Character(const string &name) :
|
||||
PartBundleNode(name, new CharacterJointBundle(name)),
|
||||
_char_pcollector(_anim_pcollector, name)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::Destructor
|
||||
// Function: Character::Destructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCharacter::
|
||||
~qpCharacter() {
|
||||
Character::
|
||||
~Character() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::make_copy
|
||||
// Function: Character::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description: The qpCharacter make_copy() function will make a new
|
||||
// copy of the qpCharacter, with all of its joints copied,
|
||||
// Description: The Character make_copy() function will make a new
|
||||
// copy of the Character, with all of its joints copied,
|
||||
// and with a new set of dynamic vertex arrays all ready
|
||||
// to go, but it will not copy any of the original
|
||||
// qpCharacter's geometry, so the new qpCharacter won't look
|
||||
// Character's geometry, so the new Character won't look
|
||||
// like much. Use copy_subgraph() to make a full copy
|
||||
// of the qpCharacter.
|
||||
// of the Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PandaNode *qpCharacter::
|
||||
PandaNode *Character::
|
||||
make_copy() const {
|
||||
return new qpCharacter(*this);
|
||||
return new Character(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::safe_to_transform
|
||||
// Function: Character::safe_to_transform
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if it is generally safe to transform
|
||||
// this particular kind of Node by calling the xform()
|
||||
// method, false otherwise. For instance, it's usually
|
||||
// a bad idea to attempt to xform a qpCharacter.
|
||||
// a bad idea to attempt to xform a Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCharacter::
|
||||
bool Character::
|
||||
safe_to_transform() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::has_cull_callback
|
||||
// Function: Character::has_cull_callback
|
||||
// Access: Public, Virtual
|
||||
// Description: Should be overridden by derived classes to return
|
||||
// true if cull_callback() has been defined. Otherwise,
|
||||
|
|
@ -116,13 +116,13 @@ safe_to_transform() const {
|
|||
// need to be called for this node during the cull
|
||||
// traversal.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCharacter::
|
||||
bool Character::
|
||||
has_cull_callback() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::cull_callback
|
||||
// Function: Character::cull_callback
|
||||
// Access: Public, Virtual
|
||||
// Description: If has_cull_callback() returns true, this function
|
||||
// will be called during the cull traversal to perform
|
||||
|
|
@ -140,8 +140,8 @@ has_cull_callback() const {
|
|||
// The return value is true if this node should be
|
||||
// visible, or false if it should be culled.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCharacter::
|
||||
cull_callback(qpCullTraverser *, CullTraverserData &) {
|
||||
bool Character::
|
||||
cull_callback(CullTraverser *, CullTraverserData &) {
|
||||
// For now, we update the character during the cull traversal; this
|
||||
// prevents us from needlessly updating characters that aren't in
|
||||
// the view frustum. We may need a better way to do this
|
||||
|
|
@ -159,14 +159,14 @@ cull_callback(qpCullTraverser *, CullTraverserData &) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::update
|
||||
// Function: Character::update
|
||||
// Access: Public
|
||||
// Description: Recalculates the qpCharacter's joints and vertices for
|
||||
// Description: Recalculates the Character's joints and vertices for
|
||||
// the current frame. Normally this is performed
|
||||
// automatically during the render and need not be
|
||||
// called explicitly.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
update() {
|
||||
// Statistics
|
||||
PStatTimer timer(_char_pcollector);
|
||||
|
|
@ -184,12 +184,12 @@ update() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::copy_joints
|
||||
// Function: Character::copy_joints
|
||||
// Access: Private
|
||||
// Description: Recursively walks the joint/slider hierarchy and
|
||||
// creates a new copy of the hierarchy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
copy_joints(PartGroup *copy, PartGroup *orig) {
|
||||
if (copy->get_type() != orig->get_type()) {
|
||||
char_cat.warning()
|
||||
|
|
@ -211,7 +211,7 @@ copy_joints(PartGroup *copy, PartGroup *orig) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::r_copy_children
|
||||
// Function: Character::r_copy_children
|
||||
// Access: Protected, Virtual
|
||||
// Description: This is called by r_copy_subgraph(); the copy has
|
||||
// already been made of this particular node (and this
|
||||
|
|
@ -225,16 +225,16 @@ copy_joints(PartGroup *copy, PartGroup *orig) {
|
|||
// access this map, and probably should not even
|
||||
// override this function.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
r_copy_children(const PandaNode *from, PandaNode::InstanceMap &inst_map) {
|
||||
// We assume there will be no instancing going on below the
|
||||
// qpCharacter node. If there is, too bad; it will get flattened out.
|
||||
// Character node. If there is, too bad; it will get flattened out.
|
||||
|
||||
// We preempt the node's r_copy_children() operation with our own
|
||||
// function that keeps track of the old vs. new nodes and also
|
||||
// updates any Geoms we find with our new dynamic vertices.
|
||||
|
||||
const qpCharacter *from_char;
|
||||
const Character *from_char;
|
||||
DCAST_INTO_V(from_char, from);
|
||||
NodeMap node_map;
|
||||
r_copy_char(this, from_char, from_char, node_map);
|
||||
|
|
@ -243,19 +243,19 @@ r_copy_children(const PandaNode *from, PandaNode::InstanceMap &inst_map) {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::r_copy_char
|
||||
// Function: Character::r_copy_char
|
||||
// Access: Private
|
||||
// Description: Recursively walks the scene graph hiernodehy below the
|
||||
// qpCharacter node, duplicating it while noting the
|
||||
// Character node, duplicating it while noting the
|
||||
// orig:copy node mappings, and also updates any
|
||||
// GeomNodes found.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
r_copy_char(PandaNode *dest, const PandaNode *source,
|
||||
const qpCharacter *from, qpCharacter::NodeMap &node_map) {
|
||||
const Character *from, Character::NodeMap &node_map) {
|
||||
if (source->is_geom_node()) {
|
||||
const qpGeomNode *source_gnode;
|
||||
qpGeomNode *dest_gnode;
|
||||
const GeomNode *source_gnode;
|
||||
GeomNode *dest_gnode;
|
||||
DCAST_INTO_V(source_gnode, source);
|
||||
DCAST_INTO_V(dest_gnode, dest);
|
||||
|
||||
|
|
@ -274,17 +274,17 @@ r_copy_char(PandaNode *dest, const PandaNode *source,
|
|||
int source_sort = source->get_child_sort(i);
|
||||
|
||||
PandaNode *dest_child;
|
||||
if (source_child->is_of_type(qpCharacter::get_class_type())) {
|
||||
// We make a special case for nodes of type qpCharacter. If we
|
||||
// encounter one of these, we have a qpCharacter under a
|
||||
// qpCharacter, and the nested qpCharacter's copy should be called
|
||||
if (source_child->is_of_type(Character::get_class_type())) {
|
||||
// We make a special case for nodes of type Character. If we
|
||||
// encounter one of these, we have a Character under a
|
||||
// Character, and the nested Character's copy should be called
|
||||
// instead of ours.
|
||||
dest_child = source_child->copy_subgraph();
|
||||
|
||||
} else {
|
||||
// Otherwise, we assume that make_copy() will make a suitable
|
||||
// copy of the node. This does limit the sorts of things we can
|
||||
// have parented to a qpCharacter and expect copy_subgraph() to
|
||||
// have parented to a Character and expect copy_subgraph() to
|
||||
// work correctly. Too bad.
|
||||
dest_child = source_child->make_copy();
|
||||
r_copy_char(dest_child, source_child, from, node_map);
|
||||
|
|
@ -295,15 +295,15 @@ r_copy_char(PandaNode *dest, const PandaNode *source,
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::copy_geom
|
||||
// Function: Character::copy_geom
|
||||
// Access: Private
|
||||
// Description: Makes a new copy of the Geom with the dynamic vertex
|
||||
// arrays replaced to reference this qpCharacter instead
|
||||
// arrays replaced to reference this Character instead
|
||||
// of the other one. If no arrays have changed, simply
|
||||
// returns the same Geom.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PT(Geom) qpCharacter::
|
||||
copy_geom(Geom *source, const qpCharacter *from) {
|
||||
PT(Geom) Character::
|
||||
copy_geom(Geom *source, const Character *from) {
|
||||
GeomBindType bind;
|
||||
PTA_ushort index;
|
||||
|
||||
|
|
@ -350,14 +350,14 @@ copy_geom(Geom *source, const qpCharacter *from) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::copy_node_pointers
|
||||
// Function: Character::copy_node_pointers
|
||||
// Access: Public
|
||||
// Description: Creates _net_transform_nodes and _local_transform_nodes
|
||||
// as appropriate in each of the qpCharacter's joints, as
|
||||
// copied from the other qpCharacter.
|
||||
// as appropriate in each of the Character's joints, as
|
||||
// copied from the other Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
copy_node_pointers(const qpCharacter *from, const qpCharacter::NodeMap &node_map) {
|
||||
void Character::
|
||||
copy_node_pointers(const Character *from, const Character::NodeMap &node_map) {
|
||||
nassertv(_parts.size() == from->_parts.size());
|
||||
for (int i = 0; i < (int)_parts.size(); i++) {
|
||||
if (_parts[i]->is_of_type(CharacterJoint::get_class_type())) {
|
||||
|
|
@ -378,7 +378,7 @@ copy_node_pointers(const qpCharacter *from, const qpCharacter::NodeMap &node_map
|
|||
if (mi != node_map.end()) {
|
||||
PandaNode *dest_node = (*mi).second;
|
||||
|
||||
// Here's an internal joint that the source qpCharacter was
|
||||
// Here's an internal joint that the source Character was
|
||||
// animating directly. We'll animate our corresponding
|
||||
// joint the same way.
|
||||
dest_joint->add_net_transform(dest_node);
|
||||
|
|
@ -395,7 +395,7 @@ copy_node_pointers(const qpCharacter *from, const qpCharacter::NodeMap &node_map
|
|||
if (mi != node_map.end()) {
|
||||
PandaNode *dest_node = (*mi).second;
|
||||
|
||||
// Here's an internal joint that the source qpCharacter was
|
||||
// Here's an internal joint that the source Character was
|
||||
// animating directly. We'll animate our corresponding
|
||||
// joint the same way.
|
||||
dest_joint->add_local_transform(dest_node);
|
||||
|
|
@ -407,25 +407,25 @@ copy_node_pointers(const qpCharacter *from, const qpCharacter::NodeMap &node_map
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::register_with_read_factory
|
||||
// Function: Character::register_with_read_factory
|
||||
// Access: Public, Static
|
||||
// Description: Tells the BamReader how to create objects of type
|
||||
// qpCharacter.
|
||||
// Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
register_with_read_factory() {
|
||||
BamReader::get_factory()->register_factory(get_class_type(), make_from_bam);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::write_datagram
|
||||
// Function: Character::write_datagram
|
||||
// Access: Public, Virtual
|
||||
// Description: Writes the contents of this object to the datagram
|
||||
// for shipping out to a Bam file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||
qpPartBundleNode::write_datagram(manager, dg);
|
||||
PartBundleNode::write_datagram(manager, dg);
|
||||
_cv.write_datagram(manager, dg);
|
||||
manager->write_pointer(dg, _computed_vertices);
|
||||
|
||||
|
|
@ -437,15 +437,15 @@ write_datagram(BamWriter *manager, Datagram &dg) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::complete_pointers
|
||||
// Function: Character::complete_pointers
|
||||
// Access: Public, Virtual
|
||||
// Description: Receives an array of pointers, one for each time
|
||||
// manager->read_pointer() was called in fillin().
|
||||
// Returns the number of pointers processed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int qpCharacter::
|
||||
int Character::
|
||||
complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
||||
int pi = qpPartBundleNode::complete_pointers(p_list, manager);
|
||||
int pi = PartBundleNode::complete_pointers(p_list, manager);
|
||||
_computed_vertices = DCAST(ComputedVertices, p_list[pi++]);
|
||||
|
||||
int num_parts = _parts.size();
|
||||
|
|
@ -457,16 +457,16 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::make_from_bam
|
||||
// Function: Character::make_from_bam
|
||||
// Access: Protected, Static
|
||||
// Description: This function is called by the BamReader's factory
|
||||
// when a new object of type qpCharacter is encountered
|
||||
// in the Bam file. It should create the qpCharacter
|
||||
// when a new object of type Character is encountered
|
||||
// in the Bam file. It should create the Character
|
||||
// and extract its information from the file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
TypedWritable *qpCharacter::
|
||||
TypedWritable *Character::
|
||||
make_from_bam(const FactoryParams ¶ms) {
|
||||
qpCharacter *node = new qpCharacter("");
|
||||
Character *node = new Character("");
|
||||
DatagramIterator scan;
|
||||
BamReader *manager;
|
||||
|
||||
|
|
@ -477,15 +477,15 @@ make_from_bam(const FactoryParams ¶ms) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCharacter::fillin
|
||||
// Function: Character::fillin
|
||||
// Access: Protected
|
||||
// Description: This internal function is called by make_from_bam to
|
||||
// read in all of the relevant data from the BamFile for
|
||||
// the new qpCharacter.
|
||||
// the new Character.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCharacter::
|
||||
void Character::
|
||||
fillin(DatagramIterator &scan, BamReader *manager) {
|
||||
qpPartBundleNode::fillin(scan, manager);
|
||||
PartBundleNode::fillin(scan, manager);
|
||||
_cv.fillin(scan, manager);
|
||||
manager->read_pointer(scan);
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcharacter.h
|
||||
// Filename: character.h
|
||||
// Created by: drose (06Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,14 +16,14 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCHARACTER_H
|
||||
#define qpCHARACTER_H
|
||||
#ifndef CHARACTER_H
|
||||
#define CHARACTER_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "computedVertices.h"
|
||||
|
||||
#include "qppartBundleNode.h"
|
||||
#include "partBundleNode.h"
|
||||
#include "vector_PartGroupStar.h"
|
||||
#include "pointerTo.h"
|
||||
#include "geom.h"
|
||||
|
|
@ -33,23 +33,23 @@ class CharacterJointBundle;
|
|||
class ComputedVertices;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpCharacter
|
||||
// Class : Character
|
||||
// Description : An animated character, with skeleton-morph animation
|
||||
// and either soft-skinned or hard-skinned vertices.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCharacter : public qpPartBundleNode {
|
||||
class EXPCL_PANDA Character : public PartBundleNode {
|
||||
protected:
|
||||
qpCharacter(const qpCharacter ©);
|
||||
Character(const Character ©);
|
||||
|
||||
public:
|
||||
qpCharacter(const string &name);
|
||||
virtual ~qpCharacter();
|
||||
Character(const string &name);
|
||||
virtual ~Character();
|
||||
|
||||
virtual PandaNode *make_copy() const;
|
||||
|
||||
virtual bool safe_to_transform() const;
|
||||
virtual bool has_cull_callback() const;
|
||||
virtual bool cull_callback(qpCullTraverser *trav, CullTraverserData &data);
|
||||
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
|
||||
|
||||
PUBLISHED:
|
||||
INLINE CharacterJointBundle *get_bundle() const;
|
||||
|
|
@ -70,11 +70,11 @@ private:
|
|||
|
||||
virtual void r_copy_children(const PandaNode *from, InstanceMap &inst_map);
|
||||
void r_copy_char(PandaNode *dest, const PandaNode *source,
|
||||
const qpCharacter *from, NodeMap &node_map);
|
||||
PT(Geom) copy_geom(Geom *source, const qpCharacter *from);
|
||||
void copy_node_pointers(const qpCharacter *from, const NodeMap &node_map);
|
||||
const Character *from, NodeMap &node_map);
|
||||
PT(Geom) copy_geom(Geom *source, const Character *from);
|
||||
void copy_node_pointers(const Character *from, const NodeMap &node_map);
|
||||
|
||||
// These are the actual dynamic vertex pools for this qpCharacter's
|
||||
// These are the actual dynamic vertex pools for this Character's
|
||||
// ComputedVertices--the vertices that it will recompute each frame
|
||||
// based on the soft-skinning and morphing requirements. Note that
|
||||
// we store this concretely, instead of as a pointer, just because
|
||||
|
|
@ -82,7 +82,7 @@ private:
|
|||
DynamicVertices _cv;
|
||||
|
||||
// And this is the object that animates them. It *is* a pointer, so
|
||||
// it can be shared between multiple instances of this qpCharacter.
|
||||
// it can be shared between multiple instances of this Character.
|
||||
PT(ComputedVertices) _computed_vertices;
|
||||
|
||||
// This vector is used by the ComputedVertices object to index back
|
||||
|
|
@ -113,20 +113,20 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpPartBundleNode::init_type();
|
||||
register_type(_type_handle, "qpCharacter",
|
||||
qpPartBundleNode::get_class_type());
|
||||
PartBundleNode::init_type();
|
||||
register_type(_type_handle, "Character",
|
||||
PartBundleNode::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
|
||||
friend class qpCharacterMaker;
|
||||
friend class CharacterMaker;
|
||||
friend class ComputedVerticesMaker;
|
||||
friend class ComputedVertices;
|
||||
};
|
||||
|
||||
#include "qpcharacter.I"
|
||||
#include "character.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -263,11 +263,6 @@ write_datagram(BamWriter *manager, Datagram &me)
|
|||
NodeList::iterator ni;
|
||||
MovingPartMatrix::write_datagram(manager, me);
|
||||
|
||||
// Legacy. We don't store the list of arcs any more. Remove this
|
||||
// when we go to bam version 4.0.
|
||||
me.add_uint16(0);
|
||||
me.add_uint16(0);
|
||||
|
||||
me.add_uint16(_net_transform_nodes.size());
|
||||
for(ni = _net_transform_nodes.begin();
|
||||
ni != _net_transform_nodes.end();
|
||||
|
|
@ -298,26 +293,14 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
|||
int i;
|
||||
MovingPartMatrix::fillin(scan, manager);
|
||||
|
||||
// Remove this when we go to bam 4.0.
|
||||
int num_net_arcs = scan.get_uint16();
|
||||
nassertv(num_net_arcs == 0);
|
||||
int num_local_arcs = scan.get_uint16();
|
||||
nassertv(num_local_arcs == 0);
|
||||
|
||||
if (manager->get_file_minor_ver() < 7) {
|
||||
// No _node lists before version 3.7.
|
||||
_num_net_nodes = 0;
|
||||
_num_local_nodes = 0;
|
||||
} else {
|
||||
_num_net_nodes = scan.get_uint16();
|
||||
for(i = 0; i < _num_net_nodes; i++) {
|
||||
manager->read_pointer(scan);
|
||||
}
|
||||
|
||||
_num_local_nodes = scan.get_uint16();
|
||||
for(i = 0; i < _num_local_nodes; i++) {
|
||||
manager->read_pointer(scan);
|
||||
}
|
||||
_num_net_nodes = scan.get_uint16();
|
||||
for(i = 0; i < _num_net_nodes; i++) {
|
||||
manager->read_pointer(scan);
|
||||
}
|
||||
|
||||
_num_local_nodes = scan.get_uint16();
|
||||
for(i = 0; i < _num_local_nodes; i++) {
|
||||
manager->read_pointer(scan);
|
||||
}
|
||||
|
||||
_initial_net_transform_inverse.read_datagram(scan);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public:
|
|||
// for the CharacterMaker's convenenience while creating the
|
||||
// character. It does not store any meaningful value after
|
||||
// creation is complete.
|
||||
PT(PandaNode) _qpgeom_node;
|
||||
PT(PandaNode) _geom_node;
|
||||
|
||||
// These are filled in as the joint animates.
|
||||
LMatrix4f _net_transform;
|
||||
|
|
@ -102,7 +102,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
|
||||
friend class Character;
|
||||
friend class qpCharacter;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
// #include reference, and please don't bother us about it. The line
|
||||
// must be exactly as shown.
|
||||
/* okcircular */
|
||||
#include "qpcharacter.h"
|
||||
#include "character.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CharacterJointBundle::Copy Constructor
|
||||
|
|
@ -35,12 +35,12 @@ CharacterJointBundle(const CharacterJointBundle ©) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CharacterJointBundle::get_qpnode
|
||||
// Function: CharacterJointBundle::get_node
|
||||
// Access: Public
|
||||
// Description: Returns the Character node associated with this
|
||||
// PartBundle.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCharacter *CharacterJointBundle::
|
||||
get_qpnode() const {
|
||||
return DCAST(qpCharacter, PartBundle::get_qpnode());
|
||||
INLINE Character *CharacterJointBundle::
|
||||
get_node() const {
|
||||
return DCAST(Character, PartBundle::get_node());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "partGroup.h"
|
||||
#include "animControl.h"
|
||||
|
||||
class qpCharacter;
|
||||
class Character;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : CharacterJointBundle
|
||||
|
|
@ -40,7 +40,7 @@ public:
|
|||
CharacterJointBundle(const string &name = "");
|
||||
|
||||
PUBLISHED:
|
||||
INLINE qpCharacter *get_qpnode() const;
|
||||
INLINE Character *get_node() const;
|
||||
|
||||
public:
|
||||
virtual PartGroup *make_copy() const;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "computedVertices.h"
|
||||
#include "characterJoint.h"
|
||||
#include "qpcharacter.h"
|
||||
#include "character.h"
|
||||
#include "config_char.h"
|
||||
|
||||
#include "datagram.h"
|
||||
|
|
@ -57,7 +57,7 @@ VertexTransform(const VertexTransform ©) :
|
|||
template<class ValueType, class MorphType>
|
||||
static void
|
||||
compute_morphs(ValueType *table, const pvector<MorphType> &morph_list,
|
||||
qpCharacter *character) {
|
||||
Character *character) {
|
||||
pvector<MorphType>::const_iterator mli;
|
||||
for (mli = morph_list.begin(); mli != morph_list.end(); ++mli) {
|
||||
const MorphType &morph = (*mli);
|
||||
|
|
@ -136,8 +136,8 @@ read_datagram(DatagramIterator &source)
|
|||
// etc., and the current positions of all of the joints.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ComputedVertices::
|
||||
update(qpCharacter *character) {
|
||||
nassertv(character != (qpCharacter *)NULL);
|
||||
update(Character *character) {
|
||||
nassertv(character != (Character *)NULL);
|
||||
nassertv(character->_cv._coords.size() == _orig_coords.size());
|
||||
nassertv(character->_cv._norms.size() == _orig_norms.size());
|
||||
nassertv(character->_cv._texcoords.size() == _orig_texcoords.size());
|
||||
|
|
@ -238,8 +238,8 @@ update(qpCharacter *character) {
|
|||
// etc. arrays.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ComputedVertices::
|
||||
make_orig(qpCharacter *character) {
|
||||
nassertv(character != (qpCharacter *)NULL);
|
||||
make_orig(Character *character) {
|
||||
nassertv(character != (Character *)NULL);
|
||||
|
||||
if (character->_cv._coords.empty()) {
|
||||
_orig_coords.clear();
|
||||
|
|
@ -276,7 +276,7 @@ make_orig(qpCharacter *character) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ComputedVertices::
|
||||
write(ostream &out, qpCharacter *character) const {
|
||||
write(ostream &out, Character *character) const {
|
||||
VertexTransforms::const_iterator vti;
|
||||
|
||||
out << "ComputedVertices:\n";
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "vector_ushort.h"
|
||||
#include "typedWritableReferenceCount.h"
|
||||
|
||||
class qpCharacter;
|
||||
class Character;
|
||||
class CharacterJoint;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -41,10 +41,10 @@ class EXPCL_PANDA ComputedVertices : public TypedWritableReferenceCount {
|
|||
public:
|
||||
INLINE ComputedVertices();
|
||||
|
||||
void update(qpCharacter *character);
|
||||
void make_orig(qpCharacter *character);
|
||||
void update(Character *character);
|
||||
void make_orig(Character *character);
|
||||
|
||||
void write(ostream &out, qpCharacter *character) const;
|
||||
void write(ostream &out, Character *character) const;
|
||||
|
||||
private:
|
||||
typedef vector_ushort Vertices;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
#include "config_char.h"
|
||||
#include "qpcharacter.h"
|
||||
#include "character.h"
|
||||
#include "characterJoint.h"
|
||||
#include "characterJointBundle.h"
|
||||
#include "characterSlider.h"
|
||||
|
|
@ -66,7 +66,7 @@ init_libchar() {
|
|||
}
|
||||
initialized = true;
|
||||
|
||||
qpCharacter::init_type();
|
||||
Character::init_type();
|
||||
CharacterJoint::init_type();
|
||||
CharacterJointBundle::init_type();
|
||||
CharacterSlider::init_type();
|
||||
|
|
@ -81,7 +81,7 @@ init_libchar() {
|
|||
|
||||
//Registration of writeable object's creation
|
||||
//functions with BamReader's factory
|
||||
qpCharacter::register_with_read_factory();
|
||||
Character::register_with_read_factory();
|
||||
CharacterJoint::register_with_read_factory();
|
||||
CharacterJointBundle::register_with_read_factory();
|
||||
CharacterSlider::register_with_read_factory();
|
||||
|
|
|
|||
|
|
@ -10,55 +10,55 @@
|
|||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
||||
|
||||
#define SOURCES \
|
||||
qpcollisionEntry.I qpcollisionEntry.h \
|
||||
qpcollisionHandler.h \
|
||||
qpcollisionHandlerEvent.I qpcollisionHandlerEvent.h \
|
||||
qpcollisionHandlerFloor.I qpcollisionHandlerFloor.h \
|
||||
qpcollisionHandlerPhysical.I qpcollisionHandlerPhysical.h \
|
||||
qpcollisionHandlerPusher.I qpcollisionHandlerPusher.h \
|
||||
qpcollisionHandlerQueue.h \
|
||||
qpcollisionLevelState.I qpcollisionLevelState.h \
|
||||
qpcollisionNode.I qpcollisionNode.h \
|
||||
collisionEntry.I collisionEntry.h \
|
||||
collisionHandler.h \
|
||||
collisionHandlerEvent.I collisionHandlerEvent.h \
|
||||
collisionHandlerFloor.I collisionHandlerFloor.h \
|
||||
collisionHandlerPhysical.I collisionHandlerPhysical.h \
|
||||
collisionHandlerPusher.I collisionHandlerPusher.h \
|
||||
collisionHandlerQueue.h \
|
||||
collisionLevelState.I collisionLevelState.h \
|
||||
collisionNode.I collisionNode.h \
|
||||
collisionPlane.I collisionPlane.h \
|
||||
collisionPolygon.I collisionPolygon.h collisionRay.I \
|
||||
collisionRay.h collisionSegment.I collisionSegment.h \
|
||||
collisionSolid.I collisionSolid.h collisionSphere.I \
|
||||
collisionSphere.h \
|
||||
qpcollisionTraverser.I qpcollisionTraverser.h \
|
||||
collisionTraverser.I collisionTraverser.h \
|
||||
config_collide.h
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
qpcollisionEntry.cxx \
|
||||
qpcollisionHandler.cxx \
|
||||
qpcollisionHandlerEvent.cxx \
|
||||
qpcollisionHandlerFloor.cxx \
|
||||
qpcollisionHandlerPhysical.cxx \
|
||||
qpcollisionHandlerPusher.cxx \
|
||||
qpcollisionHandlerQueue.cxx \
|
||||
qpcollisionLevelState.cxx \
|
||||
qpcollisionNode.cxx \
|
||||
collisionEntry.cxx \
|
||||
collisionHandler.cxx \
|
||||
collisionHandlerEvent.cxx \
|
||||
collisionHandlerFloor.cxx \
|
||||
collisionHandlerPhysical.cxx \
|
||||
collisionHandlerPusher.cxx \
|
||||
collisionHandlerQueue.cxx \
|
||||
collisionLevelState.cxx \
|
||||
collisionNode.cxx \
|
||||
collisionPlane.cxx \
|
||||
collisionPolygon.cxx collisionRay.cxx collisionSegment.cxx \
|
||||
collisionSolid.cxx collisionSphere.cxx \
|
||||
qpcollisionTraverser.cxx \
|
||||
collisionTraverser.cxx \
|
||||
config_collide.cxx
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
qpcollisionEntry.I qpcollisionEntry.h \
|
||||
qpcollisionHandler.h \
|
||||
qpcollisionHandlerEvent.I qpcollisionHandlerEvent.h \
|
||||
qpcollisionHandlerFloor.I qpcollisionHandlerFloor.h \
|
||||
qpcollisionHandlerPhysical.I qpcollisionHandlerPhysical.h \
|
||||
qpcollisionHandlerPusher.I qpcollisionHandlerPusher.h \
|
||||
qpcollisionHandlerQueue.h \
|
||||
qpcollisionLevelState.I qpcollisionLevelState.h \
|
||||
qpcollisionNode.I qpcollisionNode.h \
|
||||
collisionEntry.I collisionEntry.h \
|
||||
collisionHandler.h \
|
||||
collisionHandlerEvent.I collisionHandlerEvent.h \
|
||||
collisionHandlerFloor.I collisionHandlerFloor.h \
|
||||
collisionHandlerPhysical.I collisionHandlerPhysical.h \
|
||||
collisionHandlerPusher.I collisionHandlerPusher.h \
|
||||
collisionHandlerQueue.h \
|
||||
collisionLevelState.I collisionLevelState.h \
|
||||
collisionNode.I collisionNode.h \
|
||||
collisionPlane.I collisionPlane.h \
|
||||
collisionPolygon.I collisionPolygon.h collisionRay.I collisionRay.h \
|
||||
collisionSegment.I collisionSegment.h \
|
||||
collisionSolid.I collisionSolid.h collisionSphere.I \
|
||||
collisionSphere.h \
|
||||
qpcollisionTraverser.I qpcollisionTraverser.h
|
||||
collisionTraverser.I collisionTraverser.h
|
||||
|
||||
#define IGATESCAN all
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
|
||||
#include "config_collide.cxx"
|
||||
#include "qpcollisionEntry.cxx"
|
||||
#include "qpcollisionHandler.cxx"
|
||||
#include "qpcollisionHandlerEvent.cxx"
|
||||
#include "qpcollisionHandlerFloor.cxx"
|
||||
#include "qpcollisionHandlerPhysical.cxx"
|
||||
#include "qpcollisionHandlerPusher.cxx"
|
||||
#include "qpcollisionHandlerQueue.cxx"
|
||||
#include "qpcollisionLevelState.cxx"
|
||||
#include "qpcollisionNode.cxx"
|
||||
#include "collisionEntry.cxx"
|
||||
#include "collisionHandler.cxx"
|
||||
#include "collisionHandlerEvent.cxx"
|
||||
#include "collisionHandlerFloor.cxx"
|
||||
#include "collisionHandlerPhysical.cxx"
|
||||
#include "collisionHandlerPusher.cxx"
|
||||
#include "collisionHandlerQueue.cxx"
|
||||
#include "collisionLevelState.cxx"
|
||||
#include "collisionNode.cxx"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
#include "collisionSegment.cxx"
|
||||
#include "collisionSolid.cxx"
|
||||
#include "collisionSphere.cxx"
|
||||
#include "qpcollisionTraverser.cxx"
|
||||
#include "collisionTraverser.cxx"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionEntry.I
|
||||
// Filename: collisionEntry.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,28 +18,28 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::Constructor
|
||||
// Function: CollisionEntry::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCollisionEntry::
|
||||
qpCollisionEntry() {
|
||||
INLINE CollisionEntry::
|
||||
CollisionEntry() {
|
||||
_flags = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_from
|
||||
// Function: CollisionEntry::get_from
|
||||
// Access: Public
|
||||
// Description: Returns the CollisionSolid pointer for the particular
|
||||
// solid that triggered this collision.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const CollisionSolid *qpCollisionEntry::
|
||||
INLINE const CollisionSolid *CollisionEntry::
|
||||
get_from() const {
|
||||
return _from;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::has_into
|
||||
// Function: CollisionEntry::has_into
|
||||
// Access: Public
|
||||
// Description: Returns true if the "into" solid is, in fact, a
|
||||
// CollisionSolid, and its pointer is known (in which
|
||||
|
|
@ -48,13 +48,13 @@ get_from() const {
|
|||
// GeomNode, and there is no CollisionSolid pointer to
|
||||
// be retrieved.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionEntry::
|
||||
INLINE bool CollisionEntry::
|
||||
has_into() const {
|
||||
return (_into != (CollisionSolid *)NULL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into
|
||||
// Function: CollisionEntry::get_into
|
||||
// Access: Public
|
||||
// Description: Returns the CollisionSolid pointer for the particular
|
||||
// solid was collided into. This pointer might be NULL
|
||||
|
|
@ -62,145 +62,145 @@ has_into() const {
|
|||
// geometry, instead of a normal CollisionSolid
|
||||
// collision; see has_into().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const CollisionSolid *qpCollisionEntry::
|
||||
INLINE const CollisionSolid *CollisionEntry::
|
||||
get_into() const {
|
||||
return _into;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_from_node
|
||||
// Function: CollisionEntry::get_from_node
|
||||
// Access: Public
|
||||
// Description: Returns the node that contains the CollisionSolid
|
||||
// that triggered this collision. This will be a node
|
||||
// that has been added to a CollisionTraverser via
|
||||
// add_collider().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCollisionNode *qpCollisionEntry::
|
||||
INLINE CollisionNode *CollisionEntry::
|
||||
get_from_node() const {
|
||||
return _from_node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_from_space
|
||||
// Function: CollisionEntry::get_from_space
|
||||
// Access: Public
|
||||
// Description: Returns the global coordinate space of the
|
||||
// qpCollisionNode returned by get_from_node(), as of the
|
||||
// CollisionNode returned by get_from_node(), as of the
|
||||
// time of the collision. This will be equivalent to a
|
||||
// wrt() from the node to render.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LMatrix4f &qpCollisionEntry::
|
||||
INLINE const LMatrix4f &CollisionEntry::
|
||||
get_from_space() const {
|
||||
return _from_space;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into_node
|
||||
// Function: CollisionEntry::get_into_node
|
||||
// Access: Public
|
||||
// Description: Returns the node that contains the CollisionSolid
|
||||
// that was collided into. This returns a PandaNode
|
||||
// pointer instead of something more specific, because
|
||||
// it might be either a qpCollisionNode or a GeomNode.
|
||||
// it might be either a CollisionNode or a GeomNode.
|
||||
//
|
||||
// Also see get_into_node_path().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PandaNode *qpCollisionEntry::
|
||||
INLINE PandaNode *CollisionEntry::
|
||||
get_into_node() const {
|
||||
return _into_node;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into_node_path
|
||||
// Function: CollisionEntry::get_into_node_path
|
||||
// Access: Public
|
||||
// Description: Returns the qpNodePath that represents the specific
|
||||
// qpCollisionNode or GeomNode instance that was collided
|
||||
// Description: Returns the NodePath that represents the specific
|
||||
// CollisionNode or GeomNode instance that was collided
|
||||
// into. This is the same node returned by
|
||||
// get_into_node(), represented as a qpNodePath; however,
|
||||
// it may be more useful because the qpNodePath can
|
||||
// get_into_node(), represented as a NodePath; however,
|
||||
// it may be more useful because the NodePath can
|
||||
// resolve the particular instance of the node, if there
|
||||
// is more than one.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const qpNodePath &qpCollisionEntry::
|
||||
INLINE const NodePath &CollisionEntry::
|
||||
get_into_node_path() const {
|
||||
return _into_node_path;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into_space
|
||||
// Function: CollisionEntry::get_into_space
|
||||
// Access: Public
|
||||
// Description: Returns the global coordinate space of the
|
||||
// qpCollisionNode or GeomNode returned by
|
||||
// CollisionNode or GeomNode returned by
|
||||
// get_into_node(), as of the time of the collision.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LMatrix4f &qpCollisionEntry::
|
||||
INLINE const LMatrix4f &CollisionEntry::
|
||||
get_into_space() const {
|
||||
return _into_space;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_wrt_space
|
||||
// Function: CollisionEntry::get_wrt_space
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LMatrix4f &qpCollisionEntry::
|
||||
INLINE const LMatrix4f &CollisionEntry::
|
||||
get_wrt_space() const {
|
||||
return _wrt_space;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_inv_wrt_space
|
||||
// Function: CollisionEntry::get_inv_wrt_space
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LMatrix4f &qpCollisionEntry::
|
||||
INLINE const LMatrix4f &CollisionEntry::
|
||||
get_inv_wrt_space() const {
|
||||
return _inv_wrt_space;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::set_into_intersection_point
|
||||
// Function: CollisionEntry::set_into_intersection_point
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionEntry::
|
||||
INLINE void CollisionEntry::
|
||||
set_into_intersection_point(const LPoint3f &point) {
|
||||
_into_intersection_point = point;
|
||||
_flags |= F_has_into_intersection_point;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::has_into_intersection_point
|
||||
// Function: CollisionEntry::has_into_intersection_point
|
||||
// Access: Public
|
||||
// Description: Returns true if the detected collision knows its
|
||||
// intersection point in the coordinate space of the
|
||||
// collided-into object, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionEntry::
|
||||
INLINE bool CollisionEntry::
|
||||
has_into_intersection_point() const {
|
||||
return (_flags & F_has_into_intersection_point) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into_intersection_point
|
||||
// Function: CollisionEntry::get_into_intersection_point
|
||||
// Access: Public
|
||||
// Description: Returns the intersection point in the coordinate
|
||||
// space of the collided-into object. It is an error to
|
||||
// call this if has_into_intersection_point() returns
|
||||
// false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LPoint3f &qpCollisionEntry::
|
||||
INLINE const LPoint3f &CollisionEntry::
|
||||
get_into_intersection_point() const {
|
||||
nassertr(has_into_intersection_point(), _into_intersection_point);
|
||||
return _into_intersection_point;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::has_from_intersection_point
|
||||
// Function: CollisionEntry::has_from_intersection_point
|
||||
// Access: Public
|
||||
// Description: Returns true if the detected collision knows its
|
||||
// intersection point in the coordinate space of the
|
||||
// colliding object, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionEntry::
|
||||
INLINE bool CollisionEntry::
|
||||
has_from_intersection_point() const {
|
||||
// Since we derive the from_intersection_point from the
|
||||
// into_intersection_point, this is really the same question.
|
||||
|
|
@ -208,50 +208,50 @@ has_from_intersection_point() const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_from_intersection_point
|
||||
// Function: CollisionEntry::get_from_intersection_point
|
||||
// Access: Public
|
||||
// Description: Returns the intersection point in the coordinate
|
||||
// space of the colliding object. It is an error to
|
||||
// call this if has_from_intersection_point() returns
|
||||
// false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE LPoint3f qpCollisionEntry::
|
||||
INLINE LPoint3f CollisionEntry::
|
||||
get_from_intersection_point() const {
|
||||
return get_into_intersection_point() * get_inv_wrt_space();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::set_into_surface_normal
|
||||
// Function: CollisionEntry::set_into_surface_normal
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionEntry::
|
||||
INLINE void CollisionEntry::
|
||||
set_into_surface_normal(const LVector3f &normal) {
|
||||
_into_surface_normal = normal;
|
||||
_flags |= F_has_into_surface_normal;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::has_into_surface_normal
|
||||
// Function: CollisionEntry::has_into_surface_normal
|
||||
// Access: Public
|
||||
// Description: Returns true if the detected collision knows the
|
||||
// surface normal of the collided-into object at the
|
||||
// point of the collision, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionEntry::
|
||||
INLINE bool CollisionEntry::
|
||||
has_into_surface_normal() const {
|
||||
return (_flags & F_has_into_surface_normal) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into_surface_normal
|
||||
// Function: CollisionEntry::get_into_surface_normal
|
||||
// Access: Public
|
||||
// Description: Returns the surface normal of the collided-into
|
||||
// object at the point of the collision. It is an error
|
||||
// to call this if has_into_surface_normal() returns
|
||||
// false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LVector3f &qpCollisionEntry::
|
||||
INLINE const LVector3f &CollisionEntry::
|
||||
get_into_surface_normal() const {
|
||||
nassertr(has_into_surface_normal(), _into_surface_normal);
|
||||
return _into_surface_normal;
|
||||
|
|
@ -259,31 +259,31 @@ get_into_surface_normal() const {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::set_into_depth
|
||||
// Function: CollisionEntry::set_into_depth
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionEntry::
|
||||
INLINE void CollisionEntry::
|
||||
set_into_depth(float depth) {
|
||||
_into_depth = depth;
|
||||
_flags |= F_has_into_depth;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::has_into_depth
|
||||
// Function: CollisionEntry::has_into_depth
|
||||
// Access: Public
|
||||
// Description: Returns true if the collision entry knows how "deep"
|
||||
// the collision was into the collided-into object; that
|
||||
// is, how far into the surface of the collided-into
|
||||
// object the colliding object has penetrated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionEntry::
|
||||
INLINE bool CollisionEntry::
|
||||
has_into_depth() const {
|
||||
return (_flags & F_has_into_depth) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::get_into_depth
|
||||
// Function: CollisionEntry::get_into_depth
|
||||
// Access: Public
|
||||
// Description: Returns how "deep" the collision was into the
|
||||
// collided-into object; that is, how far into the
|
||||
|
|
@ -291,7 +291,7 @@ has_into_depth() const {
|
|||
// object has penetrated. It is an error to call this
|
||||
// if has_into_depth() returns false.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float qpCollisionEntry::
|
||||
INLINE float CollisionEntry::
|
||||
get_into_depth() const {
|
||||
nassertr(has_into_depth(), 0.0);
|
||||
return _into_depth;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionEntry.cxx
|
||||
// Filename: collisionEntry.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,17 +16,17 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionEntry.h"
|
||||
|
||||
TypeHandle qpCollisionEntry::_type_handle;
|
||||
TypeHandle CollisionEntry::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::Copy Constructor
|
||||
// Function: CollisionEntry::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionEntry::
|
||||
qpCollisionEntry(const qpCollisionEntry ©) :
|
||||
CollisionEntry::
|
||||
CollisionEntry(const CollisionEntry ©) :
|
||||
_from(copy._from),
|
||||
_into(copy._into),
|
||||
_from_node(copy._from_node),
|
||||
|
|
@ -44,12 +44,12 @@ qpCollisionEntry(const qpCollisionEntry ©) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionEntry::Copy Assignment Operator
|
||||
// Function: CollisionEntry::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionEntry::
|
||||
operator = (const qpCollisionEntry ©) {
|
||||
void CollisionEntry::
|
||||
operator = (const CollisionEntry ©) {
|
||||
_from = copy._from;
|
||||
_into = copy._into;
|
||||
_from_node = copy._from_node;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionEntry.h
|
||||
// Filename: collisionEntry.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,47 +16,47 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONENTRY_H
|
||||
#define qpCOLLISIONENTRY_H
|
||||
#ifndef COLLISIONENTRY_H
|
||||
#define COLLISIONENTRY_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "collisionSolid.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "collisionNode.h"
|
||||
|
||||
#include "typedReferenceCount.h"
|
||||
#include "luse.h"
|
||||
#include "pointerTo.h"
|
||||
#include "pandaNode.h"
|
||||
#include "qpnodePath.h"
|
||||
#include "nodePath.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionEntry
|
||||
// Class : CollisionEntry
|
||||
// Description : Defines a single collision event. One of these is
|
||||
// created for each collision detected by a
|
||||
// CollisionTraverser, to be dealt with by the
|
||||
// CollisionHandler.
|
||||
//
|
||||
// A qpCollisionEntry provides slots for a number of data
|
||||
// A CollisionEntry provides slots for a number of data
|
||||
// values (such as intersection point and normal) that
|
||||
// might or might not be known for each collision. It
|
||||
// is up to the handler to determine what information is
|
||||
// known and to do the right thing with it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionEntry : public TypedReferenceCount {
|
||||
class EXPCL_PANDA CollisionEntry : public TypedReferenceCount {
|
||||
public:
|
||||
INLINE qpCollisionEntry();
|
||||
qpCollisionEntry(const qpCollisionEntry ©);
|
||||
void operator = (const qpCollisionEntry ©);
|
||||
INLINE CollisionEntry();
|
||||
CollisionEntry(const CollisionEntry ©);
|
||||
void operator = (const CollisionEntry ©);
|
||||
|
||||
PUBLISHED:
|
||||
INLINE const CollisionSolid *get_from() const;
|
||||
INLINE bool has_into() const;
|
||||
INLINE const CollisionSolid *get_into() const;
|
||||
|
||||
INLINE qpCollisionNode *get_from_node() const;
|
||||
INLINE CollisionNode *get_from_node() const;
|
||||
INLINE PandaNode *get_into_node() const;
|
||||
INLINE const qpNodePath &get_into_node_path() const;
|
||||
INLINE const NodePath &get_into_node_path() const;
|
||||
|
||||
INLINE const LMatrix4f &get_from_space() const;
|
||||
INLINE const LMatrix4f &get_into_space() const;
|
||||
|
|
@ -82,9 +82,9 @@ private:
|
|||
CPT(CollisionSolid) _from;
|
||||
CPT(CollisionSolid) _into;
|
||||
|
||||
PT(qpCollisionNode) _from_node;
|
||||
PT(CollisionNode) _from_node;
|
||||
PT(PandaNode) _into_node;
|
||||
qpNodePath _into_node_path;
|
||||
NodePath _into_node_path;
|
||||
LMatrix4f _from_space;
|
||||
LMatrix4f _into_space;
|
||||
LMatrix4f _wrt_space;
|
||||
|
|
@ -108,7 +108,7 @@ public:
|
|||
}
|
||||
static void init_type() {
|
||||
TypedReferenceCount::init_type();
|
||||
register_type(_type_handle, "qpCollisionEntry",
|
||||
register_type(_type_handle, "CollisionEntry",
|
||||
TypedReferenceCount::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
@ -119,10 +119,10 @@ public:
|
|||
private:
|
||||
static TypeHandle _type_handle;
|
||||
|
||||
friend class qpCollisionTraverser;
|
||||
friend class CollisionTraverser;
|
||||
};
|
||||
|
||||
#include "qpcollisionEntry.I"
|
||||
#include "collisionEntry.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandler.cxx
|
||||
// Filename: collisionHandler.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,34 +16,34 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "collisionHandler.h"
|
||||
|
||||
TypeHandle qpCollisionHandler::_type_handle;
|
||||
TypeHandle CollisionHandler::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandler::begin_group
|
||||
// Function: CollisionHandler::begin_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Will be called by the CollisionTraverser before a new
|
||||
// traversal is begun. It instructs the handler to
|
||||
// reset itself in preparation for a number of
|
||||
// CollisionEntries to be sent.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandler::
|
||||
void CollisionHandler::
|
||||
begin_group() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandler::add_entry
|
||||
// Function: CollisionHandler::add_entry
|
||||
// Access: Public, Virtual
|
||||
// Description: Called between a begin_group() .. end_group()
|
||||
// sequence for each collision that is detected.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandler::
|
||||
add_entry(qpCollisionEntry *) {
|
||||
void CollisionHandler::
|
||||
add_entry(CollisionEntry *) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandler::end_group
|
||||
// Function: CollisionHandler::end_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Called by the CollisionTraverser at the completion of
|
||||
// all collision detections for this traversal. It
|
||||
|
|
@ -52,10 +52,10 @@ add_entry(qpCollisionEntry *) {
|
|||
//
|
||||
// The return value is normally true, but if this
|
||||
// returns value, the CollisionTraverser will remove the
|
||||
// handler from its list, allowing the qpCollisionHandler
|
||||
// handler from its list, allowing the CollisionHandler
|
||||
// itself to determine when it is no longer needed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandler::
|
||||
bool CollisionHandler::
|
||||
end_group() {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandler.h
|
||||
// Filename: collisionHandler.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,27 +16,27 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONHANDLER_H
|
||||
#define qpCOLLISIONHANDLER_H
|
||||
#ifndef COLLISIONHANDLER_H
|
||||
#define COLLISIONHANDLER_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "typedReferenceCount.h"
|
||||
|
||||
class qpCollisionEntry;
|
||||
class CollisionEntry;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionHandler
|
||||
// Class : CollisionHandler
|
||||
// Description : The abstract interface to a number of classes that
|
||||
// decide what to do what a collision is detected. One
|
||||
// of these must be assigned to the CollisionTraverser
|
||||
// that is processing collisions in order to specify how
|
||||
// to dispatch detected collisions.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionHandler : public TypedReferenceCount {
|
||||
class EXPCL_PANDA CollisionHandler : public TypedReferenceCount {
|
||||
public:
|
||||
virtual void begin_group();
|
||||
virtual void add_entry(qpCollisionEntry *entry);
|
||||
virtual void add_entry(CollisionEntry *entry);
|
||||
virtual bool end_group();
|
||||
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ PUBLISHED:
|
|||
public:
|
||||
static void init_type() {
|
||||
TypedReferenceCount::init_type();
|
||||
register_type(_type_handle, "qpCollisionHandler",
|
||||
register_type(_type_handle, "CollisionHandler",
|
||||
TypedReferenceCount::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerEvent.I
|
||||
// Filename: collisionHandlerEvent.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,15 +18,15 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::SortEntries::operator ()
|
||||
// Function: CollisionHandlerEvent::SortEntries::operator ()
|
||||
// Access: Public
|
||||
// Description: Orders the CollisionEntries in the set so that there
|
||||
// is one entry for each node/node intersection
|
||||
// detected.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionHandlerEvent::SortEntries::
|
||||
operator () (const PT(qpCollisionEntry) &a,
|
||||
const PT(qpCollisionEntry) &b) const {
|
||||
INLINE bool CollisionHandlerEvent::SortEntries::
|
||||
operator () (const PT(CollisionEntry) &a,
|
||||
const PT(CollisionEntry) &b) const {
|
||||
if (a->get_from_node() != b->get_from_node()) {
|
||||
return a->get_from_node() < b->get_from_node();
|
||||
}
|
||||
|
|
@ -37,19 +37,19 @@ operator () (const PT(qpCollisionEntry) &a,
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::SortEntries::operator =
|
||||
// Function: CollisionHandlerEvent::SortEntries::operator =
|
||||
// Access: Public
|
||||
// Description: The assignment operator does absolutely nothing,
|
||||
// since this is just a function object class that
|
||||
// stores no data. We define it just to quiet up g++ in
|
||||
// -Wall mode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerEvent::SortEntries::
|
||||
operator = (const qpCollisionHandlerEvent::SortEntries &) {
|
||||
INLINE void CollisionHandlerEvent::SortEntries::
|
||||
operator = (const CollisionHandlerEvent::SortEntries &) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::set_in_pattern
|
||||
// Function: CollisionHandlerEvent::set_in_pattern
|
||||
// Access: Public
|
||||
// Description: Sets the pattern string that indicates how the event
|
||||
// names are generated for each collision detected.
|
||||
|
|
@ -73,25 +73,25 @@ operator = (const qpCollisionHandlerEvent::SortEntries &) {
|
|||
// in which the collision is no longer detected, the
|
||||
// out_pattern event is thrown.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerEvent::
|
||||
INLINE void CollisionHandlerEvent::
|
||||
set_in_pattern(const string &in_pattern) {
|
||||
_in_pattern = in_pattern;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::get_in_pattern
|
||||
// Function: CollisionHandlerEvent::get_in_pattern
|
||||
// Access: Public
|
||||
// Description: Returns the pattern string that indicates how the
|
||||
// event names are generated for each collision
|
||||
// detected. See set_in_pattern().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string qpCollisionHandlerEvent::
|
||||
INLINE string CollisionHandlerEvent::
|
||||
get_in_pattern() const {
|
||||
return _in_pattern;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::set_again_pattern
|
||||
// Function: CollisionHandlerEvent::set_again_pattern
|
||||
// Access: Public
|
||||
// Description: Sets the pattern string that indicates how the event
|
||||
// names are generated when a collision between two
|
||||
|
|
@ -108,27 +108,27 @@ get_in_pattern() const {
|
|||
// in which the collision is no longer detected, the
|
||||
// out_pattern event is thrown.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerEvent::
|
||||
INLINE void CollisionHandlerEvent::
|
||||
set_again_pattern(const string &again_pattern) {
|
||||
_again_pattern = again_pattern;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::get_again_pattern
|
||||
// Function: CollisionHandlerEvent::get_again_pattern
|
||||
// Access: Public
|
||||
// Description: Returns the pattern string that indicates how the
|
||||
// event names are generated when a collision between
|
||||
// two particular nodes is *still* detected. See
|
||||
// set_again_pattern() and set_in_pattern().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string qpCollisionHandlerEvent::
|
||||
INLINE string CollisionHandlerEvent::
|
||||
get_again_pattern() const {
|
||||
return _again_pattern;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::set_out_pattern
|
||||
// Function: CollisionHandlerEvent::set_out_pattern
|
||||
// Access: Public
|
||||
// Description: Sets the pattern string that indicates how the event
|
||||
// names are generated when a collision between two
|
||||
|
|
@ -142,20 +142,20 @@ get_again_pattern() const {
|
|||
// in which the collision is no longer detected, the
|
||||
// out_pattern event is thrown.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerEvent::
|
||||
INLINE void CollisionHandlerEvent::
|
||||
set_out_pattern(const string &out_pattern) {
|
||||
_out_pattern = out_pattern;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::get_out_pattern
|
||||
// Function: CollisionHandlerEvent::get_out_pattern
|
||||
// Access: Public
|
||||
// Description: Returns the pattern string that indicates how the
|
||||
// event names are generated when a collision between
|
||||
// two particular nodes is *no longer* detected. See
|
||||
// set_out_pattern() and set_in_pattern().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE string qpCollisionHandlerEvent::
|
||||
INLINE string CollisionHandlerEvent::
|
||||
get_out_pattern() const {
|
||||
return _out_pattern;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerEvent.cxx
|
||||
// Filename: collisionHandlerEvent.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -17,35 +17,35 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "qpcollisionHandlerEvent.h"
|
||||
#include "collisionHandlerEvent.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "eventParameter.h"
|
||||
#include "throw_event.h"
|
||||
|
||||
|
||||
TypeHandle qpCollisionHandlerEvent::_type_handle;
|
||||
TypeHandle CollisionHandlerEvent::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::Constructor
|
||||
// Function: CollisionHandlerEvent::Constructor
|
||||
// Access: Public
|
||||
// Description: The default qpCollisionHandlerEvent will throw no
|
||||
// Description: The default CollisionHandlerEvent will throw no
|
||||
// events. Its pattern strings must first be set via a
|
||||
// call to set_in_pattern() and/or set_out_pattern().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerEvent::
|
||||
qpCollisionHandlerEvent() {
|
||||
CollisionHandlerEvent::
|
||||
CollisionHandlerEvent() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::begin_group
|
||||
// Function: CollisionHandlerEvent::begin_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Will be called by the CollisionTraverser before a new
|
||||
// traversal is begun. It instructs the handler to
|
||||
// reset itself in preparation for a number of
|
||||
// CollisionEntries to be sent.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerEvent::
|
||||
void CollisionHandlerEvent::
|
||||
begin_group() {
|
||||
if (collide_cat.is_spam()) {
|
||||
collide_cat.spam()
|
||||
|
|
@ -56,14 +56,14 @@ begin_group() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::add_entry
|
||||
// Function: CollisionHandlerEvent::add_entry
|
||||
// Access: Public, Virtual
|
||||
// Description: Called between a begin_group() .. end_group()
|
||||
// sequence for each collision that is detected.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerEvent::
|
||||
add_entry(qpCollisionEntry *entry) {
|
||||
nassertv(entry != (qpCollisionEntry *)NULL);
|
||||
void CollisionHandlerEvent::
|
||||
add_entry(CollisionEntry *entry) {
|
||||
nassertv(entry != (CollisionEntry *)NULL);
|
||||
|
||||
// Record this particular entry for later. This will keep track of
|
||||
// all the unique pairs of node/node intersections.
|
||||
|
|
@ -78,14 +78,14 @@ add_entry(qpCollisionEntry *entry) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::end_group
|
||||
// Function: CollisionHandlerEvent::end_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Called by the CollisionTraverser at the completion of
|
||||
// all collision detections for this traversal. It
|
||||
// should do whatever finalization is required for the
|
||||
// handler.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandlerEvent::
|
||||
bool CollisionHandlerEvent::
|
||||
end_group() {
|
||||
// Now compare the list of entries we collected this frame with
|
||||
// those we kept from the last time. Each new entry represents a
|
||||
|
|
@ -144,7 +144,7 @@ end_group() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::clear
|
||||
// Function: CollisionHandlerEvent::clear
|
||||
// Access: Public
|
||||
// Description: Empties the list of elements that all colliders are
|
||||
// known to be colliding with. No "out" events will be
|
||||
|
|
@ -158,19 +158,19 @@ end_group() {
|
|||
// used to set the event that is thrown when a collision
|
||||
// is detected for two or more consecutive frames.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerEvent::
|
||||
void CollisionHandlerEvent::
|
||||
clear() {
|
||||
_last_colliding.clear();
|
||||
_current_colliding.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerEvent::throw_event_pattern
|
||||
// Function: CollisionHandlerEvent::throw_event_pattern
|
||||
// Access: Private
|
||||
// Description: Throws an event matching the indicated pattern.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerEvent::
|
||||
throw_event_pattern(const string &pattern, qpCollisionEntry *entry) {
|
||||
void CollisionHandlerEvent::
|
||||
throw_event_pattern(const string &pattern, CollisionEntry *entry) {
|
||||
if (pattern.empty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerEvent.h
|
||||
// Filename: collisionHandlerEvent.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,33 +16,33 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONHANDLEREVENT_H
|
||||
#define qpCOLLISIONHANDLEREVENT_H
|
||||
#ifndef COLLISIONHANDLEREVENT_H
|
||||
#define COLLISIONHANDLEREVENT_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionNode.h"
|
||||
#include "collisionEntry.h"
|
||||
|
||||
#include "pointerTo.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionHandlerEvent
|
||||
// Description : A specialized kind of qpCollisionHandler that throws an
|
||||
// Class : CollisionHandlerEvent
|
||||
// Description : A specialized kind of CollisionHandler that throws an
|
||||
// event for each collision detected. The event thrown
|
||||
// may be based on the name of the moving object or the
|
||||
// struck object, or both. The first parameter of the
|
||||
// event will be a pointer to the qpCollisionEntry that
|
||||
// event will be a pointer to the CollisionEntry that
|
||||
// triggered it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionHandlerEvent : public qpCollisionHandler {
|
||||
class EXPCL_PANDA CollisionHandlerEvent : public CollisionHandler {
|
||||
PUBLISHED:
|
||||
qpCollisionHandlerEvent();
|
||||
CollisionHandlerEvent();
|
||||
|
||||
public:
|
||||
virtual void begin_group();
|
||||
virtual void add_entry(qpCollisionEntry *entry);
|
||||
virtual void add_entry(CollisionEntry *entry);
|
||||
virtual bool end_group();
|
||||
|
||||
PUBLISHED:
|
||||
|
|
@ -56,7 +56,7 @@ PUBLISHED:
|
|||
void clear();
|
||||
|
||||
private:
|
||||
void throw_event_pattern(const string &pattern, qpCollisionEntry *entry);
|
||||
void throw_event_pattern(const string &pattern, CollisionEntry *entry);
|
||||
|
||||
string _in_pattern;
|
||||
string _again_pattern;
|
||||
|
|
@ -67,12 +67,12 @@ private:
|
|||
class SortEntries {
|
||||
public:
|
||||
INLINE bool
|
||||
operator () (const PT(qpCollisionEntry) &a,
|
||||
const PT(qpCollisionEntry) &b) const;
|
||||
operator () (const PT(CollisionEntry) &a,
|
||||
const PT(CollisionEntry) &b) const;
|
||||
INLINE void operator = (const SortEntries &other);
|
||||
};
|
||||
|
||||
typedef pset<PT(qpCollisionEntry), SortEntries> Colliding;
|
||||
typedef pset<PT(CollisionEntry), SortEntries> Colliding;
|
||||
Colliding _current_colliding;
|
||||
Colliding _last_colliding;
|
||||
|
||||
|
|
@ -81,9 +81,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpCollisionHandler::init_type();
|
||||
register_type(_type_handle, "qpCollisionHandlerEvent",
|
||||
qpCollisionHandler::get_class_type());
|
||||
CollisionHandler::init_type();
|
||||
register_type(_type_handle, "CollisionHandlerEvent",
|
||||
CollisionHandler::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -94,7 +94,7 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpcollisionHandlerEvent.I"
|
||||
#include "collisionHandlerEvent.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerFloor.I
|
||||
// Filename: collisionHandlerFloor.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,50 +18,50 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::set_offset
|
||||
// Function: CollisionHandlerFloor::set_offset
|
||||
// Access: Public
|
||||
// Description: Sets the linear offset to add to (or subtract from)
|
||||
// the highest detected collision point to determine the
|
||||
// actual height at which to set the collider.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerFloor::
|
||||
INLINE void CollisionHandlerFloor::
|
||||
set_offset(float offset) {
|
||||
_offset = offset;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::get_offset
|
||||
// Function: CollisionHandlerFloor::get_offset
|
||||
// Access: Public
|
||||
// Description: Returns the linear offset to add to (or subtract from)
|
||||
// the highest detected collision point to determine the
|
||||
// actual height at which to set the collider.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float qpCollisionHandlerFloor::
|
||||
INLINE float CollisionHandlerFloor::
|
||||
get_offset() const {
|
||||
return _offset;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::set_max_velocity
|
||||
// Function: CollisionHandlerFloor::set_max_velocity
|
||||
// Access: Public
|
||||
// Description: Sets the maximum speed at which the object will be
|
||||
// allowed to descend towards a floor below it, in units
|
||||
// per second. Set this to zero to allow it to
|
||||
// instantly teleport any distance.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerFloor::
|
||||
INLINE void CollisionHandlerFloor::
|
||||
set_max_velocity(float max_velocity) {
|
||||
_max_velocity = max_velocity;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::get_max_velocity
|
||||
// Function: CollisionHandlerFloor::get_max_velocity
|
||||
// Access: Public
|
||||
// Description: Retrieves the maximum speed at which the object will
|
||||
// be allowed to descend towards a floor below it, in
|
||||
// units per second. See set_max_velocity().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float qpCollisionHandlerFloor::
|
||||
INLINE float CollisionHandlerFloor::
|
||||
get_max_velocity() const {
|
||||
return _max_velocity;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerFloor.cxx
|
||||
// Filename: collisionHandlerFloor.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,37 +16,37 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionHandlerFloor.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandlerFloor.h"
|
||||
#include "collisionNode.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "clockObject.h"
|
||||
|
||||
TypeHandle qpCollisionHandlerFloor::_type_handle;
|
||||
TypeHandle CollisionHandlerFloor::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::Constructor
|
||||
// Function: CollisionHandlerFloor::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerFloor::
|
||||
qpCollisionHandlerFloor() {
|
||||
CollisionHandlerFloor::
|
||||
CollisionHandlerFloor() {
|
||||
_offset = 0.0f;
|
||||
_max_velocity = 0.0f;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::Destructor
|
||||
// Function: CollisionHandlerFloor::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerFloor::
|
||||
~qpCollisionHandlerFloor() {
|
||||
CollisionHandlerFloor::
|
||||
~CollisionHandlerFloor() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerFloor::handle_entries
|
||||
// Function: CollisionHandlerFloor::handle_entries
|
||||
// Access: Protected, Virtual
|
||||
// Description: Called by the parent class after all collisions have
|
||||
// been detected, this manages the various collisions
|
||||
|
|
@ -56,21 +56,21 @@ qpCollisionHandlerFloor::
|
|||
// false to indicate the CollisionTraverser should
|
||||
// disable this handler from being called in the future.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandlerFloor::
|
||||
bool CollisionHandlerFloor::
|
||||
handle_entries() {
|
||||
bool okflag = true;
|
||||
|
||||
FromEntries::const_iterator fi;
|
||||
for (fi = _from_entries.begin(); fi != _from_entries.end(); ++fi) {
|
||||
qpCollisionNode *from_node = (*fi).first;
|
||||
nassertr(from_node != (qpCollisionNode *)NULL, false);
|
||||
CollisionNode *from_node = (*fi).first;
|
||||
nassertr(from_node != (CollisionNode *)NULL, false);
|
||||
const Entries &entries = (*fi).second;
|
||||
|
||||
Colliders::iterator ci;
|
||||
ci = _colliders.find(from_node);
|
||||
if (ci == _colliders.end()) {
|
||||
// Hmm, someone added a qpCollisionNode to a traverser and gave
|
||||
// it this qpCollisionHandler pointer--but they didn't tell us
|
||||
// Hmm, someone added a CollisionNode to a traverser and gave
|
||||
// it this CollisionHandler pointer--but they didn't tell us
|
||||
// about the node.
|
||||
collide_cat.error()
|
||||
<< get_type() << " doesn't know about "
|
||||
|
|
@ -92,8 +92,8 @@ handle_entries() {
|
|||
|
||||
Entries::const_iterator ei;
|
||||
for (ei = entries.begin(); ei != entries.end(); ++ei) {
|
||||
qpCollisionEntry *entry = (*ei);
|
||||
nassertr(entry != (qpCollisionEntry *)NULL, false);
|
||||
CollisionEntry *entry = (*ei);
|
||||
nassertr(entry != (CollisionEntry *)NULL, false);
|
||||
nassertr(from_node == entry->get_from_node(), false);
|
||||
|
||||
if (entry->has_from_intersection_point()) {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerFloor.h
|
||||
// Filename: collisionHandlerFloor.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,26 +16,26 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONHANDLERFLOOR_H
|
||||
#define qpCOLLISIONHANDLERFLOOR_H
|
||||
#ifndef COLLISIONHANDLERFLOOR_H
|
||||
#define COLLISIONHANDLERFLOOR_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "qpcollisionHandlerPhysical.h"
|
||||
#include "collisionHandlerPhysical.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionHandlerFloor
|
||||
// Description : A specialized kind of qpCollisionHandler that sets the
|
||||
// Class : CollisionHandlerFloor
|
||||
// Description : A specialized kind of CollisionHandler that sets the
|
||||
// Z height of the collider to a fixed linear offset
|
||||
// from the highest detected collision point each frame.
|
||||
// It's intended to implement walking around on a floor
|
||||
// of varying height by casting a ray down from the
|
||||
// avatar's head.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionHandlerFloor : public qpCollisionHandlerPhysical {
|
||||
class EXPCL_PANDA CollisionHandlerFloor : public CollisionHandlerPhysical {
|
||||
PUBLISHED:
|
||||
qpCollisionHandlerFloor();
|
||||
virtual ~qpCollisionHandlerFloor();
|
||||
CollisionHandlerFloor();
|
||||
virtual ~CollisionHandlerFloor();
|
||||
|
||||
INLINE void set_offset(float offset);
|
||||
INLINE float get_offset() const;
|
||||
|
|
@ -56,9 +56,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpCollisionHandlerPhysical::init_type();
|
||||
register_type(_type_handle, "qpCollisionHandlerFloor",
|
||||
qpCollisionHandlerPhysical::get_class_type());
|
||||
CollisionHandlerPhysical::init_type();
|
||||
register_type(_type_handle, "CollisionHandlerFloor",
|
||||
CollisionHandlerPhysical::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -69,7 +69,7 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpcollisionHandlerFloor.I"
|
||||
#include "collisionHandlerFloor.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerPhysical.I
|
||||
// Filename: collisionHandlerPhysical.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,35 +18,35 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::ColliderDef::set_drive_interface
|
||||
// Function: CollisionHandlerPhysical::ColliderDef::set_drive_interface
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerPhysical::ColliderDef::
|
||||
set_drive_interface(qpDriveInterface *drive_interface) {
|
||||
INLINE void CollisionHandlerPhysical::ColliderDef::
|
||||
set_drive_interface(DriveInterface *drive_interface) {
|
||||
_drive_interface = drive_interface;
|
||||
_node.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::ColliderDef::set_node
|
||||
// Function: CollisionHandlerPhysical::ColliderDef::set_node
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerPhysical::ColliderDef::
|
||||
INLINE void CollisionHandlerPhysical::ColliderDef::
|
||||
set_node(PandaNode *node) {
|
||||
_node = node;
|
||||
_drive_interface.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::ColliderDef::is_valid
|
||||
// Function: CollisionHandlerPhysical::ColliderDef::is_valid
|
||||
// Access: Public
|
||||
// Description: Returns true if this ColliderDef is still valid;
|
||||
// e.g. it refers to a valid node or drive interface.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionHandlerPhysical::ColliderDef::
|
||||
INLINE bool CollisionHandlerPhysical::ColliderDef::
|
||||
is_valid() const {
|
||||
return (_node != (PandaNode *)NULL) ||
|
||||
(_drive_interface != (qpDriveInterface *)NULL);
|
||||
(_drive_interface != (DriveInterface *)NULL);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerPhysical.cxx
|
||||
// Filename: collisionHandlerPhysical.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,97 +16,97 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionHandlerPhysical.h"
|
||||
#include "collisionHandlerPhysical.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "transformState.h"
|
||||
|
||||
TypeHandle qpCollisionHandlerPhysical::_type_handle;
|
||||
TypeHandle CollisionHandlerPhysical::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::ColliderDef::get_mat
|
||||
// Function: CollisionHandlerPhysical::ColliderDef::get_mat
|
||||
// Access: Public
|
||||
// Description: Fills mat with the matrix representing the current
|
||||
// position and orientation of this collider.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::ColliderDef::
|
||||
void CollisionHandlerPhysical::ColliderDef::
|
||||
get_mat(LMatrix4f &mat) const {
|
||||
if (_node != (PandaNode *)NULL) {
|
||||
mat = _node->get_transform()->get_mat();
|
||||
|
||||
} else if (_drive_interface != (qpDriveInterface *)NULL) {
|
||||
} else if (_drive_interface != (DriveInterface *)NULL) {
|
||||
mat = _drive_interface->get_mat();
|
||||
|
||||
} else {
|
||||
collide_cat.error()
|
||||
<< "Invalid qpCollisionHandlerPhysical::ColliderDef\n";
|
||||
<< "Invalid CollisionHandlerPhysical::ColliderDef\n";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::ColliderDef::set_mat
|
||||
// Function: CollisionHandlerPhysical::ColliderDef::set_mat
|
||||
// Access: Public
|
||||
// Description: Moves this collider to the position and orientation
|
||||
// indicated by the given transform.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::ColliderDef::
|
||||
void CollisionHandlerPhysical::ColliderDef::
|
||||
set_mat(const LMatrix4f &mat) {
|
||||
if (_node != (PandaNode *)NULL) {
|
||||
_node->set_transform(TransformState::make_mat(mat));
|
||||
|
||||
} else if (_drive_interface != (qpDriveInterface *)NULL) {
|
||||
} else if (_drive_interface != (DriveInterface *)NULL) {
|
||||
_drive_interface->set_mat(mat);
|
||||
_drive_interface->force_dgraph();
|
||||
|
||||
} else {
|
||||
collide_cat.error()
|
||||
<< "Invalid qpCollisionHandlerPhysical::ColliderDef\n";
|
||||
<< "Invalid CollisionHandlerPhysical::ColliderDef\n";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::Constructor
|
||||
// Function: CollisionHandlerPhysical::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerPhysical::
|
||||
qpCollisionHandlerPhysical() {
|
||||
CollisionHandlerPhysical::
|
||||
CollisionHandlerPhysical() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::Destructor
|
||||
// Function: CollisionHandlerPhysical::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerPhysical::
|
||||
~qpCollisionHandlerPhysical() {
|
||||
CollisionHandlerPhysical::
|
||||
~CollisionHandlerPhysical() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::begin_group
|
||||
// Function: CollisionHandlerPhysical::begin_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Will be called by the CollisionTraverser before a new
|
||||
// traversal is begun. It instructs the handler to
|
||||
// reset itself in preparation for a number of
|
||||
// CollisionEntries to be sent.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::
|
||||
void CollisionHandlerPhysical::
|
||||
begin_group() {
|
||||
qpCollisionHandlerEvent::begin_group();
|
||||
CollisionHandlerEvent::begin_group();
|
||||
_from_entries.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::add_entry
|
||||
// Function: CollisionHandlerPhysical::add_entry
|
||||
// Access: Public, Virtual
|
||||
// Description: Called between a begin_group() .. end_group()
|
||||
// sequence for each collision that is detected.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::
|
||||
add_entry(qpCollisionEntry *entry) {
|
||||
nassertv(entry != (qpCollisionEntry *)NULL);
|
||||
qpCollisionHandlerEvent::add_entry(entry);
|
||||
void CollisionHandlerPhysical::
|
||||
add_entry(CollisionEntry *entry) {
|
||||
nassertv(entry != (CollisionEntry *)NULL);
|
||||
CollisionHandlerEvent::add_entry(entry);
|
||||
|
||||
if (entry->get_from()->is_tangible() &&
|
||||
(!entry->has_into() || entry->get_into()->is_tangible())) {
|
||||
|
|
@ -115,54 +115,54 @@ add_entry(qpCollisionEntry *entry) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::end_group
|
||||
// Function: CollisionHandlerPhysical::end_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Called by the CollisionTraverser at the completion of
|
||||
// all collision detections for this traversal. It
|
||||
// should do whatever finalization is required for the
|
||||
// handler.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandlerPhysical::
|
||||
bool CollisionHandlerPhysical::
|
||||
end_group() {
|
||||
qpCollisionHandlerEvent::end_group();
|
||||
CollisionHandlerEvent::end_group();
|
||||
|
||||
return handle_entries();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::add_collider_drive
|
||||
// Function: CollisionHandlerPhysical::add_collider_drive
|
||||
// Access: Public
|
||||
// Description: Adds a new collider to the list with a qpDriveInterface
|
||||
// Description: Adds a new collider to the list with a DriveInterface
|
||||
// pointer that needs to be told about the collider's
|
||||
// new position, or updates the existing collider with a
|
||||
// new qpDriveInterface pointer.
|
||||
// new DriveInterface pointer.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::
|
||||
add_collider_drive(qpCollisionNode *node, qpDriveInterface *drive_interface) {
|
||||
void CollisionHandlerPhysical::
|
||||
add_collider_drive(CollisionNode *node, DriveInterface *drive_interface) {
|
||||
_colliders[node].set_drive_interface(drive_interface);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::add_collider_node
|
||||
// Function: CollisionHandlerPhysical::add_collider_node
|
||||
// Access: Public
|
||||
// Description: Adds a new collider to the list with a PandaNode
|
||||
// pointer that will be updated with the collider's
|
||||
// new position, or updates the existing collider with a
|
||||
// new PandaNode pointer.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::
|
||||
add_collider_node(qpCollisionNode *node, PandaNode *target) {
|
||||
void CollisionHandlerPhysical::
|
||||
add_collider_node(CollisionNode *node, PandaNode *target) {
|
||||
_colliders[node].set_node(target);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::remove_collider
|
||||
// Function: CollisionHandlerPhysical::remove_collider
|
||||
// Access: Public
|
||||
// Description: Removes the collider from the list of colliders that
|
||||
// this handler knows about.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandlerPhysical::
|
||||
remove_collider(qpCollisionNode *node) {
|
||||
bool CollisionHandlerPhysical::
|
||||
remove_collider(CollisionNode *node) {
|
||||
Colliders::iterator ci = _colliders.find(node);
|
||||
if (ci == _colliders.end()) {
|
||||
return false;
|
||||
|
|
@ -172,24 +172,24 @@ remove_collider(qpCollisionNode *node) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::has_collider
|
||||
// Function: CollisionHandlerPhysical::has_collider
|
||||
// Access: Public
|
||||
// Description: Returns true if the handler knows about the indicated
|
||||
// collider, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandlerPhysical::
|
||||
has_collider(qpCollisionNode *node) const {
|
||||
bool CollisionHandlerPhysical::
|
||||
has_collider(CollisionNode *node) const {
|
||||
Colliders::const_iterator ci = _colliders.find(node);
|
||||
return (ci != _colliders.end());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPhysical::clear_colliders
|
||||
// Function: CollisionHandlerPhysical::clear_colliders
|
||||
// Access: Public
|
||||
// Description: Completely empties the list of colliders this handler
|
||||
// knows about.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerPhysical::
|
||||
void CollisionHandlerPhysical::
|
||||
clear_colliders() {
|
||||
_colliders.clear();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerPhysical.h
|
||||
// Filename: collisionHandlerPhysical.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,63 +16,63 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONHANDLERPHYSICAL_H
|
||||
#define qpCOLLISIONHANDLERPHYSICAL_H
|
||||
#ifndef COLLISIONHANDLERPHYSICAL_H
|
||||
#define COLLISIONHANDLERPHYSICAL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "qpcollisionHandlerEvent.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "collisionHandlerEvent.h"
|
||||
#include "collisionNode.h"
|
||||
|
||||
#include "qpdriveInterface.h"
|
||||
#include "driveInterface.h"
|
||||
#include "pointerTo.h"
|
||||
#include "pandaNode.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionHandlerPhysical
|
||||
// Class : CollisionHandlerPhysical
|
||||
// Description : The abstract base class for a number of
|
||||
// qpCollisionHandlers that have some physical effect on
|
||||
// CollisionHandlers that have some physical effect on
|
||||
// their moving bodies: they need to update the nodes'
|
||||
// positions based on the effects of the collision.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionHandlerPhysical : public qpCollisionHandlerEvent {
|
||||
class EXPCL_PANDA CollisionHandlerPhysical : public CollisionHandlerEvent {
|
||||
public:
|
||||
qpCollisionHandlerPhysical();
|
||||
virtual ~qpCollisionHandlerPhysical();
|
||||
CollisionHandlerPhysical();
|
||||
virtual ~CollisionHandlerPhysical();
|
||||
|
||||
virtual void begin_group();
|
||||
virtual void add_entry(qpCollisionEntry *entry);
|
||||
virtual void add_entry(CollisionEntry *entry);
|
||||
virtual bool end_group();
|
||||
|
||||
PUBLISHED:
|
||||
void add_collider_drive(qpCollisionNode *node, qpDriveInterface *drive_interface);
|
||||
void add_collider_node(qpCollisionNode *node, PandaNode *target);
|
||||
bool remove_collider(qpCollisionNode *node);
|
||||
bool has_collider(qpCollisionNode *node) const;
|
||||
void add_collider_drive(CollisionNode *node, DriveInterface *drive_interface);
|
||||
void add_collider_node(CollisionNode *node, PandaNode *target);
|
||||
bool remove_collider(CollisionNode *node);
|
||||
bool has_collider(CollisionNode *node) const;
|
||||
void clear_colliders();
|
||||
|
||||
protected:
|
||||
virtual bool handle_entries()=0;
|
||||
|
||||
protected:
|
||||
typedef pvector< PT(qpCollisionEntry) > Entries;
|
||||
typedef pmap<PT(qpCollisionNode), Entries> FromEntries;
|
||||
typedef pvector< PT(CollisionEntry) > Entries;
|
||||
typedef pmap<PT(CollisionNode), Entries> FromEntries;
|
||||
FromEntries _from_entries;
|
||||
|
||||
class ColliderDef {
|
||||
public:
|
||||
INLINE void set_drive_interface(qpDriveInterface *drive_interface);
|
||||
INLINE void set_drive_interface(DriveInterface *drive_interface);
|
||||
INLINE void set_node(PandaNode *node);
|
||||
INLINE bool is_valid() const;
|
||||
|
||||
void get_mat(LMatrix4f &mat) const;
|
||||
void set_mat(const LMatrix4f &mat);
|
||||
|
||||
PT(qpDriveInterface) _drive_interface;
|
||||
PT(DriveInterface) _drive_interface;
|
||||
PT(PandaNode) _node;
|
||||
};
|
||||
|
||||
typedef pmap<PT(qpCollisionNode), ColliderDef> Colliders;
|
||||
typedef pmap<PT(CollisionNode), ColliderDef> Colliders;
|
||||
Colliders _colliders;
|
||||
|
||||
|
||||
|
|
@ -81,9 +81,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpCollisionHandlerEvent::init_type();
|
||||
register_type(_type_handle, "qpCollisionHandlerPhysical",
|
||||
qpCollisionHandlerEvent::get_class_type());
|
||||
CollisionHandlerEvent::init_type();
|
||||
register_type(_type_handle, "CollisionHandlerPhysical",
|
||||
CollisionHandlerEvent::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -94,7 +94,7 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpcollisionHandlerPhysical.I"
|
||||
#include "collisionHandlerPhysical.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerPusher.I
|
||||
// Filename: collisionHandlerPusher.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,21 +18,21 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPusher::set_horizontal
|
||||
// Function: CollisionHandlerPusher::set_horizontal
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionHandlerPusher::
|
||||
INLINE void CollisionHandlerPusher::
|
||||
set_horizontal(bool flag) {
|
||||
_horizontal = flag;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPusher::get_horizontal
|
||||
// Function: CollisionHandlerPusher::get_horizontal
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionHandlerPusher::
|
||||
INLINE bool CollisionHandlerPusher::
|
||||
get_horizontal() const {
|
||||
return _horizontal;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerPusher.cxx
|
||||
// Filename: collisionHandlerPusher.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,21 +16,21 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionHandlerPusher.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandlerPusher.h"
|
||||
#include "collisionNode.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
TypeHandle qpCollisionHandlerPusher::_type_handle;
|
||||
TypeHandle CollisionHandlerPusher::_type_handle;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpShoveData
|
||||
// Description : The qpShoveData class is used within
|
||||
// qpCollisionHandlerPusher::handle_entries(), to track
|
||||
// Class : ShoveData
|
||||
// Description : The ShoveData class is used within
|
||||
// CollisionHandlerPusher::handle_entries(), to track
|
||||
// multiple shoves onto a given collider. It's not
|
||||
// exported outside this file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class qpShoveData {
|
||||
class ShoveData {
|
||||
public:
|
||||
LVector3f _shove;
|
||||
float _length;
|
||||
|
|
@ -39,26 +39,26 @@ public:
|
|||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPusher::Constructor
|
||||
// Function: CollisionHandlerPusher::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerPusher::
|
||||
qpCollisionHandlerPusher() {
|
||||
CollisionHandlerPusher::
|
||||
CollisionHandlerPusher() {
|
||||
_horizontal = true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPusher::Destructor
|
||||
// Function: CollisionHandlerPusher::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerPusher::
|
||||
~qpCollisionHandlerPusher() {
|
||||
CollisionHandlerPusher::
|
||||
~CollisionHandlerPusher() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerPusher::handle_entries
|
||||
// Function: CollisionHandlerPusher::handle_entries
|
||||
// Access: Protected, Virtual
|
||||
// Description: Called by the parent class after all collisions have
|
||||
// been detected, this manages the various collisions
|
||||
|
|
@ -68,24 +68,24 @@ qpCollisionHandlerPusher::
|
|||
// false to indicate the CollisionTraverser should
|
||||
// disable this handler from being called in the future.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionHandlerPusher::
|
||||
bool CollisionHandlerPusher::
|
||||
handle_entries() {
|
||||
bool okflag = true;
|
||||
|
||||
FromEntries::const_iterator fi;
|
||||
for (fi = _from_entries.begin(); fi != _from_entries.end(); ++fi) {
|
||||
qpCollisionNode *from_node = (*fi).first;
|
||||
nassertr(from_node != (qpCollisionNode *)NULL, false);
|
||||
CollisionNode *from_node = (*fi).first;
|
||||
nassertr(from_node != (CollisionNode *)NULL, false);
|
||||
const Entries &entries = (*fi).second;
|
||||
|
||||
Colliders::iterator ci;
|
||||
ci = _colliders.find(from_node);
|
||||
if (ci == _colliders.end()) {
|
||||
// Hmm, someone added a qpCollisionNode to a traverser and gave
|
||||
// it this qpCollisionHandler pointer--but they didn't tell us
|
||||
// Hmm, someone added a CollisionNode to a traverser and gave
|
||||
// it this CollisionHandler pointer--but they didn't tell us
|
||||
// about the node.
|
||||
collide_cat.error()
|
||||
<< "qpCollisionHandlerPusher doesn't know about "
|
||||
<< "CollisionHandlerPusher doesn't know about "
|
||||
<< *from_node << ", disabling.\n";
|
||||
okflag = false;
|
||||
|
||||
|
|
@ -106,13 +106,13 @@ handle_entries() {
|
|||
// share nearly the same direction, and if so, we keep only the
|
||||
// longer of the two.
|
||||
|
||||
typedef pvector<qpShoveData> Shoves;
|
||||
typedef pvector<ShoveData> Shoves;
|
||||
Shoves shoves;
|
||||
|
||||
Entries::const_iterator ei;
|
||||
for (ei = entries.begin(); ei != entries.end(); ++ei) {
|
||||
qpCollisionEntry *entry = (*ei);
|
||||
nassertr(entry != (qpCollisionEntry *)NULL, false);
|
||||
CollisionEntry *entry = (*ei);
|
||||
nassertr(entry != (CollisionEntry *)NULL, false);
|
||||
nassertr(from_node == entry->get_from_node(), false);
|
||||
|
||||
if (!entry->has_into_surface_normal() ||
|
||||
|
|
@ -126,7 +126,7 @@ handle_entries() {
|
|||
} else {
|
||||
// Shove it just enough to clear the volume.
|
||||
if (entry->get_into_depth() != 0.0f) {
|
||||
qpShoveData sd;
|
||||
ShoveData sd;
|
||||
sd._shove =
|
||||
entry->get_into_surface_normal() *
|
||||
entry->get_into_depth();
|
||||
|
|
@ -152,10 +152,10 @@ handle_entries() {
|
|||
|
||||
Shoves::iterator si;
|
||||
for (si = shoves.begin(); si != shoves.end(); ++si) {
|
||||
qpShoveData &sd = (*si);
|
||||
ShoveData &sd = (*si);
|
||||
Shoves::iterator sj;
|
||||
for (sj = shoves.begin(); sj != si; ++sj) {
|
||||
qpShoveData &sd2 = (*sj);
|
||||
ShoveData &sd2 = (*sj);
|
||||
if (sd2._valid) {
|
||||
|
||||
float d = sd._normalized_shove.dot(sd2._normalized_shove);
|
||||
|
|
@ -180,7 +180,7 @@ handle_entries() {
|
|||
// Now we can determine the net shove.
|
||||
LVector3f net_shove(0.0f, 0.0f, 0.0f);
|
||||
for (si = shoves.begin(); si != shoves.end(); ++si) {
|
||||
const qpShoveData &sd = (*si);
|
||||
const ShoveData &sd = (*si);
|
||||
if (sd._valid) {
|
||||
net_shove += sd._shove;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerPusher.h
|
||||
// Filename: collisionHandlerPusher.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,24 +16,24 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONHANDLERPUSHER_H
|
||||
#define qpCOLLISIONHANDLERPUSHER_H
|
||||
#ifndef COLLISIONHANDLERPUSHER_H
|
||||
#define COLLISIONHANDLERPUSHER_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "qpcollisionHandlerPhysical.h"
|
||||
#include "collisionHandlerPhysical.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionHandlerPusher
|
||||
// Description : A specialized kind of qpCollisionHandler that simply
|
||||
// Class : CollisionHandlerPusher
|
||||
// Description : A specialized kind of CollisionHandler that simply
|
||||
// pushes back on things that attempt to move into solid
|
||||
// walls. This is the simplest kind of "real-world"
|
||||
// collisions you can have.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionHandlerPusher : public qpCollisionHandlerPhysical {
|
||||
class EXPCL_PANDA CollisionHandlerPusher : public CollisionHandlerPhysical {
|
||||
PUBLISHED:
|
||||
qpCollisionHandlerPusher();
|
||||
virtual ~qpCollisionHandlerPusher();
|
||||
CollisionHandlerPusher();
|
||||
virtual ~CollisionHandlerPusher();
|
||||
|
||||
INLINE void set_horizontal(bool flag);
|
||||
INLINE bool get_horizontal() const;
|
||||
|
|
@ -50,9 +50,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpCollisionHandlerPhysical::init_type();
|
||||
register_type(_type_handle, "qpCollisionHandlerPusher",
|
||||
qpCollisionHandlerPhysical::get_class_type());
|
||||
CollisionHandlerPhysical::init_type();
|
||||
register_type(_type_handle, "CollisionHandlerPusher",
|
||||
CollisionHandlerPhysical::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -63,7 +63,7 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpcollisionHandlerPusher.I"
|
||||
#include "collisionHandlerPusher.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerQueue.cxx
|
||||
// Filename: collisionHandlerQueue.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,65 +16,65 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionHandlerQueue.h"
|
||||
#include "collisionHandlerQueue.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
TypeHandle qpCollisionHandlerQueue::_type_handle;
|
||||
TypeHandle CollisionHandlerQueue::_type_handle;
|
||||
|
||||
// This class is used in sort_entries(), below.
|
||||
class qpCollisionEntrySorter {
|
||||
class CollisionEntrySorter {
|
||||
public:
|
||||
qpCollisionEntrySorter(qpCollisionEntry *entry) {
|
||||
CollisionEntrySorter(CollisionEntry *entry) {
|
||||
_entry = entry;
|
||||
LVector3f vec =
|
||||
entry->get_from_intersection_point() -
|
||||
entry->get_from()->get_collision_origin();
|
||||
_dist2 = vec.length_squared();
|
||||
}
|
||||
bool operator < (const qpCollisionEntrySorter &other) const {
|
||||
bool operator < (const CollisionEntrySorter &other) const {
|
||||
return _dist2 < other._dist2;
|
||||
}
|
||||
|
||||
qpCollisionEntry *_entry;
|
||||
CollisionEntry *_entry;
|
||||
float _dist2;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::Constructor
|
||||
// Function: CollisionHandlerQueue::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandlerQueue::
|
||||
qpCollisionHandlerQueue() {
|
||||
CollisionHandlerQueue::
|
||||
CollisionHandlerQueue() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::begin_group
|
||||
// Function: CollisionHandlerQueue::begin_group
|
||||
// Access: Public, Virtual
|
||||
// Description: Will be called by the CollisionTraverser before a new
|
||||
// traversal is begun. It instructs the handler to
|
||||
// reset itself in preparation for a number of
|
||||
// CollisionEntries to be sent.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerQueue::
|
||||
void CollisionHandlerQueue::
|
||||
begin_group() {
|
||||
_entries.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::add_entry
|
||||
// Function: CollisionHandlerQueue::add_entry
|
||||
// Access: Public, Virtual
|
||||
// Description: Called between a begin_group() .. end_group()
|
||||
// sequence for each collision that is detected.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerQueue::
|
||||
add_entry(qpCollisionEntry *entry) {
|
||||
nassertv(entry != (qpCollisionEntry *)NULL);
|
||||
void CollisionHandlerQueue::
|
||||
add_entry(CollisionEntry *entry) {
|
||||
nassertv(entry != (CollisionEntry *)NULL);
|
||||
_entries.push_back(entry);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::sort_entries
|
||||
// Function: CollisionHandlerQueue::sort_entries
|
||||
// Access: Public
|
||||
// Description: Sorts all the detected collisions front-to-back by
|
||||
// from_intersection_point() so that those intersection
|
||||
|
|
@ -82,17 +82,17 @@ add_entry(qpCollisionEntry *entry) {
|
|||
// center of the CollisionSphere, or the point_a of a
|
||||
// CollisionSegment) appear first.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerQueue::
|
||||
void CollisionHandlerQueue::
|
||||
sort_entries() {
|
||||
// Build up a temporary vector of entries so we can sort the
|
||||
// pointers. This uses the class defined above.
|
||||
typedef pvector<qpCollisionEntrySorter> Sorter;
|
||||
typedef pvector<CollisionEntrySorter> Sorter;
|
||||
Sorter sorter;
|
||||
sorter.reserve(_entries.size());
|
||||
|
||||
Entries::const_iterator ei;
|
||||
for (ei = _entries.begin(); ei != _entries.end(); ++ei) {
|
||||
sorter.push_back(qpCollisionEntrySorter(*ei));
|
||||
sorter.push_back(CollisionEntrySorter(*ei));
|
||||
}
|
||||
|
||||
sort(sorter.begin(), sorter.end());
|
||||
|
|
@ -112,32 +112,32 @@ sort_entries() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::clear_entries
|
||||
// Function: CollisionHandlerQueue::clear_entries
|
||||
// Access: Public
|
||||
// Description: Removes all the entries from the queue.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionHandlerQueue::
|
||||
void CollisionHandlerQueue::
|
||||
clear_entries() {
|
||||
_entries.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::get_num_entries
|
||||
// Function: CollisionHandlerQueue::get_num_entries
|
||||
// Access: Public
|
||||
// Description: Returns the number of CollisionEntries detected last
|
||||
// pass.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int qpCollisionHandlerQueue::
|
||||
int CollisionHandlerQueue::
|
||||
get_num_entries() const {
|
||||
return _entries.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionHandlerQueue::get_entry
|
||||
// Function: CollisionHandlerQueue::get_entry
|
||||
// Access: Public
|
||||
// Description: Returns the nth qpCollisionEntry detected last pass.
|
||||
// Description: Returns the nth CollisionEntry detected last pass.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionEntry *qpCollisionHandlerQueue::
|
||||
CollisionEntry *CollisionHandlerQueue::
|
||||
get_entry(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_entries.size(), NULL);
|
||||
return _entries[n];
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionHandlerQueue.h
|
||||
// Filename: collisionHandlerQueue.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,40 +16,40 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONHANDLERQUEUE_H
|
||||
#define qpCOLLISIONHANDLERQUEUE_H
|
||||
#ifndef COLLISIONHANDLERQUEUE_H
|
||||
#define COLLISIONHANDLERQUEUE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionEntry.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionHandlerQueue
|
||||
// Description : A special kind of qpCollisionHandler that does nothing
|
||||
// Class : CollisionHandlerQueue
|
||||
// Description : A special kind of CollisionHandler that does nothing
|
||||
// except remember the CollisionEntries detected the
|
||||
// last pass. This set of CollisionEntries may then be
|
||||
// queried by the calling function. It's primarily
|
||||
// useful when a simple intersection test is being made,
|
||||
// e.g. for picking from the window.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionHandlerQueue : public qpCollisionHandler {
|
||||
class EXPCL_PANDA CollisionHandlerQueue : public CollisionHandler {
|
||||
PUBLISHED:
|
||||
qpCollisionHandlerQueue();
|
||||
CollisionHandlerQueue();
|
||||
|
||||
public:
|
||||
virtual void begin_group();
|
||||
virtual void add_entry(qpCollisionEntry *entry);
|
||||
virtual void add_entry(CollisionEntry *entry);
|
||||
|
||||
PUBLISHED:
|
||||
void sort_entries();
|
||||
void clear_entries();
|
||||
|
||||
int get_num_entries() const;
|
||||
qpCollisionEntry *get_entry(int n) const;
|
||||
CollisionEntry *get_entry(int n) const;
|
||||
|
||||
private:
|
||||
typedef pvector< PT(qpCollisionEntry) > Entries;
|
||||
typedef pvector< PT(CollisionEntry) > Entries;
|
||||
Entries _entries;
|
||||
|
||||
public:
|
||||
|
|
@ -57,9 +57,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpCollisionHandler::init_type();
|
||||
register_type(_type_handle, "qpCollisionHandlerQueue",
|
||||
qpCollisionHandler::get_class_type());
|
||||
CollisionHandler::init_type();
|
||||
register_type(_type_handle, "CollisionHandlerQueue",
|
||||
CollisionHandler::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionLevelState.I
|
||||
// Filename: collisionLevelState.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,24 +18,24 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::Constructor
|
||||
// Function: CollisionLevelState::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCollisionLevelState::
|
||||
qpCollisionLevelState(const qpNodePath &node_path) :
|
||||
INLINE CollisionLevelState::
|
||||
CollisionLevelState(const NodePath &node_path) :
|
||||
_node_path(node_path)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::Constructor
|
||||
// Function: CollisionLevelState::Constructor
|
||||
// Access: Public
|
||||
// Description: This constructor goes to the next child node in the
|
||||
// traversal.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCollisionLevelState::
|
||||
qpCollisionLevelState(const qpCollisionLevelState &parent, PandaNode *child) :
|
||||
INLINE CollisionLevelState::
|
||||
CollisionLevelState(const CollisionLevelState &parent, PandaNode *child) :
|
||||
_node_path(parent._node_path, child),
|
||||
_colliders(parent._colliders),
|
||||
_current(parent._current),
|
||||
|
|
@ -45,85 +45,85 @@ qpCollisionLevelState(const qpCollisionLevelState &parent, PandaNode *child) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_node_path
|
||||
// Function: CollisionLevelState::get_node_path
|
||||
// Access: Public
|
||||
// Description: Returns the NodePath representing the node instance
|
||||
// we have traversed to.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpNodePath qpCollisionLevelState::
|
||||
INLINE NodePath CollisionLevelState::
|
||||
get_node_path() const {
|
||||
return _node_path.get_node_path();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::node
|
||||
// Function: CollisionLevelState::node
|
||||
// Access: Public
|
||||
// Description: Returns the PandaNode pointer of the node we have
|
||||
// traversed to.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE PandaNode *qpCollisionLevelState::
|
||||
INLINE PandaNode *CollisionLevelState::
|
||||
node() const {
|
||||
return _node_path.node();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_num_colliders
|
||||
// Function: CollisionLevelState::get_num_colliders
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpCollisionLevelState::
|
||||
INLINE int CollisionLevelState::
|
||||
get_num_colliders() const {
|
||||
return _colliders.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::has_collider
|
||||
// Function: CollisionLevelState::has_collider
|
||||
// Access: Public
|
||||
// Description: Returns true if the nth collider in the LevelState is
|
||||
// still part of the level.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionLevelState::
|
||||
INLINE bool CollisionLevelState::
|
||||
has_collider(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), false);
|
||||
return (_current & get_mask(n)) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::has_collider_with_geom
|
||||
// Function: CollisionLevelState::has_collider_with_geom
|
||||
// Access: Public
|
||||
// Description: Returns true if the nth collider in the LevelState is
|
||||
// still part of the level, and it has the
|
||||
// "collide_geom" flag set.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionLevelState::
|
||||
INLINE bool CollisionLevelState::
|
||||
has_collider_with_geom(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), false);
|
||||
return (_current & _colliders_with_geom & get_mask(n)) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::has_any_collider
|
||||
// Function: CollisionLevelState::has_any_collider
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionLevelState::
|
||||
INLINE bool CollisionLevelState::
|
||||
has_any_collider() const {
|
||||
return _current != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::has_any_collide_geom
|
||||
// Function: CollisionLevelState::has_any_collide_geom
|
||||
// Access: Public
|
||||
// Description: Returns true if any Collider in the level state has
|
||||
// the "collide_geom" flag set, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionLevelState::
|
||||
INLINE bool CollisionLevelState::
|
||||
has_any_collide_geom() const {
|
||||
return (_current & _colliders_with_geom) != 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::reached_collision_node
|
||||
// Function: CollisionLevelState::reached_collision_node
|
||||
// Access: Public
|
||||
// Description: Called by the traverser when we reach a CollisionNode
|
||||
// in the traversal. At this point, we zero out our set
|
||||
|
|
@ -131,17 +131,17 @@ has_any_collide_geom() const {
|
|||
// because no colliders will test against geometry
|
||||
// parented beneath a CollisionNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionLevelState::
|
||||
INLINE void CollisionLevelState::
|
||||
reached_collision_node() {
|
||||
_colliders_with_geom = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_collider
|
||||
// Function: CollisionLevelState::get_collider
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CollisionSolid *qpCollisionLevelState::
|
||||
INLINE CollisionSolid *CollisionLevelState::
|
||||
get_collider(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
|
||||
nassertr(has_collider(n), NULL);
|
||||
|
|
@ -150,11 +150,11 @@ get_collider(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_node
|
||||
// Function: CollisionLevelState::get_node
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCollisionNode *qpCollisionLevelState::
|
||||
INLINE CollisionNode *CollisionLevelState::
|
||||
get_node(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
|
||||
nassertr(has_collider(n), NULL);
|
||||
|
|
@ -163,11 +163,11 @@ get_node(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_space
|
||||
// Function: CollisionLevelState::get_space
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LMatrix4f &qpCollisionLevelState::
|
||||
INLINE const LMatrix4f &CollisionLevelState::
|
||||
get_space(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), LMatrix4f::ident_mat());
|
||||
nassertr(has_collider(n), LMatrix4f::ident_mat());
|
||||
|
|
@ -176,11 +176,11 @@ get_space(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_inv_space
|
||||
// Function: CollisionLevelState::get_inv_space
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const LMatrix4f &qpCollisionLevelState::
|
||||
INLINE const LMatrix4f &CollisionLevelState::
|
||||
get_inv_space(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), LMatrix4f::ident_mat());
|
||||
nassertr(has_collider(n), LMatrix4f::ident_mat());
|
||||
|
|
@ -189,13 +189,13 @@ get_inv_space(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_local_bound
|
||||
// Function: CollisionLevelState::get_local_bound
|
||||
// Access: Public
|
||||
// Description: Returns the bounding volume of the indicated
|
||||
// collider, transformed into the current node's
|
||||
// transform space.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const GeometricBoundingVolume *qpCollisionLevelState::
|
||||
INLINE const GeometricBoundingVolume *CollisionLevelState::
|
||||
get_local_bound(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
|
||||
nassertr(has_collider(n), NULL);
|
||||
|
|
@ -210,7 +210,7 @@ get_local_bound(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_parent_bound
|
||||
// Function: CollisionLevelState::get_parent_bound
|
||||
// Access: Public
|
||||
// Description: Returns the bounding volume of the indicated
|
||||
// collider, transformed into the previous node's
|
||||
|
|
@ -220,7 +220,7 @@ get_local_bound(int n) const {
|
|||
// (which does not have its own transform applied to
|
||||
// it).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const GeometricBoundingVolume *qpCollisionLevelState::
|
||||
INLINE const GeometricBoundingVolume *CollisionLevelState::
|
||||
get_parent_bound(int n) const {
|
||||
nassertr(n >= 0 && n < (int)_colliders.size(), NULL);
|
||||
nassertr(has_collider(n), NULL);
|
||||
|
|
@ -231,11 +231,11 @@ get_parent_bound(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::omit_collider
|
||||
// Function: CollisionLevelState::omit_collider
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionLevelState::
|
||||
INLINE void CollisionLevelState::
|
||||
omit_collider(int n) {
|
||||
nassertv(n >= 0 && n < (int)_colliders.size());
|
||||
nassertv(has_collider(n));
|
||||
|
|
@ -244,12 +244,12 @@ omit_collider(int n) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::get_mask
|
||||
// Function: CollisionLevelState::get_mask
|
||||
// Access: Private
|
||||
// Description: Returns a single bit associated with the nth
|
||||
// collider.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpCollisionLevelState::ColliderMask qpCollisionLevelState::
|
||||
INLINE CollisionLevelState::ColliderMask CollisionLevelState::
|
||||
get_mask(int n) const {
|
||||
return ((ColliderMask)1) << n;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionLevelState.cxx
|
||||
// Filename: collisionLevelState.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,16 +16,16 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionLevelState.h"
|
||||
#include "collisionLevelState.h"
|
||||
#include "collisionSolid.h"
|
||||
#include "dcast.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::clear
|
||||
// Function: CollisionLevelState::clear
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionLevelState::
|
||||
void CollisionLevelState::
|
||||
clear() {
|
||||
_colliders.clear();
|
||||
_local_bounds.clear();
|
||||
|
|
@ -35,23 +35,23 @@ clear() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::reserve
|
||||
// Function: CollisionLevelState::reserve
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionLevelState::
|
||||
void CollisionLevelState::
|
||||
reserve(int max_colliders) {
|
||||
_colliders.reserve(max_colliders);
|
||||
_local_bounds.reserve(max_colliders);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::prepare_collider
|
||||
// Function: CollisionLevelState::prepare_collider
|
||||
// Access: Public
|
||||
// Description: Adds the indicated Collider to the set of Colliders
|
||||
// in the current level state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionLevelState::
|
||||
void CollisionLevelState::
|
||||
prepare_collider(const ColliderDef &def) {
|
||||
int index = (int)_colliders.size();
|
||||
_colliders.push_back(def);
|
||||
|
|
@ -76,7 +76,7 @@ prepare_collider(const ColliderDef &def) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::any_in_bounds
|
||||
// Function: CollisionLevelState::any_in_bounds
|
||||
// Access: Public
|
||||
// Description: Checks the bounding volume of the current node
|
||||
// against each of our colliders. Eliminates from the
|
||||
|
|
@ -85,7 +85,7 @@ prepare_collider(const ColliderDef &def) {
|
|||
// remain, false if all of them fall outside this node's
|
||||
// bounding volume.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionLevelState::
|
||||
bool CollisionLevelState::
|
||||
any_in_bounds() {
|
||||
#ifndef NDEBUG
|
||||
int indent_level = 0;
|
||||
|
|
@ -105,7 +105,7 @@ any_in_bounds() {
|
|||
int num_colliders = get_num_colliders();
|
||||
for (int c = 0; c < num_colliders; c++) {
|
||||
if (has_collider(c)) {
|
||||
qpCollisionNode *collider = get_node(c);
|
||||
CollisionNode *collider = get_node(c);
|
||||
bool is_in = false;
|
||||
|
||||
// Don't even bother testing the bounding volume if there are
|
||||
|
|
@ -161,12 +161,12 @@ any_in_bounds() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionLevelState::apply_transform
|
||||
// Function: CollisionLevelState::apply_transform
|
||||
// Access: Public
|
||||
// Description: Applies the inverse transform from the current node,
|
||||
// if any, onto all the colliders in the level state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionLevelState::
|
||||
void CollisionLevelState::
|
||||
apply_transform() {
|
||||
// The "parent" bounds list remembers the bounds list of the
|
||||
// previous node.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionLevelState.h
|
||||
// Filename: collisionLevelState.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,40 +16,40 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONLEVELSTATE_H
|
||||
#define qpCOLLISIONLEVELSTATE_H
|
||||
#ifndef COLLISIONLEVELSTATE_H
|
||||
#define COLLISIONLEVELSTATE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "luse.h"
|
||||
#include "pointerToArray.h"
|
||||
#include "geometricBoundingVolume.h"
|
||||
#include "qpnodePath.h"
|
||||
#include "nodePath.h"
|
||||
#include "workingNodePath.h"
|
||||
|
||||
#include "plist.h"
|
||||
|
||||
class CollisionSolid;
|
||||
class qpCollisionNode;
|
||||
class CollisionNode;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionLevelState
|
||||
// Class : CollisionLevelState
|
||||
// Description : This is the state information the
|
||||
// CollisionTraverser retains for each level during
|
||||
// traversal.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class qpCollisionLevelState {
|
||||
class CollisionLevelState {
|
||||
public:
|
||||
class ColliderDef {
|
||||
public:
|
||||
CollisionSolid *_collider;
|
||||
qpCollisionNode *_node;
|
||||
CollisionNode *_node;
|
||||
LMatrix4f _space;
|
||||
LMatrix4f _inv_space;
|
||||
};
|
||||
|
||||
INLINE qpCollisionLevelState(const qpNodePath &node_path);
|
||||
INLINE qpCollisionLevelState(const qpCollisionLevelState &parent,
|
||||
INLINE CollisionLevelState(const NodePath &node_path);
|
||||
INLINE CollisionLevelState(const CollisionLevelState &parent,
|
||||
PandaNode *child);
|
||||
|
||||
void clear();
|
||||
|
|
@ -59,7 +59,7 @@ public:
|
|||
bool any_in_bounds();
|
||||
void apply_transform();
|
||||
|
||||
INLINE qpNodePath get_node_path() const;
|
||||
INLINE NodePath get_node_path() const;
|
||||
INLINE PandaNode *node() const;
|
||||
|
||||
INLINE int get_num_colliders() const;
|
||||
|
|
@ -71,7 +71,7 @@ public:
|
|||
INLINE void reached_collision_node();
|
||||
|
||||
INLINE CollisionSolid *get_collider(int n) const;
|
||||
INLINE qpCollisionNode *get_node(int n) const;
|
||||
INLINE CollisionNode *get_node(int n) const;
|
||||
INLINE const LMatrix4f &get_space(int n) const;
|
||||
INLINE const LMatrix4f &get_inv_space(int n) const;
|
||||
INLINE const GeometricBoundingVolume *get_local_bound(int n) const;
|
||||
|
|
@ -101,7 +101,7 @@ private:
|
|||
BoundingVolumes _parent_bounds;
|
||||
};
|
||||
|
||||
#include "qpcollisionLevelState.I"
|
||||
#include "collisionLevelState.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionNode.I
|
||||
// Filename: collisionNode.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,19 +18,19 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::set_collide_mask
|
||||
// Function: CollisionNode::set_collide_mask
|
||||
// Access: Public
|
||||
// Description: Simultaneously sets both the "from" and "into"
|
||||
// CollideMask values to the same thing.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionNode::
|
||||
INLINE void CollisionNode::
|
||||
set_collide_mask(CollideMask mask) {
|
||||
set_from_collide_mask(mask);
|
||||
set_into_collide_mask(mask);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::set_from_collide_mask
|
||||
// Function: CollisionNode::set_from_collide_mask
|
||||
// Access: Public
|
||||
// Description: Sets the "from" CollideMask. In order for a
|
||||
// collision to be detected from this object into
|
||||
|
|
@ -38,13 +38,13 @@ set_collide_mask(CollideMask mask) {
|
|||
// "from" mask and the other object's "into" mask must
|
||||
// be nonzero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionNode::
|
||||
INLINE void CollisionNode::
|
||||
set_from_collide_mask(CollideMask mask) {
|
||||
_from_collide_mask = mask;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::set_into_collide_mask
|
||||
// Function: CollisionNode::set_into_collide_mask
|
||||
// Access: Public
|
||||
// Description: Sets the "into" CollideMask. In order for a
|
||||
// collision to be detected from another object into
|
||||
|
|
@ -52,7 +52,7 @@ set_from_collide_mask(CollideMask mask) {
|
|||
// "from" mask and this object's "into" mask must be
|
||||
// nonzero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionNode::
|
||||
INLINE void CollisionNode::
|
||||
set_into_collide_mask(CollideMask mask) {
|
||||
_into_collide_mask = mask;
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ set_into_collide_mask(CollideMask mask) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::get_from_collide_mask
|
||||
// Function: CollisionNode::get_from_collide_mask
|
||||
// Access: Public
|
||||
// Description: Returns the current "from" CollideMask. In order for
|
||||
// a collision to be detected from this object into
|
||||
|
|
@ -71,13 +71,13 @@ set_into_collide_mask(CollideMask mask) {
|
|||
// "from" mask and the other object's "into" mask must
|
||||
// be nonzero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CollideMask qpCollisionNode::
|
||||
INLINE CollideMask CollisionNode::
|
||||
get_from_collide_mask() const {
|
||||
return _from_collide_mask;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::get_into_collide_mask
|
||||
// Function: CollisionNode::get_into_collide_mask
|
||||
// Access: Public
|
||||
// Description: Returns the current "into" CollideMask. In order for
|
||||
// a collision to be detected from another object into
|
||||
|
|
@ -85,16 +85,16 @@ get_from_collide_mask() const {
|
|||
// "from" mask and this object's "into" mask must be
|
||||
// nonzero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CollideMask qpCollisionNode::
|
||||
INLINE CollideMask CollisionNode::
|
||||
get_into_collide_mask() const {
|
||||
return _into_collide_mask;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::set_collide_geom
|
||||
// Function: CollisionNode::set_collide_geom
|
||||
// Access: Public
|
||||
// Description: Sets the state of the "collide geom" flag for this
|
||||
// qpCollisionNode. Normally, this is false; when this is
|
||||
// CollisionNode. Normally, this is false; when this is
|
||||
// set true, the CollisionSolids in this node will test
|
||||
// for collisions with actual renderable geometry, in
|
||||
// addition to whatever CollisionSolids may be indicated
|
||||
|
|
@ -105,50 +105,50 @@ get_into_collide_mask() const {
|
|||
// thing; there is no way to collide with only some
|
||||
// GeomNodes, as GeomNodes have no into_collide_mask.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionNode::
|
||||
INLINE void CollisionNode::
|
||||
set_collide_geom(bool flag) {
|
||||
_collide_geom = flag;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::get_collide_geom
|
||||
// Function: CollisionNode::get_collide_geom
|
||||
// Access: Public
|
||||
// Description: Returns the current state of the collide_geom flag.
|
||||
// See set_collide_geom().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpCollisionNode::
|
||||
INLINE bool CollisionNode::
|
||||
get_collide_geom() const {
|
||||
return _collide_geom;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::get_num_solids
|
||||
// Function: CollisionNode::get_num_solids
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpCollisionNode::
|
||||
INLINE int CollisionNode::
|
||||
get_num_solids() const {
|
||||
return _solids.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::get_solid
|
||||
// Function: CollisionNode::get_solid
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE CollisionSolid *qpCollisionNode::
|
||||
INLINE CollisionSolid *CollisionNode::
|
||||
get_solid(int n) const {
|
||||
nassertr(n >= 0 && n < get_num_solids(), NULL);
|
||||
return _solids[n];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::remove_solid
|
||||
// Function: CollisionNode::remove_solid
|
||||
// Access: Public
|
||||
// Description: Removes the solid with the indicated index. This
|
||||
// will shift all subsequent indices down by one.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpCollisionNode::
|
||||
INLINE void CollisionNode::
|
||||
remove_solid(int n) {
|
||||
nassertv(n >= 0 && n < get_num_solids());
|
||||
_solids.erase(_solids.begin() + n);
|
||||
|
|
@ -156,13 +156,13 @@ remove_solid(int n) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::add_solid
|
||||
// Function: CollisionNode::add_solid
|
||||
// Access: Public
|
||||
// Description: Adds the indicated solid to the node. Returns the
|
||||
// index of the new solid within the node's list of
|
||||
// solids.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpCollisionNode::
|
||||
INLINE int CollisionNode::
|
||||
add_solid(CollisionSolid *solid) {
|
||||
_solids.push_back(solid);
|
||||
mark_bound_stale();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionNode.cxx
|
||||
// Filename: collisionNode.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,27 +16,27 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionNode.h"
|
||||
#include "collisionNode.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "cullTraverserData.h"
|
||||
#include "qpcullTraverser.h"
|
||||
#include "cullTraverser.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
#include "bamReader.h"
|
||||
#include "bamWriter.h"
|
||||
|
||||
TypeHandle qpCollisionNode::_type_handle;
|
||||
TypeHandle CollisionNode::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::Constructor
|
||||
// Function: CollisionNode::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionNode::
|
||||
qpCollisionNode(const string &name) :
|
||||
CollisionNode::
|
||||
CollisionNode(const string &name) :
|
||||
PandaNode(name),
|
||||
_from_collide_mask(CollideMask::all_on()),
|
||||
_into_collide_mask(CollideMask::all_on()),
|
||||
|
|
@ -47,12 +47,12 @@ qpCollisionNode(const string &name) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::Copy Constructor
|
||||
// Function: CollisionNode::Copy Constructor
|
||||
// Access: Protected
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionNode::
|
||||
qpCollisionNode(const qpCollisionNode ©) :
|
||||
CollisionNode::
|
||||
CollisionNode(const CollisionNode ©) :
|
||||
PandaNode(copy),
|
||||
_from_collide_mask(copy._from_collide_mask),
|
||||
_into_collide_mask(copy._into_collide_mask),
|
||||
|
|
@ -62,47 +62,47 @@ qpCollisionNode(const qpCollisionNode ©) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::Destructor
|
||||
// Function: CollisionNode::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionNode::
|
||||
~qpCollisionNode() {
|
||||
CollisionNode::
|
||||
~CollisionNode() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::make_copy
|
||||
// Function: CollisionNode::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.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PandaNode *qpCollisionNode::
|
||||
PandaNode *CollisionNode::
|
||||
make_copy() const {
|
||||
return new qpCollisionNode(*this);
|
||||
return new CollisionNode(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::preserve_name
|
||||
// Function: CollisionNode::preserve_name
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if the node's name has extrinsic meaning
|
||||
// and must be preserved across a flatten operation,
|
||||
// false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionNode::
|
||||
bool CollisionNode::
|
||||
preserve_name() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::xform
|
||||
// Function: CollisionNode::xform
|
||||
// Access: Public, Virtual
|
||||
// Description: Transforms the contents of this node by the indicated
|
||||
// matrix, if it means anything to do so. For most
|
||||
// kinds of nodes, this does nothing.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionNode::
|
||||
void CollisionNode::
|
||||
xform(const LMatrix4f &mat) {
|
||||
nassertv(!mat.is_nan());
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ xform(const LMatrix4f &mat) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::combine_with
|
||||
// Function: CollisionNode::combine_with
|
||||
// Access: Public, Virtual
|
||||
// Description: Collapses this node with the other node, if possible,
|
||||
// and returns a pointer to the combined node, or NULL
|
||||
|
|
@ -141,13 +141,13 @@ xform(const LMatrix4f &mat) {
|
|||
// decide whether to collapse the two nodes and what the
|
||||
// collapsed node should look like.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PandaNode *qpCollisionNode::
|
||||
PandaNode *CollisionNode::
|
||||
combine_with(PandaNode *other) {
|
||||
if (is_exact_type(get_class_type()) &&
|
||||
other->is_exact_type(get_class_type())) {
|
||||
// Two qpCollisionNodes can combine, but only if they have the same
|
||||
// Two CollisionNodes can combine, but only if they have the same
|
||||
// name, because the name is often meaningful.
|
||||
qpCollisionNode *cother = DCAST(qpCollisionNode, other);
|
||||
CollisionNode *cother = DCAST(CollisionNode, other);
|
||||
if (get_name() == cother->get_name()) {
|
||||
const PT(CollisionSolid) *solids_begin = &cother->_solids[0];
|
||||
const PT(CollisionSolid) *solids_end = solids_begin + cother->_solids.size();
|
||||
|
|
@ -156,7 +156,7 @@ combine_with(PandaNode *other) {
|
|||
return this;
|
||||
}
|
||||
|
||||
// Two qpCollisionNodes with different names can't combine.
|
||||
// Two CollisionNodes with different names can't combine.
|
||||
return (PandaNode *)NULL;
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ combine_with(PandaNode *other) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::has_cull_callback
|
||||
// Function: CollisionNode::has_cull_callback
|
||||
// Access: Public, Virtual
|
||||
// Description: Should be overridden by derived classes to return
|
||||
// true if cull_callback() has been defined. Otherwise,
|
||||
|
|
@ -172,13 +172,13 @@ combine_with(PandaNode *other) {
|
|||
// need to be called for this node during the cull
|
||||
// traversal.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionNode::
|
||||
bool CollisionNode::
|
||||
has_cull_callback() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::cull_callback
|
||||
// Function: CollisionNode::cull_callback
|
||||
// Access: Public, Virtual
|
||||
// Description: If has_cull_callback() returns true, this function
|
||||
// will be called during the cull traversal to perform
|
||||
|
|
@ -196,8 +196,8 @@ has_cull_callback() const {
|
|||
// The return value is true if this node should be
|
||||
// visible, or false if it should be culled.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionNode::
|
||||
cull_callback(qpCullTraverser *trav, CullTraverserData &data) {
|
||||
bool CollisionNode::
|
||||
cull_callback(CullTraverser *trav, CullTraverserData &data) {
|
||||
// Append our collision vizzes to the drawing, even though they're
|
||||
// not actually part of the scene graph.
|
||||
Solids::iterator si;
|
||||
|
|
@ -218,14 +218,14 @@ cull_callback(qpCullTraverser *trav, CullTraverserData &data) {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::output
|
||||
// Function: CollisionNode::output
|
||||
// Access: Public, Virtual
|
||||
// Description: Writes a brief description of the node to the
|
||||
// indicated output stream. This is invoked by the <<
|
||||
// operator. It may be overridden in derived classes to
|
||||
// include some information relevant to the class.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionNode::
|
||||
void CollisionNode::
|
||||
output(ostream &out) const {
|
||||
PandaNode::output(out);
|
||||
out << " (" << _solids.size() << " solids)";
|
||||
|
|
@ -233,7 +233,7 @@ output(ostream &out) const {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::recompute_bound
|
||||
// Function: CollisionNode::recompute_bound
|
||||
// Access: Protected, Virtual
|
||||
// Description: Recomputes the dynamic bounding volume for this
|
||||
// object. This is the bounding volume for the node and
|
||||
|
|
@ -242,7 +242,7 @@ output(ostream &out) const {
|
|||
// function just so we can piggyback on it the
|
||||
// setting the _net_collide_mask bits.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BoundingVolume *qpCollisionNode::
|
||||
BoundingVolume *CollisionNode::
|
||||
recompute_bound() {
|
||||
BoundingVolume *result = PandaNode::recompute_bound();
|
||||
add_net_collide_mask(get_into_collide_mask());
|
||||
|
|
@ -250,14 +250,14 @@ recompute_bound() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::recompute_internal_bound
|
||||
// Function: CollisionNode::recompute_internal_bound
|
||||
// Access: Protected, Virtual
|
||||
// Description: Called when needed to recompute the node's
|
||||
// _internal_bound object. Nodes that contain anything
|
||||
// of substance should redefine this to do the right
|
||||
// thing.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
BoundingVolume *qpCollisionNode::
|
||||
BoundingVolume *CollisionNode::
|
||||
recompute_internal_bound() {
|
||||
// First, get ourselves a fresh, empty bounding volume.
|
||||
BoundingVolume *bound = PandaNode::recompute_internal_bound();
|
||||
|
|
@ -294,23 +294,23 @@ recompute_internal_bound() {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::register_with_read_factory
|
||||
// Function: CollisionNode::register_with_read_factory
|
||||
// Access: Public, Static
|
||||
// Description: Tells the BamReader how to create objects of type
|
||||
// qpCollisionNode.
|
||||
// CollisionNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionNode::
|
||||
void CollisionNode::
|
||||
register_with_read_factory() {
|
||||
BamReader::get_factory()->register_factory(get_class_type(), make_from_bam);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::write_datagram
|
||||
// Function: CollisionNode::write_datagram
|
||||
// Access: Public, Virtual
|
||||
// Description: Writes the contents of this object to the datagram
|
||||
// for shipping out to a Bam file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionNode::
|
||||
void CollisionNode::
|
||||
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||
PandaNode::write_datagram(manager, dg);
|
||||
|
||||
|
|
@ -326,13 +326,13 @@ write_datagram(BamWriter *manager, Datagram &dg) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::complete_pointers
|
||||
// Function: CollisionNode::complete_pointers
|
||||
// Access: Public, Virtual
|
||||
// Description: Receives an array of pointers, one for each time
|
||||
// manager->read_pointer() was called in fillin().
|
||||
// Returns the number of pointers processed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int qpCollisionNode::
|
||||
int CollisionNode::
|
||||
complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
||||
int pi = PandaNode::complete_pointers(p_list, manager);
|
||||
|
||||
|
|
@ -345,16 +345,16 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::make_from_bam
|
||||
// Function: CollisionNode::make_from_bam
|
||||
// Access: Protected, Static
|
||||
// Description: This function is called by the BamReader's factory
|
||||
// when a new object of type qpCollisionNode is encountered
|
||||
// in the Bam file. It should create the qpCollisionNode
|
||||
// when a new object of type CollisionNode is encountered
|
||||
// in the Bam file. It should create the CollisionNode
|
||||
// and extract its information from the file.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
TypedWritable *qpCollisionNode::
|
||||
TypedWritable *CollisionNode::
|
||||
make_from_bam(const FactoryParams ¶ms) {
|
||||
qpCollisionNode *node = new qpCollisionNode("");
|
||||
CollisionNode *node = new CollisionNode("");
|
||||
DatagramIterator scan;
|
||||
BamReader *manager;
|
||||
|
||||
|
|
@ -365,13 +365,13 @@ make_from_bam(const FactoryParams ¶ms) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionNode::fillin
|
||||
// Function: CollisionNode::fillin
|
||||
// Access: Protected
|
||||
// Description: This internal function is called by make_from_bam to
|
||||
// read in all of the relevant data from the BamFile for
|
||||
// the new qpCollisionNode.
|
||||
// the new CollisionNode.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionNode::
|
||||
void CollisionNode::
|
||||
fillin(DatagramIterator &scan, BamReader *manager) {
|
||||
PandaNode::fillin(scan, manager);
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionNode.h
|
||||
// Filename: collisionNode.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONNODE_H
|
||||
#define qpCOLLISIONNODE_H
|
||||
#ifndef COLLISIONNODE_H
|
||||
#define COLLISIONNODE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
|
|
@ -34,22 +34,22 @@
|
|||
// with, or an animated object twirling around in the
|
||||
// world and running into things.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionNode : public PandaNode {
|
||||
class EXPCL_PANDA CollisionNode : public PandaNode {
|
||||
PUBLISHED:
|
||||
qpCollisionNode(const string &name);
|
||||
CollisionNode(const string &name);
|
||||
|
||||
protected:
|
||||
qpCollisionNode(const qpCollisionNode ©);
|
||||
CollisionNode(const CollisionNode ©);
|
||||
|
||||
public:
|
||||
virtual ~qpCollisionNode();
|
||||
virtual ~CollisionNode();
|
||||
virtual PandaNode *make_copy() const;
|
||||
virtual bool preserve_name() const;
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
virtual PandaNode *combine_with(PandaNode *other);
|
||||
|
||||
virtual bool has_cull_callback() const;
|
||||
virtual bool cull_callback(qpCullTraverser *trav, CullTraverserData &data);
|
||||
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public:
|
|||
}
|
||||
static void init_type(void) {
|
||||
PandaNode::init_type();
|
||||
register_type(_type_handle, "qpCollisionNode",
|
||||
register_type(_type_handle, "CollisionNode",
|
||||
PandaNode::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type(void) const {
|
||||
|
|
@ -110,6 +110,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpcollisionNode.I"
|
||||
#include "collisionNode.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -18,14 +18,14 @@
|
|||
|
||||
|
||||
#include "collisionPlane.h"
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "collisionSphere.h"
|
||||
#include "collisionRay.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "pointerToArray.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "geom.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
|
|
@ -52,7 +52,7 @@ make_copy() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPlane::
|
||||
test_intersection(qpCollisionHandler *, const qpCollisionEntry &,
|
||||
test_intersection(CollisionHandler *, const CollisionEntry &,
|
||||
const CollisionSolid *) const {
|
||||
// Planes cannot currently be intersected from, only into. Do not
|
||||
// add a CollisionPlane to a CollisionTraverser.
|
||||
|
|
@ -118,8 +118,8 @@ recompute_bound() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPlane::
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
const CollisionSphere *sphere;
|
||||
DCAST_INTO_R(sphere, entry.get_from(), 0);
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ test_intersection_from_sphere(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
LVector3f into_normal = get_normal() * entry.get_inv_wrt_space();
|
||||
float into_depth = from_radius - dist;
|
||||
|
|
@ -157,8 +157,8 @@ test_intersection_from_sphere(qpCollisionHandler *record,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPlane::
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
const CollisionRay *ray;
|
||||
DCAST_INTO_R(ray, entry.get_from(), 0);
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ test_intersection_from_ray(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
LPoint3f into_intersection_point = from_origin + t * from_direction;
|
||||
new_entry->set_into_intersection_point(into_intersection_point);
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ public:
|
|||
virtual CollisionSolid *make_copy();
|
||||
|
||||
virtual int
|
||||
test_intersection(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record,
|
||||
const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const;
|
||||
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
|
@ -63,11 +63,11 @@ protected:
|
|||
|
||||
protected:
|
||||
virtual int
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
|
||||
virtual void fill_viz_geom();
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
|
||||
#include "collisionPolygon.h"
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "collisionSphere.h"
|
||||
#include "collisionRay.h"
|
||||
#include "collisionSegment.h"
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "boundingSphere.h"
|
||||
#include "pointerToArray.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "geom.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
|
|
@ -126,7 +126,7 @@ verify_points(const LPoint3f *begin, const LPoint3f *end) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPolygon::
|
||||
test_intersection(qpCollisionHandler *, const qpCollisionEntry &,
|
||||
test_intersection(CollisionHandler *, const CollisionEntry &,
|
||||
const CollisionSolid *into) const {
|
||||
// Polygons cannot currently be intersected from, only into. Do not
|
||||
// add a CollisionPolygon to a CollisionTraverser.
|
||||
|
|
@ -231,8 +231,8 @@ recompute_bound() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPolygon::
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
if (_points.size() < 3) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -321,7 +321,7 @@ test_intersection_from_sphere(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
LVector3f into_normal = get_normal() * entry.get_inv_wrt_space();
|
||||
float into_depth = from_radius - dist;
|
||||
|
|
@ -339,8 +339,8 @@ test_intersection_from_sphere(qpCollisionHandler *record,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPolygon::
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
if (_points.size() < 3) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -373,7 +373,7 @@ test_intersection_from_ray(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
new_entry->set_into_intersection_point(plane_point);
|
||||
|
||||
|
|
@ -387,8 +387,8 @@ test_intersection_from_ray(qpCollisionHandler *record,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionPolygon::
|
||||
test_intersection_from_segment(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_segment(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
if (_points.size() < 3) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -423,7 +423,7 @@ test_intersection_from_segment(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
new_entry->set_into_intersection_point(plane_point);
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ public:
|
|||
|
||||
|
||||
virtual int
|
||||
test_intersection(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record,
|
||||
const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const;
|
||||
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
|
@ -65,14 +65,14 @@ protected:
|
|||
|
||||
protected:
|
||||
virtual int
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_segment(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_segment(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
|
||||
virtual void fill_viz_geom();
|
||||
|
||||
|
|
|
|||
|
|
@ -137,13 +137,13 @@ get_direction() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionRay::set_from_lens
|
||||
// Access: Public
|
||||
// Description: Accepts a qpLensNode and a 2-d point in the range
|
||||
// Description: Accepts a LensNode and a 2-d point in the range
|
||||
// [-1,1]. Sets the CollisionRay so that it begins at
|
||||
// the qpLensNode's near plane and extends to
|
||||
// the LensNode's near plane and extends to
|
||||
// infinity, making it suitable for picking objects from
|
||||
// the screen given a camera and a mouse location.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool CollisionRay::
|
||||
set_from_lens(qpLensNode *camera, float px, float py) {
|
||||
set_from_lens(LensNode *camera, float px, float py) {
|
||||
return set_from_lens(camera, LPoint2f(px, py));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "collisionRay.h"
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "config_collide.h"
|
||||
#include "geom.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "geomLinestrip.h"
|
||||
#include "boundingLine.h"
|
||||
#include "qplensNode.h"
|
||||
#include "lensNode.h"
|
||||
#include "lens.h"
|
||||
#include "datagram.h"
|
||||
#include "datagramIterator.h"
|
||||
|
|
@ -50,7 +50,7 @@ make_copy() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionRay::
|
||||
test_intersection(qpCollisionHandler *record, const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record, const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const {
|
||||
return into->test_intersection_from_ray(record, entry);
|
||||
}
|
||||
|
|
@ -94,9 +94,9 @@ output(ostream &out) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionRay::set_from_lens
|
||||
// Access: Public
|
||||
// Description: Accepts a qpLensNode and a 2-d point in the range
|
||||
// Description: Accepts a LensNode and a 2-d point in the range
|
||||
// [-1,1]. Sets the CollisionRay so that it begins at
|
||||
// the qpLensNode's near plane and extends to
|
||||
// the LensNode's near plane and extends to
|
||||
// infinity, making it suitable for picking objects from
|
||||
// the screen given a camera and a mouse location.
|
||||
//
|
||||
|
|
@ -104,7 +104,7 @@ output(ostream &out) const {
|
|||
// otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CollisionRay::
|
||||
set_from_lens(qpLensNode *camera, const LPoint2f &point) {
|
||||
set_from_lens(LensNode *camera, const LPoint2f &point) {
|
||||
Lens *lens = camera->get_lens();
|
||||
|
||||
bool success = true;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "collisionSolid.h"
|
||||
|
||||
class qpLensNode;
|
||||
class LensNode;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CollisionRay
|
||||
|
|
@ -45,8 +45,8 @@ public:
|
|||
virtual CollisionSolid *make_copy();
|
||||
|
||||
virtual int
|
||||
test_intersection(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record,
|
||||
const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const;
|
||||
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
|
@ -63,8 +63,8 @@ PUBLISHED:
|
|||
INLINE void set_direction(float x, float y, float z);
|
||||
INLINE const LVector3f &get_direction() const;
|
||||
|
||||
bool set_from_lens(qpLensNode *camera, const LPoint2f &point);
|
||||
INLINE bool set_from_lens(qpLensNode *camera, float px, float py);
|
||||
bool set_from_lens(LensNode *camera, const LPoint2f &point);
|
||||
INLINE bool set_from_lens(LensNode *camera, float px, float py);
|
||||
|
||||
protected:
|
||||
virtual BoundingVolume *recompute_bound();
|
||||
|
|
|
|||
|
|
@ -140,13 +140,13 @@ get_point_b() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionSegment::set_from_lens
|
||||
// Access: Public
|
||||
// Description: Accepts a qpLensNode and a 2-d point in the range
|
||||
// Description: Accepts a LensNode and a 2-d point in the range
|
||||
// [-1,1]. Sets the CollisionSegment so that it begins at
|
||||
// the qpLensNode's near plane and extends to the
|
||||
// the LensNode's near plane and extends to the
|
||||
// far plane, making it suitable for picking objects
|
||||
// from the screen given a camera and a mouse location.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool CollisionSegment::
|
||||
set_from_lens(qpLensNode *camera, float px, float py) {
|
||||
set_from_lens(LensNode *camera, float px, float py) {
|
||||
return set_from_lens(camera, LPoint2f(px, py));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@
|
|||
|
||||
|
||||
#include "collisionSegment.h"
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "geom.h"
|
||||
#include "qplensNode.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "lensNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "lens.h"
|
||||
#include "geomLine.h"
|
||||
#include "geometricBoundingVolume.h"
|
||||
|
|
@ -52,7 +52,7 @@ make_copy() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSegment::
|
||||
test_intersection(qpCollisionHandler *record, const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record, const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const {
|
||||
return into->test_intersection_from_segment(record, entry);
|
||||
}
|
||||
|
|
@ -96,9 +96,9 @@ output(ostream &out) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CollisionSegment::set_from_lens
|
||||
// Access: Public
|
||||
// Description: Accepts a qpLensNode and a 2-d point in the range
|
||||
// Description: Accepts a LensNode and a 2-d point in the range
|
||||
// [-1,1]. Sets the CollisionSegment so that it begins at
|
||||
// the qpLensNode's near plane and extends to the
|
||||
// the LensNode's near plane and extends to the
|
||||
// far plane, making it suitable for picking objects
|
||||
// from the screen given a camera and a mouse location.
|
||||
//
|
||||
|
|
@ -106,7 +106,7 @@ output(ostream &out) const {
|
|||
// otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool CollisionSegment::
|
||||
set_from_lens(qpLensNode *camera, const LPoint2f &point) {
|
||||
set_from_lens(LensNode *camera, const LPoint2f &point) {
|
||||
Lens *proj = camera->get_lens();
|
||||
|
||||
bool success = true;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "collisionSolid.h"
|
||||
|
||||
class qpLensNode;
|
||||
class LensNode;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CollisionSegment
|
||||
|
|
@ -48,8 +48,8 @@ public:
|
|||
virtual CollisionSolid *make_copy();
|
||||
|
||||
virtual int
|
||||
test_intersection(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record,
|
||||
const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const;
|
||||
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
|
@ -66,8 +66,8 @@ PUBLISHED:
|
|||
INLINE void set_point_b(float x, float y, float z);
|
||||
INLINE const LPoint3f &get_point_b() const;
|
||||
|
||||
bool set_from_lens(qpLensNode *camera, const LPoint2f &point);
|
||||
INLINE bool set_from_lens(qpLensNode *camera, float px, float py);
|
||||
bool set_from_lens(LensNode *camera, const LPoint2f &point);
|
||||
INLINE bool set_from_lens(LensNode *camera, float px, float py);
|
||||
|
||||
protected:
|
||||
virtual BoundingVolume *recompute_bound();
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include "colorAttrib.h"
|
||||
#include "renderModeAttrib.h"
|
||||
#include "transparencyAttrib.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
|
||||
TypeHandle CollisionSolid::_type_handle;
|
||||
|
||||
|
|
@ -77,11 +77,11 @@ CollisionSolid::
|
|||
// traversal to render the CollisionNodes that have been
|
||||
// made visible.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpGeomNode *CollisionSolid::
|
||||
GeomNode *CollisionSolid::
|
||||
get_viz() {
|
||||
if (_viz_geom_stale) {
|
||||
if (_viz_geom == (qpGeomNode *)NULL) {
|
||||
_viz_geom = new qpGeomNode("viz");
|
||||
if (_viz_geom == (GeomNode *)NULL) {
|
||||
_viz_geom = new GeomNode("viz");
|
||||
} else {
|
||||
_viz_geom->remove_all_geoms();
|
||||
}
|
||||
|
|
@ -117,8 +117,8 @@ write(ostream &out, int indent_level) const {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSolid::
|
||||
test_intersection_from_sphere(qpCollisionHandler *,
|
||||
const qpCollisionEntry &) const {
|
||||
test_intersection_from_sphere(CollisionHandler *,
|
||||
const CollisionEntry &) const {
|
||||
report_undefined_intersection_test(CollisionSphere::get_class_type(),
|
||||
get_type());
|
||||
return 0;
|
||||
|
|
@ -130,8 +130,8 @@ test_intersection_from_sphere(qpCollisionHandler *,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSolid::
|
||||
test_intersection_from_ray(qpCollisionHandler *,
|
||||
const qpCollisionEntry &) const {
|
||||
test_intersection_from_ray(CollisionHandler *,
|
||||
const CollisionEntry &) const {
|
||||
report_undefined_intersection_test(CollisionRay::get_class_type(),
|
||||
get_type());
|
||||
return 0;
|
||||
|
|
@ -143,8 +143,8 @@ test_intersection_from_ray(qpCollisionHandler *,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSolid::
|
||||
test_intersection_from_segment(qpCollisionHandler *,
|
||||
const qpCollisionEntry &) const {
|
||||
test_intersection_from_segment(CollisionHandler *,
|
||||
const CollisionEntry &) const {
|
||||
report_undefined_intersection_test(CollisionSegment::get_class_type(),
|
||||
get_type());
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -26,13 +26,13 @@
|
|||
#include "luse.h"
|
||||
#include "pointerTo.h"
|
||||
#include "renderState.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
|
||||
class qpCollisionHandler;
|
||||
class qpCollisionEntry;
|
||||
class CollisionHandler;
|
||||
class CollisionEntry;
|
||||
class CollisionSphere;
|
||||
class qpGeomNode;
|
||||
class qpCollisionNode;
|
||||
class GeomNode;
|
||||
class CollisionNode;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Class : CollisionSolid
|
||||
|
|
@ -63,13 +63,13 @@ PUBLISHED:
|
|||
|
||||
public:
|
||||
virtual int
|
||||
test_intersection(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record,
|
||||
const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const=0;
|
||||
|
||||
virtual void xform(const LMatrix4f &mat)=0;
|
||||
|
||||
qpGeomNode *get_viz();
|
||||
GeomNode *get_viz();
|
||||
|
||||
PUBLISHED:
|
||||
virtual void output(ostream &out) const;
|
||||
|
|
@ -77,14 +77,14 @@ PUBLISHED:
|
|||
|
||||
protected:
|
||||
virtual int
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_segment(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_segment(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
|
||||
static void
|
||||
report_undefined_intersection_test(TypeHandle from_type,
|
||||
|
|
@ -97,7 +97,7 @@ protected:
|
|||
CPT(RenderState) get_wireframe_viz_state();
|
||||
CPT(RenderState) get_other_viz_state();
|
||||
|
||||
PT(qpGeomNode) _viz_geom;
|
||||
PT(GeomNode) _viz_geom;
|
||||
bool _viz_geom_stale;
|
||||
bool _tangible;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
#include "collisionSphere.h"
|
||||
#include "collisionRay.h"
|
||||
#include "collisionSegment.h"
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "boundingSphere.h"
|
||||
|
|
@ -50,7 +50,7 @@ make_copy() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSphere::
|
||||
test_intersection(qpCollisionHandler *record, const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record, const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const {
|
||||
return into->test_intersection_from_sphere(record, entry);
|
||||
}
|
||||
|
|
@ -118,8 +118,8 @@ recompute_bound() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSphere::
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
const CollisionSphere *sphere;
|
||||
DCAST_INTO_R(sphere, entry.get_from(), 0);
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ test_intersection_from_sphere(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
float dist = sqrtf(dist2);
|
||||
LVector3f into_normal = normalize(vec);
|
||||
|
|
@ -164,8 +164,8 @@ test_intersection_from_sphere(qpCollisionHandler *record,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSphere::
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
const CollisionRay *ray;
|
||||
DCAST_INTO_R(ray, entry.get_from(), 0);
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ test_intersection_from_ray(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
LPoint3f into_intersection_point;
|
||||
if (t1 < 0.0) {
|
||||
|
|
@ -208,8 +208,8 @@ test_intersection_from_ray(qpCollisionHandler *record,
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int CollisionSphere::
|
||||
test_intersection_from_segment(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const {
|
||||
test_intersection_from_segment(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const {
|
||||
const CollisionSegment *segment;
|
||||
DCAST_INTO_R(segment, entry.get_from(), 0);
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ test_intersection_from_segment(qpCollisionHandler *record,
|
|||
<< "intersection detected from " << *entry.get_from_node() << " into "
|
||||
<< entry.get_into_node_path() << "\n";
|
||||
}
|
||||
PT(qpCollisionEntry) new_entry = new qpCollisionEntry(entry);
|
||||
PT(CollisionEntry) new_entry = new CollisionEntry(entry);
|
||||
|
||||
LPoint3f into_intersection_point;
|
||||
if (t1 < 0.0) {
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ public:
|
|||
virtual CollisionSolid *make_copy();
|
||||
|
||||
virtual int
|
||||
test_intersection(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry,
|
||||
test_intersection(CollisionHandler *record,
|
||||
const CollisionEntry &entry,
|
||||
const CollisionSolid *into) const;
|
||||
|
||||
virtual void xform(const LMatrix4f &mat);
|
||||
|
|
@ -60,14 +60,14 @@ protected:
|
|||
|
||||
protected:
|
||||
virtual int
|
||||
test_intersection_from_sphere(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_sphere(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_ray(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_ray(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
virtual int
|
||||
test_intersection_from_segment(qpCollisionHandler *record,
|
||||
const qpCollisionEntry &entry) const;
|
||||
test_intersection_from_segment(CollisionHandler *record,
|
||||
const CollisionEntry &entry) const;
|
||||
|
||||
virtual void fill_viz_geom();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionTraverser.I
|
||||
// Filename: collisionTraverser.I
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionTraverser.cxx
|
||||
// Filename: collisionTraverser.cxx
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,67 +16,67 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpcollisionTraverser.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "collisionTraverser.h"
|
||||
#include "collisionNode.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "collisionPolygon.h"
|
||||
#include "config_collide.h"
|
||||
|
||||
#include "transformState.h"
|
||||
#include "qpgeomNode.h"
|
||||
#include "geomNode.h"
|
||||
#include "geom.h"
|
||||
#include "qpnodePath.h"
|
||||
#include "nodePath.h"
|
||||
#include "pStatTimer.h"
|
||||
#include "indent.h"
|
||||
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector qpCollisionTraverser::_collisions_pcollector("App:Collisions");
|
||||
PStatCollector CollisionTraverser::_collisions_pcollector("App:Collisions");
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::Constructor
|
||||
// Function: CollisionTraverser::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionTraverser::
|
||||
qpCollisionTraverser() {
|
||||
CollisionTraverser::
|
||||
CollisionTraverser() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::Destructor
|
||||
// Function: CollisionTraverser::Destructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionTraverser::
|
||||
~qpCollisionTraverser() {
|
||||
CollisionTraverser::
|
||||
~CollisionTraverser() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::add_collider
|
||||
// Function: CollisionTraverser::add_collider
|
||||
// Access: Public
|
||||
// Description: Adds a new qpCollisionNode, representing an object that
|
||||
// Description: Adds a new CollisionNode, representing an object that
|
||||
// will be tested for collisions into other objects,
|
||||
// along with the handler that will serve each detected
|
||||
// collision. Each qpCollisionNode may be served by only
|
||||
// collision. Each CollisionNode may be served by only
|
||||
// one handler at a time, but a given handler may serve
|
||||
// many qpCollisionNodes.
|
||||
// many CollisionNodes.
|
||||
//
|
||||
// The handler that serves a particular node may be
|
||||
// changed from time to time by calling add_collider()
|
||||
// again on the same node.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
add_collider(qpCollisionNode *node, qpCollisionHandler *handler) {
|
||||
void CollisionTraverser::
|
||||
add_collider(CollisionNode *node, CollisionHandler *handler) {
|
||||
nassertv(_ordered_colliders.size() == _colliders.size());
|
||||
nassertv(node != (qpCollisionNode *)NULL);
|
||||
nassertv(handler != (qpCollisionHandler *)NULL);
|
||||
nassertv(node != (CollisionNode *)NULL);
|
||||
nassertv(handler != (CollisionHandler *)NULL);
|
||||
|
||||
Colliders::iterator ci = _colliders.find(node);
|
||||
if (ci != _colliders.end()) {
|
||||
// We already knew about this collider.
|
||||
if ((*ci).second != handler) {
|
||||
// Change the handler.
|
||||
PT(qpCollisionHandler) old_handler = (*ci).second;
|
||||
PT(CollisionHandler) old_handler = (*ci).second;
|
||||
(*ci).second = handler;
|
||||
|
||||
// Now update our own reference counts within our handler set.
|
||||
|
|
@ -113,16 +113,16 @@ add_collider(qpCollisionNode *node, qpCollisionHandler *handler) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::remove_collider
|
||||
// Function: CollisionTraverser::remove_collider
|
||||
// Access: Public
|
||||
// Description: Removes the collider (and its associated handler)
|
||||
// from the set of qpCollisionNodes that will be tested
|
||||
// from the set of CollisionNodes that will be tested
|
||||
// each frame for collisions into other objects.
|
||||
// Returns true if the definition was found and removed,
|
||||
// false if it wasn't present to begin with.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionTraverser::
|
||||
remove_collider(qpCollisionNode *node) {
|
||||
bool CollisionTraverser::
|
||||
remove_collider(CollisionNode *node) {
|
||||
nassertr(_ordered_colliders.size() == _colliders.size(), false);
|
||||
|
||||
Colliders::iterator ci = _colliders.find(node);
|
||||
|
|
@ -131,7 +131,7 @@ remove_collider(qpCollisionNode *node) {
|
|||
return false;
|
||||
}
|
||||
|
||||
qpCollisionHandler *handler = (*ci).second;
|
||||
CollisionHandler *handler = (*ci).second;
|
||||
|
||||
// Update the set of handlers.
|
||||
Handlers::iterator hi = _handlers.find(handler);
|
||||
|
|
@ -154,37 +154,37 @@ remove_collider(qpCollisionNode *node) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::has_collider
|
||||
// Function: CollisionTraverser::has_collider
|
||||
// Access: Public
|
||||
// Description: Returns true if the indicated node is current in the
|
||||
// set of nodes that will be tested each frame for
|
||||
// collisions into other objects.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
bool qpCollisionTraverser::
|
||||
has_collider(qpCollisionNode *node) const {
|
||||
bool CollisionTraverser::
|
||||
has_collider(CollisionNode *node) const {
|
||||
Colliders::const_iterator ci = _colliders.find(node);
|
||||
return (ci != _colliders.end());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::get_num_colliders
|
||||
// Function: CollisionTraverser::get_num_colliders
|
||||
// Access: Public
|
||||
// Description: Returns the number of qpCollisionNodes that have been
|
||||
// Description: Returns the number of CollisionNodes that have been
|
||||
// added to the traverser via add_collider().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int qpCollisionTraverser::
|
||||
int CollisionTraverser::
|
||||
get_num_colliders() const {
|
||||
nassertr(_ordered_colliders.size() == _colliders.size(), 0);
|
||||
return _ordered_colliders.size();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::get_collider
|
||||
// Function: CollisionTraverser::get_collider
|
||||
// Access: Public
|
||||
// Description: Returns the nth qpCollisionNode that has been
|
||||
// Description: Returns the nth CollisionNode that has been
|
||||
// added to the traverser via add_collider().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionNode *qpCollisionTraverser::
|
||||
CollisionNode *CollisionTraverser::
|
||||
get_collider(int n) const {
|
||||
nassertr(_ordered_colliders.size() == _colliders.size(), NULL);
|
||||
nassertr(n >= 0 && n < (int)_ordered_colliders.size(), NULL);
|
||||
|
|
@ -192,14 +192,14 @@ get_collider(int n) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::get_handler
|
||||
// Function: CollisionTraverser::get_handler
|
||||
// Access: Public
|
||||
// Description: Returns the handler that is currently assigned to
|
||||
// serve the indicated collision node, or NULL if the
|
||||
// node is not on the traverser's set of active nodes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpCollisionHandler *qpCollisionTraverser::
|
||||
get_handler(qpCollisionNode *node) const {
|
||||
CollisionHandler *CollisionTraverser::
|
||||
get_handler(CollisionNode *node) const {
|
||||
Colliders::const_iterator ci = _colliders.find(node);
|
||||
if (ci != _colliders.end()) {
|
||||
return (*ci).second;
|
||||
|
|
@ -208,12 +208,12 @@ get_handler(qpCollisionNode *node) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::clear_colliders
|
||||
// Function: CollisionTraverser::clear_colliders
|
||||
// Access: Public
|
||||
// Description: Completely empties the set of collision nodes and
|
||||
// their associated handlers.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
void CollisionTraverser::
|
||||
clear_colliders() {
|
||||
_colliders.clear();
|
||||
_ordered_colliders.clear();
|
||||
|
|
@ -221,15 +221,15 @@ clear_colliders() {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::traverse
|
||||
// Function: CollisionTraverser::traverse
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
traverse(const qpNodePath &root) {
|
||||
void CollisionTraverser::
|
||||
traverse(const NodePath &root) {
|
||||
PStatTimer timer(_collisions_pcollector);
|
||||
|
||||
qpCollisionLevelState level_state(root);
|
||||
CollisionLevelState level_state(root);
|
||||
prepare_colliders(level_state);
|
||||
|
||||
Handlers::iterator hi;
|
||||
|
|
@ -254,32 +254,32 @@ traverse(const qpNodePath &root) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::output
|
||||
// Function: CollisionTraverser::output
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
void CollisionTraverser::
|
||||
output(ostream &out) const {
|
||||
out << "qpCollisionTraverser, " << _colliders.size()
|
||||
out << "CollisionTraverser, " << _colliders.size()
|
||||
<< " colliders and " << _handlers.size() << " handlers.\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::write
|
||||
// Function: CollisionTraverser::write
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
void CollisionTraverser::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level)
|
||||
<< "qpCollisionTraverser, " << _colliders.size()
|
||||
<< "CollisionTraverser, " << _colliders.size()
|
||||
<< " colliders and " << _handlers.size() << " handlers:\n";
|
||||
Colliders::const_iterator ci;
|
||||
for (ci = _colliders.begin(); ci != _colliders.end(); ++ci) {
|
||||
qpCollisionNode *cnode = (*ci).first;
|
||||
qpCollisionHandler *handler = (*ci).second;
|
||||
nassertv(cnode != (qpCollisionNode *)NULL);
|
||||
nassertv(handler != (qpCollisionHandler *)NULL);
|
||||
CollisionNode *cnode = (*ci).first;
|
||||
CollisionHandler *handler = (*ci).second;
|
||||
nassertv(cnode != (CollisionNode *)NULL);
|
||||
nassertv(handler != (CollisionHandler *)NULL);
|
||||
|
||||
indent(out, indent_level + 2)
|
||||
<< *cnode << " handled by " << handler->get_type() << "\n";
|
||||
|
|
@ -292,23 +292,23 @@ write(ostream &out, int indent_level) const {
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::prepare_colliders
|
||||
// Function: CollisionTraverser::prepare_colliders
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
prepare_colliders(qpCollisionLevelState &level_state) {
|
||||
void CollisionTraverser::
|
||||
prepare_colliders(CollisionLevelState &level_state) {
|
||||
level_state.clear();
|
||||
level_state.reserve(_colliders.size());
|
||||
|
||||
int i = 0;
|
||||
while (i < (int)_ordered_colliders.size()) {
|
||||
qpCollisionNode *cnode = _ordered_colliders[i];
|
||||
CollisionNode *cnode = _ordered_colliders[i];
|
||||
|
||||
qpCollisionLevelState::ColliderDef def;
|
||||
CollisionLevelState::ColliderDef def;
|
||||
def._node = cnode;
|
||||
qpNodePath root;
|
||||
qpNodePath cnode_path(cnode);
|
||||
NodePath root;
|
||||
NodePath cnode_path(cnode);
|
||||
def._space = cnode_path.get_mat(root);
|
||||
def._inv_space = root.get_mat(cnode_path);
|
||||
|
||||
|
|
@ -335,22 +335,22 @@ prepare_colliders(qpCollisionLevelState &level_state) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::r_traverse
|
||||
// Function: CollisionTraverser::r_traverse
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
r_traverse(qpCollisionLevelState &level_state) {
|
||||
void CollisionTraverser::
|
||||
r_traverse(CollisionLevelState &level_state) {
|
||||
if (!level_state.any_in_bounds()) {
|
||||
return;
|
||||
}
|
||||
level_state.apply_transform();
|
||||
|
||||
PandaNode *node = level_state.node();
|
||||
if (node->is_exact_type(qpCollisionNode::get_class_type())) {
|
||||
if (node->is_exact_type(CollisionNode::get_class_type())) {
|
||||
level_state.reached_collision_node();
|
||||
|
||||
qpCollisionNode *cnode;
|
||||
CollisionNode *cnode;
|
||||
DCAST_INTO_V(cnode, node);
|
||||
const BoundingVolume &node_bv = cnode->get_bound();
|
||||
const GeometricBoundingVolume *node_gbv = NULL;
|
||||
|
|
@ -358,10 +358,10 @@ r_traverse(qpCollisionLevelState &level_state) {
|
|||
DCAST_INTO_V(node_gbv, &node_bv);
|
||||
}
|
||||
|
||||
qpCollisionEntry entry;
|
||||
CollisionEntry entry;
|
||||
entry._into_node = cnode;
|
||||
entry._into_node_path = level_state.get_node_path();
|
||||
entry._into_space = entry._into_node_path.get_mat(qpNodePath());
|
||||
entry._into_space = entry._into_node_path.get_mat(NodePath());
|
||||
|
||||
int num_colliders = level_state.get_num_colliders();
|
||||
for (int c = 0; c < num_colliders; c++) {
|
||||
|
|
@ -373,7 +373,7 @@ r_traverse(qpCollisionLevelState &level_state) {
|
|||
entry._from = level_state.get_collider(c);
|
||||
entry._from_space = level_state.get_space(c);
|
||||
|
||||
qpNodePath root;
|
||||
NodePath root;
|
||||
const LMatrix4f &into_space_inv =
|
||||
root.get_mat(entry._into_node_path);
|
||||
entry._wrt_space = entry._from_space * into_space_inv;
|
||||
|
|
@ -396,7 +396,7 @@ r_traverse(qpCollisionLevelState &level_state) {
|
|||
}
|
||||
#endif
|
||||
|
||||
qpGeomNode *gnode;
|
||||
GeomNode *gnode;
|
||||
DCAST_INTO_V(gnode, node);
|
||||
const BoundingVolume &node_bv = gnode->get_bound();
|
||||
const GeometricBoundingVolume *node_gbv = NULL;
|
||||
|
|
@ -404,10 +404,10 @@ r_traverse(qpCollisionLevelState &level_state) {
|
|||
DCAST_INTO_V(node_gbv, &node_bv);
|
||||
}
|
||||
|
||||
qpCollisionEntry entry;
|
||||
CollisionEntry entry;
|
||||
entry._into_node = gnode;
|
||||
entry._into_node_path = level_state.get_node_path();
|
||||
entry._into_space = entry._into_node_path.get_mat(qpNodePath());
|
||||
entry._into_space = entry._into_node_path.get_mat(NodePath());
|
||||
|
||||
int num_colliders = level_state.get_num_colliders();
|
||||
for (int c = 0; c < num_colliders; c++) {
|
||||
|
|
@ -417,7 +417,7 @@ r_traverse(qpCollisionLevelState &level_state) {
|
|||
entry._from = level_state.get_collider(c);
|
||||
entry._from_space = level_state.get_space(c);
|
||||
|
||||
qpNodePath root;
|
||||
NodePath root;
|
||||
const LMatrix4f &into_space_inv =
|
||||
root.get_mat(entry._into_node_path);
|
||||
entry._wrt_space = entry._from_space * into_space_inv;
|
||||
|
|
@ -434,18 +434,18 @@ r_traverse(qpCollisionLevelState &level_state) {
|
|||
|
||||
int num_children = node->get_num_children();
|
||||
for (int i = 0; i < num_children; i++) {
|
||||
qpCollisionLevelState next_state(level_state, node->get_child(i));
|
||||
CollisionLevelState next_state(level_state, node->get_child(i));
|
||||
r_traverse(next_state);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::compare_collider_to_node
|
||||
// Function: CollisionTraverser::compare_collider_to_node
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
compare_collider_to_node(qpCollisionEntry &entry,
|
||||
void CollisionTraverser::
|
||||
compare_collider_to_node(CollisionEntry &entry,
|
||||
const GeometricBoundingVolume *from_parent_gbv,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *into_node_gbv) {
|
||||
|
|
@ -456,7 +456,7 @@ compare_collider_to_node(qpCollisionEntry &entry,
|
|||
}
|
||||
|
||||
if (within_node_bounds) {
|
||||
qpCollisionNode *cnode;
|
||||
CollisionNode *cnode;
|
||||
DCAST_INTO_V(cnode, entry._into_node);
|
||||
int num_solids = cnode->get_num_solids();
|
||||
for (int s = 0; s < num_solids; s++) {
|
||||
|
|
@ -481,12 +481,12 @@ compare_collider_to_node(qpCollisionEntry &entry,
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::compare_collider_to_geom_node
|
||||
// Function: CollisionTraverser::compare_collider_to_geom_node
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
compare_collider_to_geom_node(qpCollisionEntry &entry,
|
||||
void CollisionTraverser::
|
||||
compare_collider_to_geom_node(CollisionEntry &entry,
|
||||
const GeometricBoundingVolume *from_parent_gbv,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *into_node_gbv) {
|
||||
|
|
@ -497,7 +497,7 @@ compare_collider_to_geom_node(qpCollisionEntry &entry,
|
|||
}
|
||||
|
||||
if (within_node_bounds) {
|
||||
qpGeomNode *gnode;
|
||||
GeomNode *gnode;
|
||||
DCAST_INTO_V(gnode, entry._into_node);
|
||||
int num_geoms = gnode->get_num_geoms();
|
||||
for (int s = 0; s < num_geoms; s++) {
|
||||
|
|
@ -523,12 +523,12 @@ compare_collider_to_geom_node(qpCollisionEntry &entry,
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::compare_collider_to_solid
|
||||
// Function: CollisionTraverser::compare_collider_to_solid
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
compare_collider_to_solid(qpCollisionEntry &entry,
|
||||
void CollisionTraverser::
|
||||
compare_collider_to_solid(CollisionEntry &entry,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *solid_gbv) {
|
||||
bool within_solid_bounds = true;
|
||||
|
|
@ -545,12 +545,12 @@ compare_collider_to_solid(qpCollisionEntry &entry,
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpCollisionTraverser::compare_collider_to_geom
|
||||
// Function: CollisionTraverser::compare_collider_to_geom
|
||||
// Access: Private
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpCollisionTraverser::
|
||||
compare_collider_to_geom(qpCollisionEntry &entry, Geom *geom,
|
||||
void CollisionTraverser::
|
||||
compare_collider_to_geom(CollisionEntry &entry, Geom *geom,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *geom_gbv) {
|
||||
bool within_geom_bounds = true;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpcollisionTraverser.h
|
||||
// Filename: collisionTraverser.h
|
||||
// Created by: drose (16Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,88 +16,88 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpCOLLISIONTRAVERSER_H
|
||||
#define qpCOLLISIONTRAVERSER_H
|
||||
#ifndef COLLISIONTRAVERSER_H
|
||||
#define COLLISIONTRAVERSER_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionLevelState.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionLevelState.h"
|
||||
|
||||
#include "pointerTo.h"
|
||||
#include "pStatCollector.h"
|
||||
|
||||
#include "pset.h"
|
||||
|
||||
class qpCollisionNode;
|
||||
class CollisionNode;
|
||||
class Geom;
|
||||
class qpNodePath;
|
||||
class qpCollisionEntry;
|
||||
class NodePath;
|
||||
class CollisionEntry;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpCollisionTraverser
|
||||
// Class : CollisionTraverser
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpCollisionTraverser {
|
||||
class EXPCL_PANDA CollisionTraverser {
|
||||
PUBLISHED:
|
||||
qpCollisionTraverser();
|
||||
~qpCollisionTraverser();
|
||||
CollisionTraverser();
|
||||
~CollisionTraverser();
|
||||
|
||||
void add_collider(qpCollisionNode *node, qpCollisionHandler *handler);
|
||||
bool remove_collider(qpCollisionNode *node);
|
||||
bool has_collider(qpCollisionNode *node) const;
|
||||
void add_collider(CollisionNode *node, CollisionHandler *handler);
|
||||
bool remove_collider(CollisionNode *node);
|
||||
bool has_collider(CollisionNode *node) const;
|
||||
int get_num_colliders() const;
|
||||
qpCollisionNode *get_collider(int n) const;
|
||||
qpCollisionHandler *get_handler(qpCollisionNode *node) const;
|
||||
CollisionNode *get_collider(int n) const;
|
||||
CollisionHandler *get_handler(CollisionNode *node) const;
|
||||
void clear_colliders();
|
||||
|
||||
void traverse(const qpNodePath &root);
|
||||
void traverse(const NodePath &root);
|
||||
|
||||
void output(ostream &out) const;
|
||||
void write(ostream &out, int indent_level) const;
|
||||
|
||||
private:
|
||||
void prepare_colliders(qpCollisionLevelState &state);
|
||||
void prepare_colliders(CollisionLevelState &state);
|
||||
|
||||
void r_traverse(qpCollisionLevelState &level_state);
|
||||
void r_traverse(CollisionLevelState &level_state);
|
||||
|
||||
void compare_collider_to_node(qpCollisionEntry &entry,
|
||||
void compare_collider_to_node(CollisionEntry &entry,
|
||||
const GeometricBoundingVolume *from_parent_gbv,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *into_node_gbv);
|
||||
void compare_collider_to_geom_node(qpCollisionEntry &entry,
|
||||
void compare_collider_to_geom_node(CollisionEntry &entry,
|
||||
const GeometricBoundingVolume *from_parent_gbv,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *into_node_gbv);
|
||||
void compare_collider_to_solid(qpCollisionEntry &entry,
|
||||
void compare_collider_to_solid(CollisionEntry &entry,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *solid_gbv);
|
||||
void compare_collider_to_geom(qpCollisionEntry &entry, Geom *geom,
|
||||
void compare_collider_to_geom(CollisionEntry &entry, Geom *geom,
|
||||
const GeometricBoundingVolume *from_node_gbv,
|
||||
const GeometricBoundingVolume *solid_gbv);
|
||||
|
||||
private:
|
||||
PT(qpCollisionHandler) _default_handler;
|
||||
PT(CollisionHandler) _default_handler;
|
||||
TypeHandle _graph_type;
|
||||
|
||||
typedef pmap<PT(qpCollisionNode), PT(qpCollisionHandler) > Colliders;
|
||||
typedef pmap<PT(CollisionNode), PT(CollisionHandler) > Colliders;
|
||||
Colliders _colliders;
|
||||
typedef pvector<qpCollisionNode *> OrderedColliders;
|
||||
typedef pvector<CollisionNode *> OrderedColliders;
|
||||
OrderedColliders _ordered_colliders;
|
||||
|
||||
typedef pmap<PT(qpCollisionHandler), int> Handlers;
|
||||
typedef pmap<PT(CollisionHandler), int> Handlers;
|
||||
Handlers _handlers;
|
||||
|
||||
// Statistics
|
||||
static PStatCollector _collisions_pcollector;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const qpCollisionTraverser &trav) {
|
||||
INLINE ostream &operator << (ostream &out, const CollisionTraverser &trav) {
|
||||
trav.output(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
#include "qpcollisionTraverser.I"
|
||||
#include "collisionTraverser.I"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -17,14 +17,14 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "config_collide.h"
|
||||
#include "qpcollisionEntry.h"
|
||||
#include "qpcollisionHandler.h"
|
||||
#include "qpcollisionHandlerEvent.h"
|
||||
#include "qpcollisionHandlerFloor.h"
|
||||
#include "qpcollisionHandlerPhysical.h"
|
||||
#include "qpcollisionHandlerPusher.h"
|
||||
#include "qpcollisionHandlerQueue.h"
|
||||
#include "qpcollisionNode.h"
|
||||
#include "collisionEntry.h"
|
||||
#include "collisionHandler.h"
|
||||
#include "collisionHandlerEvent.h"
|
||||
#include "collisionHandlerFloor.h"
|
||||
#include "collisionHandlerPhysical.h"
|
||||
#include "collisionHandlerPusher.h"
|
||||
#include "collisionHandlerQueue.h"
|
||||
#include "collisionNode.h"
|
||||
#include "collisionPlane.h"
|
||||
#include "collisionPolygon.h"
|
||||
#include "collisionRay.h"
|
||||
|
|
@ -56,14 +56,14 @@ init_libcollide() {
|
|||
}
|
||||
initialized = true;
|
||||
|
||||
qpCollisionEntry::init_type();
|
||||
qpCollisionHandler::init_type();
|
||||
qpCollisionHandlerEvent::init_type();
|
||||
qpCollisionHandlerFloor::init_type();
|
||||
qpCollisionHandlerPhysical::init_type();
|
||||
qpCollisionHandlerPusher::init_type();
|
||||
qpCollisionHandlerQueue::init_type();
|
||||
qpCollisionNode::init_type();
|
||||
CollisionEntry::init_type();
|
||||
CollisionHandler::init_type();
|
||||
CollisionHandlerEvent::init_type();
|
||||
CollisionHandlerFloor::init_type();
|
||||
CollisionHandlerPhysical::init_type();
|
||||
CollisionHandlerPusher::init_type();
|
||||
CollisionHandlerQueue::init_type();
|
||||
CollisionNode::init_type();
|
||||
CollisionPlane::init_type();
|
||||
CollisionPolygon::init_type();
|
||||
CollisionRay::init_type();
|
||||
|
|
@ -73,7 +73,7 @@ init_libcollide() {
|
|||
|
||||
//Registration of writeable object's creation
|
||||
//functions with BamReader's factory
|
||||
qpCollisionNode::register_with_read_factory();
|
||||
CollisionNode::register_with_read_factory();
|
||||
CollisionPlane::register_with_read_factory();
|
||||
CollisionPolygon::register_with_read_factory();
|
||||
CollisionRay::register_with_read_factory();
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@
|
|||
#include "renderModeAttrib.h"
|
||||
#include "fogAttrib.h"
|
||||
#include "depthOffsetAttrib.h"
|
||||
#include "qpfog.h"
|
||||
#include "fog.h"
|
||||
#include "clockObject.h"
|
||||
#include "string_utils.h"
|
||||
#include "qpnodePath.h"
|
||||
#include "nodePath.h"
|
||||
#include "dcast.h"
|
||||
#include "pvector.h"
|
||||
|
||||
|
|
@ -801,7 +801,7 @@ draw_sprite(GeomSprite *geom, GeomContext *) {
|
|||
|
||||
if (!geom->get_alpha_disable()) {
|
||||
// figure out if alpha's enabled (if not, no reason to sort)
|
||||
const TransparencyAttrib *trans = _qpstate->get_transparency();
|
||||
const TransparencyAttrib *trans = _state->get_transparency();
|
||||
if (trans != (const TransparencyAttrib *)NULL) {
|
||||
alpha = (trans->get_mode() != TransparencyAttrib::M_none);
|
||||
}
|
||||
|
|
@ -1598,7 +1598,7 @@ release_texture(TextureContext *tc) {
|
|||
// contents of the node.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
GeomNodeContext *CRGraphicsStateGuardian::
|
||||
prepare_geom_node(qpGeomNode *node) {
|
||||
prepare_geom_node(GeomNode *node) {
|
||||
#if 0 // temporarily disabled until we bring to new scene graph
|
||||
|
||||
// Make sure we have at least some static Geoms in the GeomNode;
|
||||
|
|
@ -1695,7 +1695,7 @@ prepare_geom_node(qpGeomNode *node) {
|
|||
// prepare_geom_node().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
draw_geom_node(qpGeomNode *node, const RenderState *state,
|
||||
draw_geom_node(GeomNode *node, const RenderState *state,
|
||||
GeomNodeContext *gnc) {
|
||||
#if 0 // temporarily disabled until we bring to new scene graph
|
||||
if (gnc == (GeomNodeContext *)NULL) {
|
||||
|
|
@ -2010,11 +2010,11 @@ void CRGraphicsStateGuardian::apply_material(const Material *material) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void CRGraphicsStateGuardian::
|
||||
apply_fog(qpFog *fog) {
|
||||
qpFog::Mode fmode = fog->get_mode();
|
||||
apply_fog(Fog *fog) {
|
||||
Fog::Mode fmode = fog->get_mode();
|
||||
call_glFogMode(get_fog_mode_type((Fog::Mode)fmode));
|
||||
|
||||
if (fmode == qpFog::M_linear) {
|
||||
if (fmode == Fog::M_linear) {
|
||||
float onset, opaque;
|
||||
fog->get_linear_range(onset, opaque);
|
||||
call_glFogStart(onset);
|
||||
|
|
@ -2225,8 +2225,8 @@ void CRGraphicsStateGuardian::
|
|||
issue_fog(const FogAttrib *attrib) {
|
||||
if (!attrib->is_off()) {
|
||||
enable_fog(true);
|
||||
qpFog *fog = attrib->get_fog();
|
||||
nassertv(fog != (qpFog *)NULL);
|
||||
Fog *fog = attrib->get_fog();
|
||||
nassertv(fog != (Fog *)NULL);
|
||||
apply_fog(fog);
|
||||
} else {
|
||||
enable_fog(false);
|
||||
|
|
@ -2274,7 +2274,7 @@ bind_light(PointLight *light, int light_id) {
|
|||
|
||||
// Position needs to specify x, y, z, and w
|
||||
// w == 1 implies non-infinite position
|
||||
qpNodePath light_np(light);
|
||||
NodePath light_np(light);
|
||||
const LMatrix4f &light_mat = light_np.get_mat(_scene_setup->get_scene_root());
|
||||
LPoint3f pos = light->get_point() * light_mat;
|
||||
|
||||
|
|
@ -2315,7 +2315,7 @@ bind_light(DirectionalLight *light, int light_id) {
|
|||
|
||||
// Position needs to specify x, y, z, and w.
|
||||
// w == 0 implies light is at infinity
|
||||
qpNodePath light_np(light);
|
||||
NodePath light_np(light);
|
||||
const LMatrix4f &light_mat = light_np.get_mat(_scene_setup->get_scene_root());
|
||||
LVector3f dir = light->get_direction() * light_mat;
|
||||
LPoint4f fdir(-dir[0], -dir[1], -dir[2], 0);
|
||||
|
|
@ -2360,7 +2360,7 @@ bind_light(Spotlight *light, int light_id) {
|
|||
|
||||
// Position needs to specify x, y, z, and w
|
||||
// w == 1 implies non-infinite position
|
||||
qpNodePath light_np(light);
|
||||
NodePath light_np(light);
|
||||
const LMatrix4f &light_mat = light_np.get_mat(_scene_setup->get_scene_root());
|
||||
LPoint3f pos = lens->get_nodal_point() * light_mat;
|
||||
LVector3f dir = lens->get_view_vector() * light_mat;
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ public:
|
|||
virtual void apply_texture(TextureContext *tc);
|
||||
virtual void release_texture(TextureContext *tc);
|
||||
|
||||
virtual GeomNodeContext *prepare_geom_node(qpGeomNode *node);
|
||||
virtual void draw_geom_node(qpGeomNode *node, const RenderState *state,
|
||||
virtual GeomNodeContext *prepare_geom_node(GeomNode *node);
|
||||
virtual void draw_geom_node(GeomNode *node, const RenderState *state,
|
||||
GeomNodeContext *gnc);
|
||||
virtual void release_geom_node(GeomNodeContext *gnc);
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ public:
|
|||
const NodeTransitions& na=NodeTransitions());
|
||||
|
||||
virtual void apply_material(const Material *material);
|
||||
void apply_fog(qpFog *fog);
|
||||
void apply_fog(Fog *fog);
|
||||
|
||||
virtual void issue_transform(const TransformState *transform);
|
||||
virtual void issue_tex_matrix(const TexMatrixAttrib *attrib);
|
||||
|
|
|
|||
|
|
@ -9,36 +9,36 @@
|
|||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
||||
|
||||
#define SOURCES \
|
||||
qpanalogNode.I qpanalogNode.h \
|
||||
qpbuttonNode.I qpbuttonNode.h \
|
||||
analogNode.I analogNode.h \
|
||||
buttonNode.I buttonNode.h \
|
||||
clientAnalogDevice.I clientAnalogDevice.h clientBase.I \
|
||||
clientBase.h clientButtonDevice.I clientButtonDevice.h \
|
||||
clientDevice.I clientDevice.h clientDialDevice.I \
|
||||
clientDialDevice.h clientTrackerDevice.I \
|
||||
clientTrackerDevice.h config_device.h \
|
||||
qpdialNode.I qpdialNode.h \
|
||||
dialNode.I dialNode.h \
|
||||
mouseAndKeyboard.h \
|
||||
trackerData.I trackerData.h \
|
||||
qptrackerNode.I qptrackerNode.h \
|
||||
qpvirtualMouse.h
|
||||
trackerNode.I trackerNode.h \
|
||||
virtualMouse.h
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
qpanalogNode.cxx \
|
||||
qpbuttonNode.cxx \
|
||||
analogNode.cxx \
|
||||
buttonNode.cxx \
|
||||
clientAnalogDevice.cxx \
|
||||
clientBase.cxx clientButtonDevice.cxx clientDevice.cxx \
|
||||
clientDialDevice.cxx clientTrackerDevice.cxx \
|
||||
config_device.cxx \
|
||||
dialNode.cxx \
|
||||
qpdialNode.cxx \
|
||||
dialNode.cxx \
|
||||
mouseAndKeyboard.cxx \
|
||||
trackerData.cxx \
|
||||
qptrackerNode.cxx \
|
||||
qpvirtualMouse.cxx
|
||||
trackerNode.cxx \
|
||||
virtualMouse.cxx
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
qpanalogNode.I qpanalogNode.h \
|
||||
qpbuttonNode.I qpbuttonNode.h \
|
||||
analogNode.I analogNode.h \
|
||||
buttonNode.I buttonNode.h \
|
||||
clientAnalogDevice.I clientAnalogDevice.h \
|
||||
clientBase.I clientBase.h \
|
||||
clientButtonDevice.I clientButtonDevice.h \
|
||||
|
|
@ -47,10 +47,10 @@
|
|||
clientTrackerDevice.I clientTrackerDevice.h \
|
||||
config_device.h \
|
||||
mouseAndKeyboard.h \
|
||||
qpdialNode.I qpdialNode.h \
|
||||
dialNode.I dialNode.h \
|
||||
trackerData.I trackerData.h \
|
||||
qptrackerNode.I qptrackerNode.h \
|
||||
qpvirtualMouse.h
|
||||
trackerNode.I trackerNode.h \
|
||||
virtualMouse.h
|
||||
|
||||
#define IGATESCAN all
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpanalogNode.I
|
||||
// Filename: analogNode.I
|
||||
// Created by: drose (12Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,35 +18,35 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::OutputData::Constructor
|
||||
// Function: AnalogNode::OutputData::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE qpAnalogNode::OutputData::
|
||||
INLINE AnalogNode::OutputData::
|
||||
OutputData() {
|
||||
_index = -1;
|
||||
_flip = false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::is_valid
|
||||
// Function: AnalogNode::is_valid
|
||||
// Access: Public
|
||||
// Description: Returns true if the qpAnalogNode is valid and
|
||||
// Description: Returns true if the AnalogNode is valid and
|
||||
// connected to a server, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpAnalogNode::
|
||||
INLINE bool AnalogNode::
|
||||
is_valid() const {
|
||||
return (_analog != (ClientAnalogDevice *)NULL) && _analog->is_connected();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::get_num_controls
|
||||
// Function: AnalogNode::get_num_controls
|
||||
// Access: Public
|
||||
// Description: Returns the number of analog controls known to the
|
||||
// qpAnalogNode. This number may change as more controls
|
||||
// AnalogNode. This number may change as more controls
|
||||
// are discovered.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpAnalogNode::
|
||||
INLINE int AnalogNode::
|
||||
get_num_controls() const {
|
||||
_analog->lock();
|
||||
int result = _analog->get_num_controls();
|
||||
|
|
@ -55,14 +55,14 @@ get_num_controls() const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::get_control_state
|
||||
// Function: AnalogNode::get_control_state
|
||||
// Access: Public
|
||||
// Description: Returns the current position of indicated analog
|
||||
// control identified by its index number, or 0.0 if
|
||||
// the control is unknown. The normal range of a single
|
||||
// control is -1.0 to 1.0.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double qpAnalogNode::
|
||||
INLINE double AnalogNode::
|
||||
get_control_state(int index) const {
|
||||
_analog->lock();
|
||||
double result = _analog->get_control_state(index);
|
||||
|
|
@ -71,13 +71,13 @@ get_control_state(int index) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::is_control_known
|
||||
// Function: AnalogNode::is_control_known
|
||||
// Access: Public
|
||||
// Description: Returns true if the state of the indicated analog
|
||||
// control is known, or false if we have never heard
|
||||
// anything about this particular control.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpAnalogNode::
|
||||
INLINE bool AnalogNode::
|
||||
is_control_known(int index) const {
|
||||
_analog->lock();
|
||||
bool result = _analog->is_control_known(index);
|
||||
|
|
@ -86,7 +86,7 @@ is_control_known(int index) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::set_output
|
||||
// Function: AnalogNode::set_output
|
||||
// Access: Public
|
||||
// Description: Causes a particular analog control to be placed in
|
||||
// the data graph for the indicated channel. Normally,
|
||||
|
|
@ -95,7 +95,7 @@ is_control_known(int index) const {
|
|||
// available. If flip is true, the analog control value
|
||||
// will be reversed before outputting it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpAnalogNode::
|
||||
INLINE void AnalogNode::
|
||||
set_output(int channel, int index, bool flip) {
|
||||
nassertv(channel >= 0 && channel < max_outputs);
|
||||
_outputs[channel]._index = index;
|
||||
|
|
@ -103,38 +103,38 @@ set_output(int channel, int index, bool flip) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::clear_output
|
||||
// Function: AnalogNode::clear_output
|
||||
// Access: Public
|
||||
// Description: Removes the output to the data graph associated with
|
||||
// the indicated channel. See set_output().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpAnalogNode::
|
||||
INLINE void AnalogNode::
|
||||
clear_output(int channel) {
|
||||
nassertv(channel >= 0 && channel < max_outputs);
|
||||
_outputs[channel]._index = -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::get_output
|
||||
// Function: AnalogNode::get_output
|
||||
// Access: Public
|
||||
// Description: Returns the analog control index that is output to
|
||||
// the data graph on the indicated channel, or -1 if no
|
||||
// control is output on that channel. See set_output().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpAnalogNode::
|
||||
INLINE int AnalogNode::
|
||||
get_output(int channel) const {
|
||||
nassertr(channel >= 0 && channel < max_outputs, -1);
|
||||
return _outputs[channel]._index;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::is_output_flipped
|
||||
// Function: AnalogNode::is_output_flipped
|
||||
// Access: Public
|
||||
// Description: Returns true if the analog control index that is
|
||||
// output to the data graph on the indicated channel is
|
||||
// flipped. See set_output().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpAnalogNode::
|
||||
INLINE bool AnalogNode::
|
||||
is_output_flipped(int channel) const {
|
||||
nassertr(channel >= 0 && channel < max_outputs, false);
|
||||
return _outputs[channel]._flip;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpanalogNode.cxx
|
||||
// Filename: analogNode.cxx
|
||||
// Created by: drose (12Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,22 +16,22 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpanalogNode.h"
|
||||
#include "analogNode.h"
|
||||
#include "config_device.h"
|
||||
#include "dataNodeTransmit.h"
|
||||
#include "dcast.h"
|
||||
|
||||
|
||||
TypeHandle qpAnalogNode::_type_handle;
|
||||
TypeHandle AnalogNode::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::Constructor
|
||||
// Function: AnalogNode::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpAnalogNode::
|
||||
qpAnalogNode(ClientBase *client, const string &device_name) :
|
||||
qpDataNode(device_name)
|
||||
AnalogNode::
|
||||
AnalogNode(ClientBase *client, const string &device_name) :
|
||||
DataNode(device_name)
|
||||
{
|
||||
_xy_output = define_output("xy", EventStoreVec2::get_class_type());
|
||||
_xy = new EventStoreVec2(LPoint2f(0.0f, 0.0f));
|
||||
|
|
@ -57,25 +57,25 @@ qpAnalogNode(ClientBase *client, const string &device_name) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::Destructor
|
||||
// Function: AnalogNode::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpAnalogNode::
|
||||
~qpAnalogNode() {
|
||||
AnalogNode::
|
||||
~AnalogNode() {
|
||||
// When the _analog pointer destructs, the ClientAnalogDevice
|
||||
// disconnects itself from the ClientBase, and everything that needs
|
||||
// to get turned off does. Magic.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::write
|
||||
// Function: AnalogNode::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpAnalogNode::
|
||||
void AnalogNode::
|
||||
write(ostream &out, int indent_level) const {
|
||||
qpDataNode::write(out, indent_level);
|
||||
DataNode::write(out, indent_level);
|
||||
|
||||
if (_analog != (ClientAnalogDevice *)NULL) {
|
||||
_analog->lock();
|
||||
|
|
@ -85,7 +85,7 @@ write(ostream &out, int indent_level) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpAnalogNode::do_transmit_data
|
||||
// Function: AnalogNode::do_transmit_data
|
||||
// Access: Protected, Virtual
|
||||
// Description: The virtual implementation of transmit_data(). This
|
||||
// function receives an array of input parameters and
|
||||
|
|
@ -97,7 +97,7 @@ write(ostream &out, int indent_level) const {
|
|||
// the index numbers returned by the define_output()
|
||||
// calls.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpAnalogNode::
|
||||
void AnalogNode::
|
||||
do_transmit_data(const DataNodeTransmit &, DataNodeTransmit &output) {
|
||||
if (is_valid()) {
|
||||
_analog->poll();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpanalogNode.h
|
||||
// Filename: analogNode.h
|
||||
// Created by: drose (12Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,19 +16,19 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpANALOGNODE_H
|
||||
#define qpANALOGNODE_H
|
||||
#ifndef ANALOGNODE_H
|
||||
#define ANALOGNODE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "clientBase.h"
|
||||
#include "clientAnalogDevice.h"
|
||||
#include "qpdataNode.h"
|
||||
#include "dataNode.h"
|
||||
#include "linmath_events.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpAnalogNode
|
||||
// Class : AnalogNode
|
||||
// Description : This is the primary interface to analog controls like
|
||||
// sliders and joysticks associated with a ClientBase.
|
||||
// This creates a node that connects to the named analog
|
||||
|
|
@ -46,10 +46,10 @@
|
|||
// position data. In this way, an AnalogNode may be
|
||||
// used in place of a mouse.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpAnalogNode : public qpDataNode {
|
||||
class EXPCL_PANDA AnalogNode : public DataNode {
|
||||
PUBLISHED:
|
||||
qpAnalogNode(ClientBase *client, const string &device_name);
|
||||
virtual ~qpAnalogNode();
|
||||
AnalogNode(ClientBase *client, const string &device_name);
|
||||
virtual ~AnalogNode();
|
||||
|
||||
INLINE bool is_valid() const;
|
||||
|
||||
|
|
@ -95,9 +95,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpDataNode::init_type();
|
||||
register_type(_type_handle, "qpAnalogNode",
|
||||
qpDataNode::get_class_type());
|
||||
DataNode::init_type();
|
||||
register_type(_type_handle, "AnalogNode",
|
||||
DataNode::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -108,6 +108,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpanalogNode.I"
|
||||
#include "analogNode.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpbuttonNode.I
|
||||
// Filename: buttonNode.I
|
||||
// Created by: drose (12Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -18,27 +18,27 @@
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::is_valid
|
||||
// Function: ButtonNode::is_valid
|
||||
// Access: Public
|
||||
// Description: Returns true if the qpButtonNode is valid and
|
||||
// Description: Returns true if the ButtonNode is valid and
|
||||
// connected to a server, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpButtonNode::
|
||||
INLINE bool ButtonNode::
|
||||
is_valid() const {
|
||||
return (_button != (ClientButtonDevice *)NULL) && _button->is_connected();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::get_num_buttons
|
||||
// Function: ButtonNode::get_num_buttons
|
||||
// Access: Public
|
||||
// Description: Returns the number of buttons known to the
|
||||
// qpButtonNode. This includes those buttons whose state
|
||||
// ButtonNode. This includes those buttons whose state
|
||||
// has been seen, as well as buttons that have been
|
||||
// associated with a ButtonHandle even if their state is
|
||||
// unknown. This number may change as more buttons are
|
||||
// discovered.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int qpButtonNode::
|
||||
INLINE int ButtonNode::
|
||||
get_num_buttons() const {
|
||||
_button->lock();
|
||||
int result = _button->get_num_buttons();
|
||||
|
|
@ -47,7 +47,7 @@ get_num_buttons() const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::set_button_map
|
||||
// Function: ButtonNode::set_button_map
|
||||
// Access: Public
|
||||
// Description: Associates the indicated ButtonHandle with the button
|
||||
// of the indicated index number. When the given button
|
||||
|
|
@ -60,7 +60,7 @@ get_num_buttons() const {
|
|||
// number; this is only necessary in order to generate
|
||||
// ButtonEvents when the buttons change state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void qpButtonNode::
|
||||
INLINE void ButtonNode::
|
||||
set_button_map(int index, ButtonHandle button) {
|
||||
_button->lock();
|
||||
_button->set_button_map(index, button);
|
||||
|
|
@ -68,14 +68,14 @@ set_button_map(int index, ButtonHandle button) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::get_button_map
|
||||
// Function: ButtonNode::get_button_map
|
||||
// Access: Public
|
||||
// Description: Returns the ButtonHandle that was previously
|
||||
// associated with the given index number by
|
||||
// a call to set_button_map(), or ButtonHandle::none()
|
||||
// if no button was associated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonHandle qpButtonNode::
|
||||
INLINE ButtonHandle ButtonNode::
|
||||
get_button_map(int index) const {
|
||||
_button->lock();
|
||||
ButtonHandle result = _button->get_button_map(index);
|
||||
|
|
@ -84,13 +84,13 @@ get_button_map(int index) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::get_button_state
|
||||
// Function: ButtonNode::get_button_state
|
||||
// Access: Public
|
||||
// Description: Returns true if the indicated button (identified by
|
||||
// its index number) is currently known to be down, or
|
||||
// false if it is up or unknown.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpButtonNode::
|
||||
INLINE bool ButtonNode::
|
||||
get_button_state(int index) const {
|
||||
_button->lock();
|
||||
bool result = _button->get_button_state(index);
|
||||
|
|
@ -99,13 +99,13 @@ get_button_state(int index) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::is_button_known
|
||||
// Function: ButtonNode::is_button_known
|
||||
// Access: Public
|
||||
// Description: Returns true if the state of the indicated button is
|
||||
// known, or false if we have never heard anything about
|
||||
// this particular button.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool qpButtonNode::
|
||||
INLINE bool ButtonNode::
|
||||
is_button_known(int index) const {
|
||||
_button->lock();
|
||||
bool result = _button->is_button_known(index);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpbuttonNode.cxx
|
||||
// Filename: buttonNode.cxx
|
||||
// Created by: drose (12Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,22 +16,22 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "qpbuttonNode.h"
|
||||
#include "buttonNode.h"
|
||||
#include "config_device.h"
|
||||
#include "dataNodeTransmit.h"
|
||||
#include "buttonEventList.h"
|
||||
#include "dcast.h"
|
||||
|
||||
TypeHandle qpButtonNode::_type_handle;
|
||||
TypeHandle ButtonNode::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::Constructor
|
||||
// Function: ButtonNode::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpButtonNode::
|
||||
qpButtonNode(ClientBase *client, const string &device_name) :
|
||||
qpDataNode(device_name)
|
||||
ButtonNode::
|
||||
ButtonNode(ClientBase *client, const string &device_name) :
|
||||
DataNode(device_name)
|
||||
{
|
||||
_button_events_output = define_output("button_events", ButtonEventList::get_class_type());
|
||||
_button_events = new ButtonEventList;
|
||||
|
|
@ -57,25 +57,25 @@ qpButtonNode(ClientBase *client, const string &device_name) :
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::Destructor
|
||||
// Function: ButtonNode::Destructor
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
qpButtonNode::
|
||||
~qpButtonNode() {
|
||||
ButtonNode::
|
||||
~ButtonNode() {
|
||||
// When the _button pointer destructs, the ClientButtonDevice
|
||||
// disconnects itself from the ClientBase, and everything that needs
|
||||
// to get turned off does. Magic.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::output
|
||||
// Function: ButtonNode::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpButtonNode::
|
||||
void ButtonNode::
|
||||
output(ostream &out) const {
|
||||
qpDataNode::output(out);
|
||||
DataNode::output(out);
|
||||
|
||||
if (_button != (ClientButtonDevice *)NULL) {
|
||||
out << " (";
|
||||
|
|
@ -87,13 +87,13 @@ output(ostream &out) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::write
|
||||
// Function: ButtonNode::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpButtonNode::
|
||||
void ButtonNode::
|
||||
write(ostream &out, int indent_level) const {
|
||||
qpDataNode::write(out, indent_level);
|
||||
DataNode::write(out, indent_level);
|
||||
|
||||
if (_button != (ClientButtonDevice *)NULL) {
|
||||
_button->lock();
|
||||
|
|
@ -103,7 +103,7 @@ write(ostream &out, int indent_level) const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: qpButtonNode::do_transmit_data
|
||||
// Function: ButtonNode::do_transmit_data
|
||||
// Access: Protected, Virtual
|
||||
// Description: The virtual implementation of transmit_data(). This
|
||||
// function receives an array of input parameters and
|
||||
|
|
@ -115,7 +115,7 @@ write(ostream &out, int indent_level) const {
|
|||
// the index numbers returned by the define_output()
|
||||
// calls.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void qpButtonNode::
|
||||
void ButtonNode::
|
||||
do_transmit_data(const DataNodeTransmit &, DataNodeTransmit &output) {
|
||||
if (is_valid()) {
|
||||
_button->poll();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Filename: qpButtonNode.h
|
||||
// Filename: ButtonNode.h
|
||||
// Created by: drose (12Mar02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -16,19 +16,19 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef qpBUTTONNODE_H
|
||||
#define qpBUTTONNODE_H
|
||||
#ifndef BUTTONNODE_H
|
||||
#define BUTTONNODE_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
#include "clientBase.h"
|
||||
#include "clientButtonDevice.h"
|
||||
#include "qpdataNode.h"
|
||||
#include "dataNode.h"
|
||||
#include "buttonEventList.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : qpButtonNode
|
||||
// Class : ButtonNode
|
||||
// Description : This is the primary interface to on/off button
|
||||
// devices associated with a ClientBase. This creates a
|
||||
// node that connects to the named button device, if it
|
||||
|
|
@ -42,10 +42,10 @@
|
|||
// down events on the data graph for each button state
|
||||
// change.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA qpButtonNode : public qpDataNode {
|
||||
class EXPCL_PANDA ButtonNode : public DataNode {
|
||||
PUBLISHED:
|
||||
qpButtonNode(ClientBase *client, const string &device_name);
|
||||
virtual ~qpButtonNode();
|
||||
ButtonNode(ClientBase *client, const string &device_name);
|
||||
virtual ~ButtonNode();
|
||||
|
||||
INLINE bool is_valid() const;
|
||||
|
||||
|
|
@ -79,9 +79,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
qpDataNode::init_type();
|
||||
register_type(_type_handle, "qpButtonNode",
|
||||
qpDataNode::get_class_type());
|
||||
DataNode::init_type();
|
||||
register_type(_type_handle, "ButtonNode",
|
||||
DataNode::get_class_type());
|
||||
}
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
@ -92,6 +92,6 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "qpbuttonNode.I"
|
||||
#include "buttonNode.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -18,18 +18,18 @@
|
|||
|
||||
|
||||
#include "config_device.h"
|
||||
#include "qpanalogNode.h"
|
||||
#include "qpbuttonNode.h"
|
||||
#include "analogNode.h"
|
||||
#include "buttonNode.h"
|
||||
#include "clientAnalogDevice.h"
|
||||
#include "clientBase.h"
|
||||
#include "clientButtonDevice.h"
|
||||
#include "clientDevice.h"
|
||||
#include "clientDialDevice.h"
|
||||
#include "clientTrackerDevice.h"
|
||||
#include "qpdialNode.h"
|
||||
#include "dialNode.h"
|
||||
#include "mouseAndKeyboard.h"
|
||||
#include "qptrackerNode.h"
|
||||
#include "qpvirtualMouse.h"
|
||||
#include "trackerNode.h"
|
||||
#include "virtualMouse.h"
|
||||
|
||||
#include <dconfig.h>
|
||||
|
||||
|
|
@ -58,16 +58,16 @@ init_libdevice() {
|
|||
}
|
||||
initialized = true;
|
||||
|
||||
qpAnalogNode::init_type();
|
||||
qpButtonNode::init_type();
|
||||
AnalogNode::init_type();
|
||||
ButtonNode::init_type();
|
||||
ClientAnalogDevice::init_type();
|
||||
ClientBase::init_type();
|
||||
ClientButtonDevice::init_type();
|
||||
ClientDevice::init_type();
|
||||
ClientDialDevice::init_type();
|
||||
ClientTrackerDevice::init_type();
|
||||
qpDialNode::init_type();
|
||||
qpMouseAndKeyboard::init_type();
|
||||
qpTrackerNode::init_type();
|
||||
qpVirtualMouse::init_type();
|
||||
DialNode::init_type();
|
||||
MouseAndKeyboard::init_type();
|
||||
TrackerNode::init_type();
|
||||
VirtualMouse::init_type();
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue