mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
add ArcChain to app_traverse(), etc.
This commit is contained in:
parent
b34f02a899
commit
bdf804a6ac
@ -115,7 +115,7 @@ safe_to_transform() const {
|
|||||||
// character node's being present in the scene graph.
|
// character node's being present in the scene graph.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void Character::
|
void Character::
|
||||||
app_traverse() {
|
app_traverse(const ArcChain &) {
|
||||||
double now = ClockObject::get_global_clock()->get_frame_time();
|
double now = ClockObject::get_global_clock()->get_frame_time();
|
||||||
get_bundle()->advance_time(now);
|
get_bundle()->advance_time(now);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ PUBLISHED:
|
|||||||
INLINE void write_part_values(ostream &out) const;
|
INLINE void write_part_values(ostream &out) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void app_traverse();
|
virtual void app_traverse(const ArcChain &chain);
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
void update();
|
void update();
|
||||||
|
@ -182,7 +182,7 @@ preserve_name() const {
|
|||||||
// geometry is up-to-date.
|
// geometry is up-to-date.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void CollisionNode::
|
void CollisionNode::
|
||||||
draw_traverse() {
|
draw_traverse(const ArcChain &) {
|
||||||
Solids::iterator si;
|
Solids::iterator si;
|
||||||
for (si = _solids.begin(); si != _solids.end(); ++si) {
|
for (si = _solids.begin(); si != _solids.end(); ++si) {
|
||||||
(*si)->update_viz(this);
|
(*si)->update_viz(this);
|
||||||
|
@ -63,7 +63,7 @@ PUBLISHED:
|
|||||||
INLINE int add_solid(CollisionSolid *solid);
|
INLINE int add_solid(CollisionSolid *solid);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void draw_traverse();
|
virtual void draw_traverse(const ArcChain &chain);
|
||||||
virtual void output(ostream &out) const;
|
virtual void output(ostream &out) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -586,9 +586,9 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
|
|||||||
Node *node = arc->get_child();
|
Node *node = arc->get_child();
|
||||||
|
|
||||||
if (implicit_app_traversal) {
|
if (implicit_app_traversal) {
|
||||||
node->app_traverse();
|
node->app_traverse(_arc_chain);
|
||||||
}
|
}
|
||||||
node->draw_traverse();
|
node->draw_traverse(_arc_chain);
|
||||||
|
|
||||||
// We have to get a new _now timestamp, just in case either of the
|
// We have to get a new _now timestamp, just in case either of the
|
||||||
// above traversals changed it.
|
// above traversals changed it.
|
||||||
|
@ -18,32 +18,29 @@
|
|||||||
|
|
||||||
#include "lensFlareNode.h"
|
#include "lensFlareNode.h"
|
||||||
#include "config_effects.h"
|
#include "config_effects.h"
|
||||||
#include <sequenceNode.h>
|
|
||||||
|
|
||||||
#include <geomNode.h>
|
#include "sequenceNode.h"
|
||||||
#include <geomSprite.h>
|
#include "geomNode.h"
|
||||||
|
#include "geomSprite.h"
|
||||||
#include <textureTransition.h>
|
#include "textureTransition.h"
|
||||||
#include <billboardTransition.h>
|
#include "transformTransition.h"
|
||||||
#include <transformAttribute.h>
|
#include "billboardTransition.h"
|
||||||
#include <transparencyTransition.h>
|
#include "transformAttribute.h"
|
||||||
#include <renderTraverser.h>
|
#include "transparencyTransition.h"
|
||||||
|
#include "renderTraverser.h"
|
||||||
#include <orthoProjection.h>
|
#include "orthoProjection.h"
|
||||||
#include <perspectiveProjection.h>
|
#include "perspectiveProjection.h"
|
||||||
#include <get_rel_pos.h>
|
#include "get_rel_pos.h"
|
||||||
#include <clockObject.h>
|
#include "clockObject.h"
|
||||||
|
#include "allAttributesWrapper.h"
|
||||||
#include <allAttributesWrapper.h>
|
#include "allTransitionsWrapper.h"
|
||||||
#include <allTransitionsWrapper.h>
|
#include "graphicsStateGuardian.h"
|
||||||
#include <graphicsStateGuardian.h>
|
#include "datagram.h"
|
||||||
|
#include "datagramIterator.h"
|
||||||
#include <datagram.h>
|
#include "bamReader.h"
|
||||||
#include <datagramIterator.h>
|
#include "bamWriter.h"
|
||||||
#include <bamReader.h>
|
#include "ioPtaDatagramFloat.h"
|
||||||
#include <bamWriter.h>
|
#include "ioPtaDatagramLinMath.h"
|
||||||
#include <ioPtaDatagramFloat.h>
|
|
||||||
#include <ioPtaDatagramLinMath.h>
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Static variables
|
// Static variables
|
||||||
|
@ -287,6 +287,42 @@ get_child(TypeHandle type, int index) const {
|
|||||||
return drp[index];
|
return drp[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Node::app_traverse
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: This hook function is called on each node visited
|
||||||
|
// during the App traversal. The ArcChain passed in
|
||||||
|
// represents the complete chain from the root of the
|
||||||
|
// graph to this node, if it is known.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void Node::
|
||||||
|
app_traverse(const ArcChain &) {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Node::draw_traverse
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: This hook function is called on each node visited
|
||||||
|
// during the Draw traversal. The ArcChain passed in
|
||||||
|
// represents the complete chain from the root of the
|
||||||
|
// graph to this node, if it is known.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void Node::
|
||||||
|
draw_traverse(const ArcChain &) {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Node::dgraph_traverse
|
||||||
|
// Access: Public, Virtual
|
||||||
|
// Description: This hook function is called on each node visited
|
||||||
|
// during the data graph traversal. The ArcChain passed
|
||||||
|
// in represents the complete chain from the root of the
|
||||||
|
// graph to this node, if it is known.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void Node::
|
||||||
|
dgraph_traverse(const ArcChain &) {
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Node::sub_render
|
// Function: Node::sub_render
|
||||||
// Access: Public, Virtual
|
// Access: Public, Virtual
|
||||||
|
@ -37,6 +37,7 @@ class BamWriter;
|
|||||||
class BamReader;
|
class BamReader;
|
||||||
class Datagram;
|
class Datagram;
|
||||||
class DatagramIterator;
|
class DatagramIterator;
|
||||||
|
class ArcChain;
|
||||||
|
|
||||||
// This is the maximum number of graph types a node may simultaneously
|
// This is the maximum number of graph types a node may simultaneously
|
||||||
// exist in.
|
// exist in.
|
||||||
@ -83,9 +84,9 @@ PUBLISHED:
|
|||||||
public:
|
public:
|
||||||
// These functions will be called when the node is visited during
|
// These functions will be called when the node is visited during
|
||||||
// the indicated traversal.
|
// the indicated traversal.
|
||||||
virtual void app_traverse() { }
|
virtual void app_traverse(const ArcChain &chain);
|
||||||
virtual void draw_traverse() { }
|
virtual void draw_traverse(const ArcChain &chain);
|
||||||
virtual void dgraph_traverse() { }
|
virtual void dgraph_traverse(const ArcChain &chain);
|
||||||
|
|
||||||
// This function is similar to another function in NodeTransition.
|
// This function is similar to another function in NodeTransition.
|
||||||
// It may or may not intercept the render traversal.
|
// It may or may not intercept the render traversal.
|
||||||
|
@ -619,7 +619,7 @@ convert_to_nurbs(ParametricCurve *nc) const {
|
|||||||
// geometry is up-to-date.
|
// geometry is up-to-date.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ParametricCurve::
|
void ParametricCurve::
|
||||||
draw_traverse() {
|
draw_traverse(const ArcChain &) {
|
||||||
if (_implicit_drawer == (ParametricCurveDrawer *)NULL) {
|
if (_implicit_drawer == (ParametricCurveDrawer *)NULL) {
|
||||||
_implicit_drawer = new ParametricCurveDrawer();
|
_implicit_drawer = new ParametricCurveDrawer();
|
||||||
_implicit_drawer->set_curve(this);
|
_implicit_drawer->set_curve(this);
|
||||||
|
@ -114,7 +114,7 @@ public:
|
|||||||
virtual bool convert_to_hermite(HermiteCurve *hc) const;
|
virtual bool convert_to_hermite(HermiteCurve *hc) const;
|
||||||
virtual bool convert_to_nurbs(ParametricCurve *nc) const;
|
virtual bool convert_to_nurbs(ParametricCurve *nc) const;
|
||||||
|
|
||||||
virtual void draw_traverse();
|
virtual void draw_traverse(const ArcChain &chain);
|
||||||
|
|
||||||
void register_drawer(ParametricCurveDrawer *drawer);
|
void register_drawer(ParametricCurveDrawer *drawer);
|
||||||
void unregister_drawer(ParametricCurveDrawer *drawer);
|
void unregister_drawer(ParametricCurveDrawer *drawer);
|
||||||
|
@ -166,9 +166,9 @@ set_mouse_watcher(MouseWatcher *watcher) {
|
|||||||
void PGTop::
|
void PGTop::
|
||||||
r_traverse(Node *node, const ArcChain &chain) {
|
r_traverse(Node *node, const ArcChain &chain) {
|
||||||
if (implicit_app_traversal) {
|
if (implicit_app_traversal) {
|
||||||
node->app_traverse();
|
node->app_traverse(chain);
|
||||||
}
|
}
|
||||||
node->draw_traverse();
|
node->draw_traverse(chain);
|
||||||
_gsg->_nodes_pcollector.add_level(1);
|
_gsg->_nodes_pcollector.add_level(1);
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ traverse(Node *root) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool AppTraverser::
|
bool AppTraverser::
|
||||||
reached_node(Node *node, NullAttributeWrapper &, NullLevelState &) {
|
reached_node(Node *node, NullAttributeWrapper &, NullLevelState &) {
|
||||||
node->app_traverse();
|
ArcChain bogus;
|
||||||
|
node->app_traverse(bogus);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ bool DirectRenderTraverser::
|
|||||||
reached_node(Node *node, AllAttributesWrapper &render_state,
|
reached_node(Node *node, AllAttributesWrapper &render_state,
|
||||||
DirectRenderLevelState &level_state) {
|
DirectRenderLevelState &level_state) {
|
||||||
if (implicit_app_traversal) {
|
if (implicit_app_traversal) {
|
||||||
node->app_traverse();
|
node->app_traverse(_arc_chain);
|
||||||
}
|
}
|
||||||
node->draw_traverse();
|
node->draw_traverse(_arc_chain);
|
||||||
|
|
||||||
level_state._decal_mode = false;
|
level_state._decal_mode = false;
|
||||||
|
|
||||||
|
@ -16,52 +16,6 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <transformTransition.h>
|
|
||||||
#include <nodeTransitionWrapper.h>
|
|
||||||
#include <wrt.h>
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: get_pos
|
|
||||||
// Description: Returns the position in space of the node's origin,
|
|
||||||
// relative to another node (such as render).
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE LPoint3f
|
|
||||||
get_rel_pos(const Node *node, const Node *relative_to,
|
|
||||||
TypeHandle graph_type) {
|
|
||||||
NodeTransitionWrapper ntw(TransformTransition::get_class_type());
|
|
||||||
wrt(node, relative_to, ntw, graph_type);
|
|
||||||
const TransformTransition *tt;
|
|
||||||
|
|
||||||
if (!get_transition_into(tt, ntw)) {
|
|
||||||
// No relative transform.
|
|
||||||
return LPoint3f(0.0, 0.0, 0.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
LVector3f pos;
|
|
||||||
tt->get_matrix().get_row3(pos,3);
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: get_mat
|
|
||||||
// Description: Returns the net transform of the node, relative to
|
|
||||||
// another node (such as render).
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE void
|
|
||||||
get_rel_mat(const Node *node, const Node *relative_to,
|
|
||||||
LMatrix4f &mat, TypeHandle graph_type) {
|
|
||||||
NodeTransitionWrapper ntw(TransformTransition::get_class_type());
|
|
||||||
wrt(node, relative_to, ntw, graph_type);
|
|
||||||
const TransformTransition *tt;
|
|
||||||
if (!get_transition_into(tt, ntw)) {
|
|
||||||
// No relative transform.
|
|
||||||
mat = LMatrix4f::ident_mat();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mat = tt->get_matrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: get_up
|
// Function: get_up
|
||||||
|
@ -18,9 +18,77 @@
|
|||||||
|
|
||||||
#include "get_rel_pos.h"
|
#include "get_rel_pos.h"
|
||||||
|
|
||||||
#include <transformTransition.h>
|
#include "transformTransition.h"
|
||||||
#include <nodeTransitionWrapper.h>
|
#include "nodeTransitionWrapper.h"
|
||||||
#include <wrt.h>
|
#include "wrt.h"
|
||||||
|
#include "arcChain.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: get_rel_pos
|
||||||
|
// Description: Returns the position in space of the node's origin,
|
||||||
|
// relative to another node (such as render).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
LPoint3f
|
||||||
|
get_rel_pos(const Node *node, const Node *relative_to,
|
||||||
|
TypeHandle graph_type) {
|
||||||
|
NodeTransitionWrapper ntw(TransformTransition::get_class_type());
|
||||||
|
wrt(node, relative_to, ntw, graph_type);
|
||||||
|
const TransformTransition *tt;
|
||||||
|
|
||||||
|
if (!get_transition_into(tt, ntw)) {
|
||||||
|
// No relative transform.
|
||||||
|
return LPoint3f(0.0, 0.0, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
LVector3f pos;
|
||||||
|
tt->get_matrix().get_row3(pos,3);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: get_rel_mat
|
||||||
|
// Description: Returns the net transform of the node, relative to
|
||||||
|
// another node (such as render).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void
|
||||||
|
get_rel_mat(const Node *node, const Node *relative_to,
|
||||||
|
LMatrix4f &mat, TypeHandle graph_type) {
|
||||||
|
NodeTransitionWrapper ntw(TransformTransition::get_class_type());
|
||||||
|
wrt(node, relative_to, ntw, graph_type);
|
||||||
|
const TransformTransition *tt;
|
||||||
|
if (!get_transition_into(tt, ntw)) {
|
||||||
|
// No relative transform.
|
||||||
|
mat = LMatrix4f::ident_mat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat = tt->get_matrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: get_rel_mat
|
||||||
|
// Description: Returns the net transform of the node, relative to
|
||||||
|
// another node (such as render). This flavor of
|
||||||
|
// get_rel_mat() uses ArcChains to resolve ambiguities
|
||||||
|
// due to instancing.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void
|
||||||
|
get_rel_mat(const Node *from, const ArcChain &from_arcs,
|
||||||
|
const Node *to, const ArcChain &to_arcs,
|
||||||
|
LMatrix4f &mat, TypeHandle graph_type) {
|
||||||
|
NodeTransitionWrapper ntw(TransformTransition::get_class_type());
|
||||||
|
wrt(from, from_arcs.begin(), from_arcs.end(),
|
||||||
|
to, to_arcs.begin(), to_arcs.end(),
|
||||||
|
ntw, graph_type);
|
||||||
|
const TransformTransition *tt;
|
||||||
|
if (!get_transition_into(tt, ntw)) {
|
||||||
|
// No relative transform.
|
||||||
|
mat = LMatrix4f::ident_mat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat = tt->get_matrix();
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: get_rot_mat
|
// Function: get_rot_mat
|
||||||
|
@ -19,23 +19,30 @@
|
|||||||
#ifndef GET_REL_POS_H
|
#ifndef GET_REL_POS_H
|
||||||
#define GET_REL_POS_H
|
#define GET_REL_POS_H
|
||||||
|
|
||||||
#include <pandabase.h>
|
#include "pandabase.h"
|
||||||
|
|
||||||
|
#include "luse.h"
|
||||||
|
#include "lmatrix.h"
|
||||||
|
#include "coordinateSystem.h"
|
||||||
|
#include "renderRelation.h"
|
||||||
|
|
||||||
#include <luse.h>
|
|
||||||
#include <lmatrix.h>
|
|
||||||
#include <coordinateSystem.h>
|
|
||||||
#include <renderRelation.h>
|
|
||||||
|
|
||||||
class Node;
|
class Node;
|
||||||
|
class ArcChain;
|
||||||
|
|
||||||
INLINE LPoint3f EXPCL_PANDA
|
LPoint3f EXPCL_PANDA
|
||||||
get_rel_pos(const Node *node, const Node *relative_to,
|
get_rel_pos(const Node *node, const Node *relative_to,
|
||||||
TypeHandle graph_type = RenderRelation::get_class_type());
|
TypeHandle graph_type = RenderRelation::get_class_type());
|
||||||
INLINE void EXPCL_PANDA
|
void EXPCL_PANDA
|
||||||
get_rel_mat(const Node *node, const Node *relative_to,
|
get_rel_mat(const Node *node, const Node *relative_to,
|
||||||
LMatrix4f &mat,
|
LMatrix4f &mat,
|
||||||
TypeHandle graph_type = RenderRelation::get_class_type());
|
TypeHandle graph_type = RenderRelation::get_class_type());
|
||||||
void EXPCL_PANDA
|
void EXPCL_PANDA
|
||||||
|
get_rel_mat(const Node *from, const ArcChain &from_arcs,
|
||||||
|
const Node *to, const ArcChain &to_arcs,
|
||||||
|
LMatrix4f &mat,
|
||||||
|
TypeHandle graph_type = RenderRelation::get_class_type());
|
||||||
|
void EXPCL_PANDA
|
||||||
get_rel_rot_mat(const Node *node, const Node *relative_to,
|
get_rel_rot_mat(const Node *node, const Node *relative_to,
|
||||||
LMatrix4f &mat,
|
LMatrix4f &mat,
|
||||||
TypeHandle graph_type = RenderRelation::get_class_type());
|
TypeHandle graph_type = RenderRelation::get_class_type());
|
||||||
|
@ -127,9 +127,9 @@ forward_arc(NodeRelation *arc, NullTransitionWrapper &,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (implicit_app_traversal) {
|
if (implicit_app_traversal) {
|
||||||
node->app_traverse();
|
node->app_traverse(_arc_chain);
|
||||||
}
|
}
|
||||||
node->draw_traverse();
|
node->draw_traverse(_arc_chain);
|
||||||
|
|
||||||
// We have to get a new _now timestamp, just in case either of the
|
// We have to get a new _now timestamp, just in case either of the
|
||||||
// above traversals changed it.
|
// above traversals changed it.
|
||||||
|
@ -19,15 +19,17 @@
|
|||||||
#include "projectionNode.h"
|
#include "projectionNode.h"
|
||||||
#include "config_switchnode.h"
|
#include "config_switchnode.h"
|
||||||
|
|
||||||
#include <graphicsStateGuardian.h>
|
#include "graphicsStateGuardian.h"
|
||||||
#include <displayRegion.h>
|
#include "displayRegion.h"
|
||||||
#include <get_rel_pos.h>
|
#include "get_rel_pos.h"
|
||||||
#include <luse.h>
|
#include "luse.h"
|
||||||
#include <renderRelation.h>
|
#include "renderRelation.h"
|
||||||
#include <transformTransition.h>
|
#include "transformTransition.h"
|
||||||
#include <allAttributesWrapper.h>
|
#include "allAttributesWrapper.h"
|
||||||
#include <allTransitionsWrapper.h>
|
#include "allTransitionsWrapper.h"
|
||||||
#include <renderTraverser.h>
|
#include "nodeTransitionWrapper.h"
|
||||||
|
#include "renderTraverser.h"
|
||||||
|
#include "wrt.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Static variables
|
// Static variables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user