completely remove NodeAttribute etc.
This commit is contained in:
parent
23e26ae77a
commit
4eba3be9bd
|
|
@ -28,7 +28,6 @@
|
|||
#include <traverserVisitor.h>
|
||||
#include <renderRelation.h>
|
||||
#include <nullTransitionWrapper.h>
|
||||
#include <nullAttributeWrapper.h>
|
||||
#include <nullLevelState.h>
|
||||
#include <pta_Vertexf.h>
|
||||
#include <pta_Normalf.h>
|
||||
|
|
@ -48,11 +47,11 @@ extern int num_polys;
|
|||
class ReportGeoms :
|
||||
public TraverserVisitor<NullTransitionWrapper, NullLevelState> {
|
||||
public:
|
||||
bool reached_node(Node *node, const NullAttributeWrapper &, NullLevelState &);
|
||||
bool reached_node(Node *node, const NullTransitionWrapper &, NullLevelState &);
|
||||
};
|
||||
|
||||
bool ReportGeoms::
|
||||
reached_node(Node *node, const NullAttributeWrapper &, NullLevelState &) {
|
||||
reached_node(Node *node, const NullTransitionWrapper &, NullLevelState &) {
|
||||
if (node->is_of_type(GeomNode::get_class_type())) {
|
||||
GeomNode *geomNode = (GeomNode *)node;
|
||||
nout << "\n" << *geomNode << ", " << geomNode->get_num_geoms()
|
||||
|
|
@ -107,11 +106,11 @@ main(void) {
|
|||
nout << "Built " << (void *)gn << "\n";
|
||||
if (gn != NULL) {
|
||||
NullLevelState level_state;
|
||||
rg.reached_node(gn, NullAttributeWrapper(), level_state);
|
||||
rg.reached_node(gn, NullTransitionWrapper(), level_state);
|
||||
}
|
||||
|
||||
nout << "\nTraversing root:\n";
|
||||
df_traverse(root, rg, NullAttributeWrapper(), NullLevelState(),
|
||||
df_traverse(root, rg, NullTransitionWrapper(), NullLevelState(),
|
||||
RenderRelation::get_class_type());
|
||||
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "chatInput.h"
|
||||
#include <buttonEventDataTransition.h>
|
||||
#include <buttonEventDataAttribute.h>
|
||||
#include <buttonEvent.h>
|
||||
#include <keyboardButton.h>
|
||||
#include <throw_event.h>
|
||||
|
||||
#include "buttonEventDataTransition.h"
|
||||
#include "buttonEvent.h"
|
||||
#include "keyboardButton.h"
|
||||
#include "throw_event.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Static variables
|
||||
|
|
@ -63,11 +63,11 @@ reset() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ChatInput::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
// Look for keyboard events.
|
||||
const ButtonEventDataAttribute *b;
|
||||
if (get_attribute_into(b, data, _button_events_type)) {
|
||||
ButtonEventDataAttribute::const_iterator bi;
|
||||
const ButtonEventDataTransition *b;
|
||||
if (get_transition_into(b, data, _button_events_type)) {
|
||||
ButtonEventDataTransition::const_iterator bi;
|
||||
for (bi = b->begin(); bi != b->end(); ++bi) {
|
||||
const ButtonEvent &be = (*bi);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,22 +15,16 @@
|
|||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef CHATINPUT_H
|
||||
#define CHATINPUT_H
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Includes
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <dataNode.h>
|
||||
#include <pointerTo.h>
|
||||
#include <textNode.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Defines
|
||||
////////////////////////////////////////////////////////////////////
|
||||
#include "dataNode.h"
|
||||
#include "pointerTo.h"
|
||||
#include "textNode.h"
|
||||
#include "allTransitionsWrapper.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : ChatInput
|
||||
|
|
@ -66,8 +60,8 @@ PUBLISHED:
|
|||
////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
NodeAttributes _attrib;
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
AllTransitionsWrapper _attrib;
|
||||
// inputs
|
||||
static TypeHandle _button_events_type;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
cullStateLookup.h cullStateSubtree.I cullStateSubtree.h \
|
||||
cullTraverser.I cullTraverser.h directRenderTransition.I \
|
||||
directRenderTransition.h geomBin.I geomBin.h \
|
||||
geomBinAttribute.I geomBinAttribute.N geomBinAttribute.h \
|
||||
geomBinBackToFront.I geomBinBackToFront.h geomBinFixed.I \
|
||||
geomBinFixed.h geomBinGroup.I geomBinGroup.h geomBinNormal.h \
|
||||
geomBinTransition.I geomBinTransition.h geomBinUnsorted.I \
|
||||
|
|
@ -23,7 +22,7 @@
|
|||
#define INCLUDED_SOURCES \
|
||||
config_cull.cxx cullState.cxx cullStateLookup.cxx \
|
||||
cullStateSubtree.cxx cullTraverser.cxx \
|
||||
directRenderTransition.cxx geomBin.cxx geomBinAttribute.cxx \
|
||||
directRenderTransition.cxx geomBin.cxx \
|
||||
geomBinBackToFront.cxx geomBinFixed.cxx geomBinGroup.cxx \
|
||||
geomBinNormal.cxx geomBinTransition.cxx geomBinUnsorted.cxx
|
||||
|
||||
|
|
@ -32,7 +31,7 @@
|
|||
cullStateLookup.I cullStateLookup.h cullStateSubtree.I \
|
||||
cullStateSubtree.h cullTraverser.I cullTraverser.h \
|
||||
directRenderTransition.I directRenderTransition.h geomBin.I \
|
||||
geomBin.h geomBinAttribute.I geomBinAttribute.h \
|
||||
geomBin.h \
|
||||
geomBinBackToFront.I geomBinBackToFront.h geomBinFixed.I \
|
||||
geomBinFixed.h geomBinGroup.I geomBinGroup.h geomBinNormal.h \
|
||||
geomBinTransition.I geomBinTransition.h geomBinUnsorted.I \
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include "geomBinGroup.h"
|
||||
#include "geomBinNormal.h"
|
||||
#include "geomBinTransition.h"
|
||||
#include "geomBinAttribute.h"
|
||||
#include "geomBinFixed.h"
|
||||
#include "directRenderTransition.h"
|
||||
|
||||
|
|
@ -42,7 +41,6 @@ ConfigureFn(config_cull) {
|
|||
GeomBinGroup::init_type();
|
||||
GeomBinNormal::init_type();
|
||||
GeomBinTransition::init_type();
|
||||
GeomBinAttribute::init_type();
|
||||
GeomBinFixed::init_type();
|
||||
DirectRenderTransition::init_type();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#include <indent.h>
|
||||
#include <graphicsStateGuardian.h>
|
||||
|
||||
#include <allAttributesWrapper.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: CullState::check_currency
|
||||
// Access: Public
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "cullTraverser.h"
|
||||
#include "geomBinTransition.h"
|
||||
#include "geomBinAttribute.h"
|
||||
#include "cullStateSubtree.h"
|
||||
#include "geomBinNormal.h"
|
||||
#include "geomBinFixed.h"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#include "geomBin.cxx"
|
||||
#include "geomBinAttribute.cxx"
|
||||
#include "geomBinBackToFront.cxx"
|
||||
#include "geomBinFixed.cxx"
|
||||
#include "geomBinGroup.cxx"
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
// Filename: cull_headers.h
|
||||
// Created by: georges (30May01)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <geometricBoundingVolume.h>
|
||||
#include <graphicsStateGuardian.h>
|
||||
#include <indent.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <pStatTimer.h>
|
||||
#include <string.h>
|
||||
#include <string_utils.h>
|
||||
#include <transformAttribute.h>
|
||||
#include <transformTransition.h>
|
||||
|
||||
#include "config_cull.h"
|
||||
#include "cullState.h"
|
||||
#include "cullStateSubtree.h"
|
||||
#include "cullTraverser.h"
|
||||
#include "directRenderTransition.h"
|
||||
#include "geomBin.h"
|
||||
#include "geomBinAttribute.h"
|
||||
#include "geomBinBackToFront.h"
|
||||
#include "geomBinFixed.h"
|
||||
#include "geomBinGroup.h"
|
||||
#include "geomBinNormal.h"
|
||||
#include "geomBinTransition.h"
|
||||
#include "geomBinUnsorted.h"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
|
|
@ -67,7 +67,6 @@ public:
|
|||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
friend class DirectRenderAttribute;
|
||||
};
|
||||
|
||||
#include "directRenderTransition.I"
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
#include "geomBinBackToFront.h"
|
||||
|
||||
#include <indent.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <graphicsStateGuardian.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,79 +0,0 @@
|
|||
// Filename: geomBinAttribute.I
|
||||
// Created by: drose (07Apr00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE GeomBinAttribute::
|
||||
GeomBinAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE GeomBinAttribute::
|
||||
GeomBinAttribute(const string &bin, int draw_order) {
|
||||
set_on(bin, draw_order);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::set_on
|
||||
// Access: Public
|
||||
// Description: Changes the GeomBinAttribute to render the particular
|
||||
// geomBin.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomBinAttribute::
|
||||
set_on(const string &bin, int draw_order) {
|
||||
nassertv(!bin.empty());
|
||||
_value = bin;
|
||||
_draw_order = draw_order;
|
||||
OnOffAttribute::set_on();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::get_bin
|
||||
// Access: Public
|
||||
// Description: Returns the bin name that the GeomBinAttribute
|
||||
// represents. It is only valid to call this if is_on()
|
||||
// has returned true.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const string &GeomBinAttribute::
|
||||
get_bin() const {
|
||||
nassertr(is_on(), _value);
|
||||
return _value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::get_draw_order
|
||||
// Access: Public
|
||||
// Description: Returns the draw order associated with the
|
||||
// GeomBinAttribute. It is only valid to call this if
|
||||
// is_on() has returned true. This draw order has
|
||||
// meaning only if the associated bin (see get_bin()) is
|
||||
// of type GeomBinFixed.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int GeomBinAttribute::
|
||||
get_draw_order() const {
|
||||
nassertr(is_on(), 0);
|
||||
return _draw_order;
|
||||
}
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
ignoremember get_handle
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
// Filename: geomBinAttribute.cxx
|
||||
// Created by: drose (07Apr00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "geomBinAttribute.h"
|
||||
#include "geomBinTransition.h"
|
||||
|
||||
#include <indent.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <graphicsStateGuardianBase.h>
|
||||
|
||||
TypeHandle GeomBinAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::get_handle
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns the handle of the associated transition.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
TypeHandle GeomBinAttribute::
|
||||
get_handle() const {
|
||||
return GeomBinTransition::get_class_type();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a newly allocated GeomBinAttribute just like
|
||||
// this one.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *GeomBinAttribute::
|
||||
make_copy() const {
|
||||
return new GeomBinAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a newly allocated GeomBinAttribute
|
||||
// corresponding to the default initial state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *GeomBinAttribute::
|
||||
make_initial() const {
|
||||
return new GeomBinAttribute;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::set_value_from
|
||||
// Access: Protected, Virtual
|
||||
// Description: Copies the value from the indicated transition
|
||||
// pointer, which is guaranteed to be of type
|
||||
// GeomBinTransition.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GeomBinAttribute::
|
||||
set_value_from(const OnOffTransition *other) {
|
||||
const GeomBinTransition *ot;
|
||||
DCAST_INTO_V(ot, other);
|
||||
_value = ot->_value;
|
||||
_draw_order = ot->_draw_order;
|
||||
nassertv(!_value.empty());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::compare_values
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int GeomBinAttribute::
|
||||
compare_values(const OnOffAttribute *other) const {
|
||||
const GeomBinAttribute *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
if (_value != ot->_value) {
|
||||
return strcmp(_value.c_str(), ot->_value.c_str());
|
||||
}
|
||||
return _draw_order - ot->_draw_order;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::output_value
|
||||
// Access: Protected, Virtual
|
||||
// Description: Formats the value for human consumption on one line.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GeomBinAttribute::
|
||||
output_value(ostream &out) const {
|
||||
out << _value << ":" << _draw_order;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinAttribute::write_value
|
||||
// Access: Protected, Virtual
|
||||
// Description: Formats the value for human consumption on multiple
|
||||
// lines if necessary.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void GeomBinAttribute::
|
||||
write_value(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << _value << ":" << _draw_order << "\n";
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
// Filename: geomBinAttribute.h
|
||||
// Created by: drose (07Apr00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GEOMBINATTRIBUTE_H
|
||||
#define GEOMBINATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "geomBin.h"
|
||||
|
||||
#include <onOffAttribute.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : GeomBinAttribute
|
||||
// Description : See GeomBinTransition.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA GeomBinAttribute : public OnOffAttribute {
|
||||
public:
|
||||
INLINE GeomBinAttribute();
|
||||
INLINE GeomBinAttribute(const string &bin, int draw_order = 0);
|
||||
|
||||
INLINE void set_on(const string &bin, int draw_order = 0);
|
||||
INLINE const string &get_bin() const;
|
||||
INLINE int get_draw_order() const;
|
||||
|
||||
virtual TypeHandle get_handle() const;
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
protected:
|
||||
virtual void set_value_from(const OnOffTransition *other);
|
||||
virtual int compare_values(const OnOffAttribute *other) const;
|
||||
virtual void output_value(ostream &out) const;
|
||||
virtual void write_value(ostream &out, int indent_level) const;
|
||||
|
||||
string _value;
|
||||
int _draw_order;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
OnOffAttribute::init_type();
|
||||
register_type(_type_handle, "GeomBinAttribute",
|
||||
OnOffAttribute::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "geomBinAttribute.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -20,7 +20,6 @@
|
|||
#include "geomBinGroup.h"
|
||||
#include "cullTraverser.h"
|
||||
#include <indent.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <graphicsStateGuardian.h>
|
||||
|
||||
TypeHandle GeomBinGroup::_type_handle;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
|
||||
#include "geomBinTransition.h"
|
||||
#include "geomBinAttribute.h"
|
||||
#include <indent.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
@ -35,16 +34,6 @@ make_copy() const {
|
|||
return new GeomBinTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a newly allocated GeomBinAttribute.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *GeomBinTransition::
|
||||
make_attrib() const {
|
||||
return new GeomBinAttribute;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomBinTransition::make_initial
|
||||
// Access: Public, Virtual
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ PUBLISHED:
|
|||
|
||||
public:
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
virtual NodeTransition *make_initial() const;
|
||||
|
||||
protected:
|
||||
|
|
@ -77,7 +76,6 @@ public:
|
|||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
friend class GeomBinAttribute;
|
||||
};
|
||||
|
||||
#include "geomBinTransition.I"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include "geomBinUnsorted.h"
|
||||
#include "cullTraverser.h"
|
||||
#include <indent.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <graphicsStateGuardian.h>
|
||||
#include <pStatTimer.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <dftraverser.h>
|
||||
#include <traverserVisitor.h>
|
||||
#include <allTransitionsWrapper.h>
|
||||
#include <allAttributesWrapper.h>
|
||||
#include <pointerTo.h>
|
||||
#include <nullLevelState.h>
|
||||
|
||||
|
|
@ -38,20 +37,20 @@ public:
|
|||
PrintNodes() {
|
||||
_indent_level = 0;
|
||||
}
|
||||
bool reached_node(Node *node, AttributeWrapper &state, NullLevelState &) {
|
||||
bool reached_node(Node *node, TransitionWrapper &state, NullLevelState &) {
|
||||
indent(nout, _indent_level)
|
||||
<< *node << ", state is:\n";
|
||||
state.write(nout, _indent_level);
|
||||
return true;
|
||||
}
|
||||
bool forward_arc(NodeRelation *arc, TransitionWrapper &trans,
|
||||
AttributeWrapper &pre, AttributeWrapper &post,
|
||||
TransitionWrapper &pre, TransitionWrapper &post,
|
||||
NullLevelState &) {
|
||||
_indent_level += 2;
|
||||
return true;
|
||||
}
|
||||
void backward_arc(NodeRelation *arc, TransitionWrapper &trans,
|
||||
AttributeWrapper &pre, AttributeWrapper &post,
|
||||
TransitionWrapper &pre, TransitionWrapper &post,
|
||||
const NullLevelState &) {
|
||||
_indent_level -= 2;
|
||||
}
|
||||
|
|
@ -136,17 +135,17 @@ main(int argc, char *argv[]) {
|
|||
nout << "\n";
|
||||
PrintNodes pn;
|
||||
df_traverse(r, pn,
|
||||
AllAttributesWrapper(), NullLevelState(),
|
||||
AllTransitionsWrapper(), NullLevelState(),
|
||||
NodeRelation::get_class_type());
|
||||
nout << "\n";
|
||||
|
||||
CullTraverser ct(NULL, NodeRelation::get_class_type());
|
||||
|
||||
ct.traverse(r, AllAttributesWrapper(), AllTransitionsWrapper());
|
||||
ct.traverse(r, AllTransitionsWrapper(), AllTransitionsWrapper());
|
||||
ct.write(nout, 0);
|
||||
|
||||
nout << "\nframe 2:\n";
|
||||
ct.traverse(r, AllAttributesWrapper(), AllTransitionsWrapper());
|
||||
ct.traverse(r, AllTransitionsWrapper(), AllTransitionsWrapper());
|
||||
ct.write(nout, 0);
|
||||
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ AnalogNode(ClientBase *client, const string &device_name) :
|
|||
|
||||
_analog = DCAST(ClientAnalogDevice, device);
|
||||
|
||||
_xyz = new Vec3DataAttribute(LPoint3f(0, 0, 0));
|
||||
_attrib.set_attribute(_xyz_type, _xyz);
|
||||
_xyz = new Vec3DataTransition(LPoint3f(0, 0, 0));
|
||||
_attrib.set_transition(_xyz_type, _xyz);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -93,7 +93,7 @@ write(ostream &out, int indent_level) const {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void AnalogNode::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
if (is_valid()) {
|
||||
_analog->poll();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
#include "clientAnalogDevice.h"
|
||||
|
||||
#include <dataNode.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <allTransitionsWrapper.h>
|
||||
#include <vec3DataTransition.h>
|
||||
#include <vec3DataTransition.h>
|
||||
#include <vec3DataAttribute.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -85,10 +85,10 @@ private:
|
|||
////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
NodeAttributes _attrib;
|
||||
PT(Vec3DataAttribute) _xyz;
|
||||
AllTransitionsWrapper _attrib;
|
||||
PT(Vec3DataTransition) _xyz;
|
||||
|
||||
static TypeHandle _xyz_type;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ ButtonNode(ClientBase *client, const string &device_name) :
|
|||
_button = DCAST(ClientButtonDevice, device);
|
||||
|
||||
if (_button != (ClientButtonDevice *)NULL) {
|
||||
_button_events = new ButtonEventDataAttribute();
|
||||
_attrib.set_attribute(_button_events_type, _button_events);
|
||||
_button_events = new ButtonEventDataTransition();
|
||||
_attrib.set_transition(_button_events_type, _button_events);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ write(ostream &out, int indent_level) const {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ButtonNode::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
if (is_valid()) {
|
||||
_button->poll();
|
||||
_button->lock();
|
||||
|
|
@ -124,7 +124,7 @@ transmit_data(NodeAttributes &data) {
|
|||
_button->unlock();
|
||||
|
||||
if (device_cat.is_debug()) {
|
||||
device_cat.debug() << "ButtonNode:attributes" << endl;
|
||||
device_cat.debug() << "ButtonNode:transitions" << endl;
|
||||
_attrib.write(device_cat.debug(false), 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "clientButtonDevice.h"
|
||||
|
||||
#include <dataNode.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <allTransitionsWrapper.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -67,10 +67,10 @@ public:
|
|||
////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
NodeAttributes _attrib;
|
||||
PT(ButtonEventDataAttribute) _button_events;
|
||||
AllTransitionsWrapper _attrib;
|
||||
PT(ButtonEventDataTransition) _button_events;
|
||||
|
||||
// outputs
|
||||
static TypeHandle _button_events_type;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ is_button_known(int index) const {
|
|||
// This must be periodically cleared, or the buttons
|
||||
// will accumulate.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataAttribute *ClientButtonDevice::
|
||||
INLINE ButtonEventDataTransition *ClientButtonDevice::
|
||||
get_button_events() const {
|
||||
return _button_events;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ ClientButtonDevice::
|
|||
ClientButtonDevice(ClientBase *client, const string &device_name):
|
||||
ClientDevice(client, get_class_type(), device_name)
|
||||
{
|
||||
_button_events = new ButtonEventDataAttribute();
|
||||
_button_events = new ButtonEventDataTransition();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <buttonHandle.h>
|
||||
#include <buttonEvent.h>
|
||||
#include <buttonEventDataAttribute.h>
|
||||
#include <buttonEventDataTransition.h>
|
||||
#include <pointerTo.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -52,7 +52,7 @@ public:
|
|||
INLINE bool get_button_state(int index) const;
|
||||
INLINE bool is_button_known(int index) const;
|
||||
|
||||
INLINE ButtonEventDataAttribute *get_button_events() const;
|
||||
INLINE ButtonEventDataTransition *get_button_events() const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
|
@ -81,7 +81,7 @@ protected:
|
|||
typedef pvector<ButtonState> Buttons;
|
||||
Buttons _buttons;
|
||||
|
||||
PT(ButtonEventDataAttribute) _button_events;
|
||||
PT(ButtonEventDataTransition) _button_events;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ DialNode::
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DialNode::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
if (is_valid()) {
|
||||
_dial->poll();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "clientDialDevice.h"
|
||||
|
||||
#include <dataNode.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <allTransitionsWrapper.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -59,9 +59,9 @@ PUBLISHED:
|
|||
////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
NodeAttributes _attrib;
|
||||
AllTransitionsWrapper _attrib;
|
||||
|
||||
private:
|
||||
PT(ClientDialDevice) _dial;
|
||||
|
|
|
|||
|
|
@ -43,15 +43,15 @@ MouseAndKeyboard(GraphicsWindow *window, int device, const string& name) :
|
|||
_window(window),
|
||||
_device(device)
|
||||
{
|
||||
_pixel_xyz = new Vec3DataAttribute(LPoint3f(0, 0, 0));
|
||||
_xyz = new Vec3DataAttribute(LPoint3f(0, 0, 0));
|
||||
_button_events = new ButtonEventDataAttribute();
|
||||
_pixel_xyz = new Vec3DataTransition(LPoint3f(0, 0, 0));
|
||||
_xyz = new Vec3DataTransition(LPoint3f(0, 0, 0));
|
||||
_button_events = new ButtonEventDataTransition();
|
||||
|
||||
_got_mouse_attrib.set_attribute(_pixel_xyz_type, _pixel_xyz);
|
||||
_got_mouse_attrib.set_attribute(_xyz_type, _xyz);
|
||||
_got_mouse_attrib.set_attribute(_button_events_type, _button_events);
|
||||
_got_mouse_attrib.set_transition(_pixel_xyz_type, _pixel_xyz);
|
||||
_got_mouse_attrib.set_transition(_xyz_type, _xyz);
|
||||
_got_mouse_attrib.set_transition(_button_events_type, _button_events);
|
||||
|
||||
_no_mouse_attrib.set_attribute(_button_events_type, _button_events);
|
||||
_no_mouse_attrib.set_transition(_button_events_type, _button_events);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -60,7 +60,7 @@ MouseAndKeyboard(GraphicsWindow *window, int device, const string& name) :
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void MouseAndKeyboard::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
// Fill up the button events.
|
||||
_button_events->clear();
|
||||
while (_window->has_button_event(_device)) {
|
||||
|
|
|
|||
|
|
@ -25,12 +25,10 @@
|
|||
|
||||
#include "dataNode.h"
|
||||
#include "vec3DataTransition.h"
|
||||
#include "vec3DataAttribute.h"
|
||||
#include "buttonEventDataTransition.h"
|
||||
#include "buttonEventDataAttribute.h"
|
||||
#include "graphicsWindow.h"
|
||||
#include "pointerTo.h"
|
||||
#include "nodeAttributes.h"
|
||||
#include "allTransitionsWrapper.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Defines
|
||||
|
|
@ -52,7 +50,7 @@ const int MIN_MOVE = 2;
|
|||
// Mouse data is sent down the data graph as an x,y
|
||||
// position as well as the set of buttons currently
|
||||
// being held down; keyboard data is sent down as a set
|
||||
// of keypress events in an EventDataAttribute. To
|
||||
// of keypress events in an EventDataTransition. To
|
||||
// throw these events to the system, you must child an
|
||||
// EventThrower to the MouseAndKeyboard object;
|
||||
// otherwise, the events will be discarded.
|
||||
|
|
@ -63,14 +61,14 @@ PUBLISHED:
|
|||
const string& name = "");
|
||||
|
||||
public:
|
||||
virtual void transmit_data(NodeAttributes &data);
|
||||
virtual void transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
public:
|
||||
NodeAttributes _got_mouse_attrib;
|
||||
NodeAttributes _no_mouse_attrib;
|
||||
PT(Vec3DataAttribute) _pixel_xyz;
|
||||
PT(Vec3DataAttribute) _xyz;
|
||||
PT(ButtonEventDataAttribute) _button_events;
|
||||
AllTransitionsWrapper _got_mouse_attrib;
|
||||
AllTransitionsWrapper _no_mouse_attrib;
|
||||
PT(Vec3DataTransition) _pixel_xyz;
|
||||
PT(Vec3DataTransition) _xyz;
|
||||
PT(ButtonEventDataTransition) _button_events;
|
||||
|
||||
static TypeHandle _mods_type;
|
||||
static TypeHandle _pixel_xyz_type;
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ TrackerNode(ClientBase *client, const string &device_name) :
|
|||
_tracker = DCAST(ClientTrackerDevice, device);
|
||||
|
||||
if (_tracker != (ClientTrackerDevice *)NULL) {
|
||||
_transform_attrib = new MatrixDataAttribute;
|
||||
_attrib.set_attribute(_transform_type, _transform_attrib);
|
||||
_transform_attrib = new MatrixDataTransition;
|
||||
_attrib.set_transition(_transform_type, _transform_attrib);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ TrackerNode::
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void TrackerNode::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
if (is_valid()) {
|
||||
_tracker->poll();
|
||||
_tracker->lock();
|
||||
|
|
@ -92,7 +92,7 @@ transmit_data(NodeAttributes &data) {
|
|||
_transform_attrib->set_value(_transform);
|
||||
|
||||
if (device_cat.is_debug()) {
|
||||
device_cat.debug() << "TrackerNode:attributes" << endl;
|
||||
device_cat.debug() << "TrackerNode:transitions" << endl;
|
||||
_attrib.write(device_cat.debug(false), 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
#include <dataNode.h>
|
||||
#include <matrixDataTransition.h>
|
||||
#include <matrixDataAttribute.h>
|
||||
#include <nodeAttributes.h>
|
||||
#include <matrixDataTransition.h>
|
||||
#include <allTransitionsWrapper.h>
|
||||
#include <luse.h>
|
||||
#include <lmatrix.h>
|
||||
#include <pointerTo.h>
|
||||
|
|
@ -58,10 +58,10 @@ PUBLISHED:
|
|||
////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
NodeAttributes _attrib;
|
||||
PT(MatrixDataAttribute) _transform_attrib;
|
||||
AllTransitionsWrapper _attrib;
|
||||
PT(MatrixDataTransition) _transform_attrib;
|
||||
|
||||
// outputs
|
||||
static TypeHandle _transform_type;
|
||||
|
|
|
|||
|
|
@ -9,60 +9,40 @@
|
|||
#define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx
|
||||
|
||||
#define SOURCES \
|
||||
buttonEventDataAttribute.I buttonEventDataAttribute.h \
|
||||
buttonEventDataTransition.I buttonEventDataTransition.h \
|
||||
config_dgraph.h dataGraphTraversal.h dataGraphTraverser.I \
|
||||
dataGraphTraverser.h dataNode.h dataRelation.I \
|
||||
dataRelation.N dataRelation.h describe_data_verbose.h \
|
||||
doubleDataAttribute.I doubleDataAttribute.h \
|
||||
doubleDataTransition.I doubleDataTransition.h \
|
||||
doublePtrDataAttribute.I doublePtrDataAttribute.h \
|
||||
doublePtrDataTransition.I doublePtrDataTransition.h \
|
||||
intDataAttribute.I intDataAttribute.h intDataTransition.I \
|
||||
intDataTransition.h matrixDataAttribute.I \
|
||||
matrixDataAttribute.h matrixDataTransition.I \
|
||||
matrixDataTransition.h numericDataAttribute.I \
|
||||
numericDataAttribute.h numericDataTransition.I \
|
||||
numericDataTransition.h pointerDataAttribute.I \
|
||||
pointerDataAttribute.h pointerDataTransition.I \
|
||||
pointerDataTransition.h vec3DataAttribute.I \
|
||||
vec3DataAttribute.h vec3DataTransition.I \
|
||||
vec3DataTransition.h vec4DataAttribute.I vec4DataAttribute.h \
|
||||
intDataTransition.I intDataTransition.h \
|
||||
matrixDataTransition.I matrixDataTransition.h \
|
||||
numericDataTransition.I numericDataTransition.h \
|
||||
vec3DataTransition.I vec3DataTransition.h \
|
||||
vec4DataTransition.I vec4DataTransition.h \
|
||||
vectorDataAttribute.I vectorDataAttribute.h \
|
||||
vectorDataTransition.I vectorDataTransition.h
|
||||
|
||||
#define INCLUDED_SOURCES \
|
||||
buttonEventDataAttribute.cxx buttonEventDataTransition.cxx \
|
||||
buttonEventDataTransition.cxx \
|
||||
config_dgraph.cxx dataGraphTraversal.cxx \
|
||||
dataGraphTraverser.cxx dataNode.cxx dataRelation.cxx \
|
||||
describe_data_verbose.cxx doubleDataAttribute.cxx \
|
||||
doubleDataTransition.cxx doublePtrDataAttribute.cxx \
|
||||
doublePtrDataTransition.cxx intDataAttribute.cxx \
|
||||
intDataTransition.cxx matrixDataAttribute.cxx \
|
||||
matrixDataTransition.cxx vec3DataAttribute.cxx \
|
||||
vec3DataTransition.cxx vec4DataAttribute.cxx \
|
||||
describe_data_verbose.cxx \
|
||||
doubleDataTransition.cxx \
|
||||
intDataTransition.cxx \
|
||||
matrixDataTransition.cxx \
|
||||
vec3DataTransition.cxx \
|
||||
vec4DataTransition.cxx
|
||||
|
||||
#define INSTALL_HEADERS \
|
||||
buttonEventDataAttribute.I buttonEventDataAttribute.h \
|
||||
buttonEventDataTransition.I buttonEventDataTransition.h \
|
||||
dataGraphTraversal.h \
|
||||
dataNode.h dataRelation.I dataRelation.h \
|
||||
describe_data_verbose.h doubleDataAttribute.I doubleDataAttribute.h \
|
||||
describe_data_verbose.h \
|
||||
doubleDataTransition.I doubleDataTransition.h \
|
||||
doublePtrDataAttribute.I doublePtrDataAttribute.h \
|
||||
doublePtrDataTransition.I doublePtrDataTransition.h \
|
||||
intDataAttribute.I intDataAttribute.h intDataTransition.I \
|
||||
intDataTransition.h matrixDataAttribute.I matrixDataAttribute.h \
|
||||
intDataTransition.I intDataTransition.h \
|
||||
matrixDataTransition.I matrixDataTransition.h \
|
||||
numericDataAttribute.I numericDataAttribute.h \
|
||||
numericDataTransition.I numericDataTransition.h \
|
||||
pointerDataAttribute.I pointerDataAttribute.h \
|
||||
pointerDataTransition.I pointerDataTransition.h vec3DataAttribute.I \
|
||||
vec3DataAttribute.h vec3DataTransition.I vec3DataTransition.h \
|
||||
vec4DataAttribute.I vec4DataAttribute.h vec4DataTransition.I \
|
||||
vec4DataTransition.h vectorDataAttribute.I vectorDataAttribute.h \
|
||||
vec3DataTransition.I vec3DataTransition.h \
|
||||
vec4DataTransition.I vec4DataTransition.h \
|
||||
vectorDataTransition.I vectorDataTransition.h
|
||||
|
||||
#define IGATESCAN \
|
||||
|
|
|
|||
|
|
@ -1,89 +0,0 @@
|
|||
// Filename: buttonEventDataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataAttribute::
|
||||
ButtonEventDataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataAttribute::
|
||||
ButtonEventDataAttribute(const ButtonEventDataAttribute ©) :
|
||||
NodeAttribute(copy),
|
||||
_buttons(copy._buttons)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void ButtonEventDataAttribute::
|
||||
operator = (const ButtonEventDataAttribute ©) {
|
||||
NodeAttribute::operator = (copy);
|
||||
_buttons = copy._buttons;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::begin
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataAttribute::const_iterator ButtonEventDataAttribute::
|
||||
begin() const {
|
||||
return _buttons.begin();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::end
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataAttribute::const_iterator ButtonEventDataAttribute::
|
||||
end() const {
|
||||
return _buttons.end();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::clear
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void ButtonEventDataAttribute::
|
||||
clear() {
|
||||
_buttons.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::clear
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void ButtonEventDataAttribute::
|
||||
push_back(const ButtonEvent &event) {
|
||||
_buttons.push_back(event);
|
||||
}
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
// Filename: buttonEventDataAttribute.cxx
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "buttonEventDataAttribute.h"
|
||||
#include "buttonEventDataTransition.h"
|
||||
|
||||
#include <indent.h>
|
||||
|
||||
#include <modifierButtons.h>
|
||||
#include <algorithm>
|
||||
|
||||
TypeHandle ButtonEventDataAttribute::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::update_mods
|
||||
// Access: Public
|
||||
// Description: Updates the indicated ModifierButtons object with all
|
||||
// of the button up/down transitions indicated in the
|
||||
// queue.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ButtonEventDataAttribute::
|
||||
update_mods(ModifierButtons &mods) const {
|
||||
Buttons::const_iterator bi;
|
||||
for (bi = _buttons.begin(); bi != _buttons.end(); ++bi) {
|
||||
mods.add_event(*bi);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *ButtonEventDataAttribute::
|
||||
make_copy() const {
|
||||
return new ButtonEventDataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *ButtonEventDataAttribute::
|
||||
make_initial() const {
|
||||
return new ButtonEventDataAttribute;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::get_handle
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
TypeHandle ButtonEventDataAttribute::
|
||||
get_handle() const {
|
||||
return ButtonEventDataTransition::get_class_type();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::merge
|
||||
// Access: Public, Virtual
|
||||
// Description: Attempts to merge this attribute with the other one,
|
||||
// if that makes sense to do. Returns a new
|
||||
// NodeAttribute pointer that represents the merge, or
|
||||
// if the merge is not possible, returns the "other"
|
||||
// pointer unchanged (which is the result of the merge).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *ButtonEventDataAttribute::
|
||||
merge(const NodeAttribute *other) const {
|
||||
const ButtonEventDataAttribute *oa;
|
||||
DCAST_INTO_R(oa, other, NULL);
|
||||
|
||||
if (_buttons.empty()) {
|
||||
return (ButtonEventDataAttribute *)oa;
|
||||
|
||||
} else if (oa->_buttons.empty()) {
|
||||
return (ButtonEventDataAttribute *)this;
|
||||
|
||||
} else {
|
||||
// We have to create a new data attribute that includes both sets
|
||||
// of buttons.
|
||||
ButtonEventDataAttribute *new_attrib =
|
||||
new ButtonEventDataAttribute(*this);
|
||||
|
||||
new_attrib->_buttons.insert(new_attrib->_buttons.end(),
|
||||
oa->_buttons.begin(), oa->_buttons.end());
|
||||
return new_attrib;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ButtonEventDataAttribute::
|
||||
output(ostream &out) const {
|
||||
Buttons::const_iterator bi;
|
||||
for (bi = _buttons.begin(); bi != _buttons.end(); ++bi) {
|
||||
if (bi != _buttons.begin()) {
|
||||
out << ", ";
|
||||
}
|
||||
out << *bi;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ButtonEventDataAttribute::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << (*this) << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataAttribute::internal_compare_to
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int ButtonEventDataAttribute::
|
||||
internal_compare_to(const NodeAttribute *other) const {
|
||||
const ButtonEventDataAttribute *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
#ifdef WIN32_VC
|
||||
if (ot->_buttons == _buttons)
|
||||
return 0;
|
||||
else if (lexicographical_compare(_buttons.begin(), _buttons.end(),
|
||||
ot->_buttons.begin(), ot->_buttons.end()))
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
#else
|
||||
return lexicographical_compare_3way(_buttons.begin(), _buttons.end(),
|
||||
ot->_buttons.begin(), ot->_buttons.end());
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
// Filename: buttonEventDataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BUTTONEVENTDATAATTRIBUTE_H
|
||||
#define BUTTONEVENTDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <nodeAttribute.h>
|
||||
#include <buttonEvent.h>
|
||||
|
||||
#include "pvector.h"
|
||||
|
||||
class ButtonEventDataTransition;
|
||||
class ModifierButtons;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : ButtonEventDataAttribute
|
||||
// Description : This data graph attribute stores a collection of
|
||||
// button events that have been generated by the user
|
||||
// since the last time the data graph pulsed, in the
|
||||
// order they were generated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA ButtonEventDataAttribute : public NodeAttribute {
|
||||
private:
|
||||
typedef pvector<ButtonEvent> Buttons;
|
||||
|
||||
public:
|
||||
INLINE ButtonEventDataAttribute();
|
||||
INLINE ButtonEventDataAttribute(const ButtonEventDataAttribute ©);
|
||||
INLINE void operator = (const ButtonEventDataAttribute ©);
|
||||
|
||||
public:
|
||||
// Functions to access and manipulate the set of buttons.
|
||||
typedef Buttons::const_iterator const_iterator;
|
||||
typedef Buttons::const_iterator iterator;
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
|
||||
INLINE void clear();
|
||||
INLINE void push_back(const ButtonEvent &event);
|
||||
|
||||
void update_mods(ModifierButtons &mods) const;
|
||||
|
||||
public:
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
virtual TypeHandle get_handle() const;
|
||||
|
||||
virtual NodeAttribute *merge(const NodeAttribute *other) const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeAttribute *other) const;
|
||||
|
||||
private:
|
||||
Buttons _buttons;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NodeAttribute::init_type();
|
||||
register_type(_type_handle, "ButtonEventDataAttribute",
|
||||
NodeAttribute::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
friend class ButtonEventDataTransition;
|
||||
};
|
||||
|
||||
#include "buttonEventDataAttribute.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -32,7 +32,8 @@ ButtonEventDataTransition() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataTransition::
|
||||
ButtonEventDataTransition(const ButtonEventDataTransition ©) :
|
||||
NodeTransition(copy)
|
||||
NodeTransition(copy),
|
||||
_buttons(copy._buttons)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -44,4 +45,45 @@ ButtonEventDataTransition(const ButtonEventDataTransition ©) :
|
|||
INLINE void ButtonEventDataTransition::
|
||||
operator = (const ButtonEventDataTransition ©) {
|
||||
NodeTransition::operator = (copy);
|
||||
_buttons = copy._buttons;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::begin
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataTransition::const_iterator ButtonEventDataTransition::
|
||||
begin() const {
|
||||
return _buttons.begin();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::end
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ButtonEventDataTransition::const_iterator ButtonEventDataTransition::
|
||||
end() const {
|
||||
return _buttons.end();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::clear
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void ButtonEventDataTransition::
|
||||
clear() {
|
||||
_buttons.clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::clear
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void ButtonEventDataTransition::
|
||||
push_back(const ButtonEvent &event) {
|
||||
_buttons.push_back(event);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Filename: buttonEventDataTransition.cxx
|
||||
// Created by: drose (09Feb99)
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -18,10 +18,31 @@
|
|||
|
||||
|
||||
#include "buttonEventDataTransition.h"
|
||||
#include "buttonEventDataAttribute.h"
|
||||
#include "buttonEventDataTransition.h"
|
||||
|
||||
#include "indent.h"
|
||||
#include "modifierButtons.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
TypeHandle ButtonEventDataTransition::_type_handle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::update_mods
|
||||
// Access: Public
|
||||
// Description: Updates the indicated ModifierButtons object with all
|
||||
// of the button up/down transitions indicated in the
|
||||
// queue.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ButtonEventDataTransition::
|
||||
update_mods(ModifierButtons &mods) const {
|
||||
Buttons::const_iterator bi;
|
||||
for (bi = _buttons.begin(); bi != _buttons.end(); ++bi) {
|
||||
mods.add_event(*bi);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::make_copy
|
||||
// Access: Public, Virtual
|
||||
|
|
@ -32,37 +53,45 @@ make_copy() const {
|
|||
return new ButtonEventDataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *ButtonEventDataTransition::
|
||||
make_attrib() const {
|
||||
return new ButtonEventDataAttribute;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::compose
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a new transition that corresponds to the
|
||||
// composition of this transition with the second
|
||||
// transition (which must be of an equivalent type).
|
||||
// This may return the same pointer as either source
|
||||
// transition. Applying the transition returned from
|
||||
// this function to an attribute attribute will produce
|
||||
// the same effect as applying each transition
|
||||
// separately.
|
||||
// Description: Attempts to compose this transition with the other one,
|
||||
// if that makes sense to do. Returns a new
|
||||
// NodeTransition pointer that represents the compose, or
|
||||
// if the compose is not possible, returns the "other"
|
||||
// pointer unchanged (which is the result of the compose).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeTransition *ButtonEventDataTransition::
|
||||
compose(const NodeTransition *) const {
|
||||
return NULL;
|
||||
compose(const NodeTransition *other) const {
|
||||
const ButtonEventDataTransition *oa;
|
||||
DCAST_INTO_R(oa, other, NULL);
|
||||
|
||||
if (_buttons.empty()) {
|
||||
return (ButtonEventDataTransition *)oa;
|
||||
|
||||
} else if (oa->_buttons.empty()) {
|
||||
return (ButtonEventDataTransition *)this;
|
||||
|
||||
} else {
|
||||
// We have to create a new data transition that includes both sets
|
||||
// of buttons.
|
||||
ButtonEventDataTransition *new_attrib =
|
||||
new ButtonEventDataTransition(*this);
|
||||
|
||||
new_attrib->_buttons.insert(new_attrib->_buttons.end(),
|
||||
oa->_buttons.begin(), oa->_buttons.end());
|
||||
return new_attrib;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::invert
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
// Description: Returns a new transition that corresponds to the
|
||||
// inverse of this transition. If the transition was
|
||||
// identity, this may return the same pointer. Returns
|
||||
// NULL if the transition cannot be inverted.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeTransition *ButtonEventDataTransition::
|
||||
invert() const {
|
||||
|
|
@ -70,17 +99,29 @@ invert() const {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::apply
|
||||
// Function: ButtonEventDataTransition::output
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a new attribute (or possibly the same
|
||||
// attribute) that represents the effect of applying this
|
||||
// indicated transition to the indicated attribute. The
|
||||
// source attribute may be NULL, indicating the initial
|
||||
// attribute.
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *ButtonEventDataTransition::
|
||||
apply(const NodeAttribute *attrib) const {
|
||||
return (NodeAttribute *)attrib;
|
||||
void ButtonEventDataTransition::
|
||||
output(ostream &out) const {
|
||||
Buttons::const_iterator bi;
|
||||
for (bi = _buttons.begin(); bi != _buttons.end(); ++bi) {
|
||||
if (bi != _buttons.begin()) {
|
||||
out << ", ";
|
||||
}
|
||||
out << *bi;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ButtonEventDataTransition::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void ButtonEventDataTransition::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << (*this) << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -89,6 +130,20 @@ apply(const NodeAttribute *attrib) const {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
int ButtonEventDataTransition::
|
||||
internal_compare_to(const NodeTransition *) const {
|
||||
return 0;
|
||||
internal_compare_to(const NodeTransition *other) const {
|
||||
const ButtonEventDataTransition *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
#ifdef WIN32_VC
|
||||
if (ot->_buttons == _buttons)
|
||||
return 0;
|
||||
else if (lexicographical_compare(_buttons.begin(), _buttons.end(),
|
||||
ot->_buttons.begin(), ot->_buttons.end()))
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
#else
|
||||
return lexicographical_compare_3way(_buttons.begin(), _buttons.end(),
|
||||
ot->_buttons.begin(), ot->_buttons.end());
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Filename: buttonEventDataTransition.h
|
||||
// Created by: drose (08Feb99)
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -19,35 +19,59 @@
|
|||
#ifndef BUTTONEVENTDATATRANSITION_H
|
||||
#define BUTTONEVENTDATATRANSITION_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
#include <nodeTransition.h>
|
||||
#include "nodeTransition.h"
|
||||
#include "buttonEvent.h"
|
||||
|
||||
#include "pvector.h"
|
||||
|
||||
class ModifierButtons;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : ButtonEventDataTransition
|
||||
// Description : A ButtonEventDataAttribute is a collection of buttons
|
||||
// that have been pressed recently, in the order they
|
||||
// were pressed. The ButtonEventDataTransition does
|
||||
// nothing, since there's no sensible transformation to
|
||||
// apply to this collection of buttons.
|
||||
// Description : This data graph transition stores a collection of
|
||||
// button events that have been generated by the user
|
||||
// since the last time the data graph pulsed, in the
|
||||
// order they were generated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA ButtonEventDataTransition : public NodeTransition {
|
||||
private:
|
||||
typedef pvector<ButtonEvent> Buttons;
|
||||
|
||||
public:
|
||||
INLINE ButtonEventDataTransition();
|
||||
INLINE ButtonEventDataTransition(const ButtonEventDataTransition ©);
|
||||
INLINE void operator = (const ButtonEventDataTransition ©);
|
||||
|
||||
public:
|
||||
// Functions to access and manipulate the set of buttons.
|
||||
typedef Buttons::const_iterator const_iterator;
|
||||
typedef Buttons::const_iterator iterator;
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
|
||||
INLINE void clear();
|
||||
INLINE void push_back(const ButtonEvent &event);
|
||||
|
||||
void update_mods(ModifierButtons &mods) const;
|
||||
|
||||
public:
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
virtual NodeTransition *compose(const NodeTransition *other) const;
|
||||
virtual NodeTransition *invert() const;
|
||||
virtual NodeAttribute *apply(const NodeAttribute *attrib) const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeTransition *other) const;
|
||||
|
||||
private:
|
||||
Buttons _buttons;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
|
|
|
|||
|
|
@ -16,20 +16,14 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "dgraph_headers.h"
|
||||
#include "config_dgraph.h"
|
||||
#include "dataNode.h"
|
||||
#include "dataRelation.h"
|
||||
#include "intDataTransition.h"
|
||||
#include "intDataAttribute.h"
|
||||
#include "doubleDataTransition.h"
|
||||
#include "doubleDataAttribute.h"
|
||||
#include "vec3DataTransition.h"
|
||||
#include "vec3DataAttribute.h"
|
||||
#include "matrixDataTransition.h"
|
||||
#include "matrixDataAttribute.h"
|
||||
#include "buttonEventDataTransition.h"
|
||||
#include "buttonEventDataAttribute.h"
|
||||
|
||||
#include <dconfig.h>
|
||||
|
||||
|
|
@ -40,15 +34,10 @@ ConfigureFn(config_dgraph) {
|
|||
DataNode::init_type();
|
||||
DataRelation::init_type();
|
||||
IntDataTransition::init_type();
|
||||
IntDataAttribute::init_type();
|
||||
DoubleDataTransition::init_type();
|
||||
DoubleDataAttribute::init_type();
|
||||
Vec3DataTransition::init_type();
|
||||
Vec3DataAttribute::init_type();
|
||||
MatrixDataTransition::init_type();
|
||||
MatrixDataAttribute::init_type();
|
||||
ButtonEventDataTransition::init_type();
|
||||
ButtonEventDataAttribute::init_type();
|
||||
|
||||
DataRelation::register_with_factory();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
#include "dataGraphTraversal.h"
|
||||
#include "dataGraphTraverser.h"
|
||||
|
||||
#include <pStatTimer.h>
|
||||
#include <pStatCollector.h>
|
||||
#include "pStatTimer.h"
|
||||
#include "pStatCollector.h"
|
||||
|
||||
#ifndef CPPPARSER
|
||||
PStatCollector _dgraph_pcollector("App:Data graph");
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
class Node;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ DataGraphTraverser() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void DataGraphTraverser::
|
||||
traverse(Node *node) {
|
||||
NodeAttributes empty;
|
||||
AllTransitionsWrapper empty;
|
||||
r_traverse(node, empty, false);
|
||||
resume_all();
|
||||
}
|
||||
|
|
@ -45,15 +45,15 @@ traverse(Node *node) {
|
|||
// Description: Fires off the traversal, beginning *below* the
|
||||
// indicated node. The transmit_data() function is not
|
||||
// called on the starting node; instead, the indicated
|
||||
// data attributes are taken as the output of that node.
|
||||
// data transitions are taken as the output of that node.
|
||||
//
|
||||
// If the node defines transmit_data_per_child(), that
|
||||
// function is still called, once for each child as
|
||||
// usual.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void DataGraphTraverser::
|
||||
traverse_below(Node *node, const NodeAttributes &data) {
|
||||
NodeAttributes copy = data;
|
||||
traverse_below(Node *node, const AllTransitionsWrapper &data) {
|
||||
AllTransitionsWrapper copy = data;
|
||||
r_traverse_below(node, copy, false);
|
||||
resume_all();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
// Description: The recursive implementation of traverse().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DataGraphTraverser::
|
||||
r_traverse(Node *node, NodeAttributes &data, bool has_spam_mode) {
|
||||
r_traverse(Node *node, AllTransitionsWrapper &data, bool has_spam_mode) {
|
||||
DataNode *data_node = (DataNode *)NULL;
|
||||
if (node->is_of_type(DataNode::get_class_type())) {
|
||||
DCAST_INTO_V(data_node, node);
|
||||
|
|
@ -79,7 +79,7 @@ r_traverse(Node *node, NodeAttributes &data, bool has_spam_mode) {
|
|||
// Node::transmit_data().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DataGraphTraverser::
|
||||
r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode) {
|
||||
r_traverse_below(Node *node, AllTransitionsWrapper &data, bool has_spam_mode) {
|
||||
DataNode *data_node = (DataNode *)NULL;
|
||||
if (node->is_of_type(DataNode::get_class_type())) {
|
||||
DCAST_INTO_V(data_node, node);
|
||||
|
|
@ -92,12 +92,17 @@ r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode) {
|
|||
int num_children = node->get_num_children(DataRelation::get_class_type());
|
||||
|
||||
if (num_children > 0) {
|
||||
// For the first n - 1 children we need to make a copy of our
|
||||
// NodeAttributes for each one--this allows our children to modify
|
||||
// the set freely without affecting its siblings.
|
||||
// For the first n - 1 children need to make a copy of our
|
||||
// AllTransitionsWrapper for each one--this allows our children to
|
||||
// modify the set freely without affecting its siblings.
|
||||
|
||||
// Note that this is so far just a pointer copy. The contents
|
||||
// themselves are not necessarily copied, until the data node
|
||||
// attempts to modify the data, which will then cause a
|
||||
// copy-on-write.
|
||||
|
||||
for (int i = 0; i < num_children - 1; i++) {
|
||||
NodeAttributes copy = data;
|
||||
AllTransitionsWrapper copy(data);
|
||||
if (data_node != (DataNode *)NULL) {
|
||||
data_node->transmit_data_per_child(copy, i);
|
||||
}
|
||||
|
|
@ -116,10 +121,6 @@ r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode) {
|
|||
NodeRelation *arc =
|
||||
node->get_child(DataRelation::get_class_type(), num_children - 1);
|
||||
|
||||
if (dgraph_cat.is_spam()) {
|
||||
dgraph_cat.spam() << "Traversing " << *arc << "\n";
|
||||
}
|
||||
|
||||
r_traverse(arc->get_child(), data, has_spam_mode);
|
||||
}
|
||||
}
|
||||
|
|
@ -134,7 +135,7 @@ r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode) {
|
|||
// queue.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DataGraphTraverser::
|
||||
save(Node *node, const NodeAttributes &data, bool has_spam_mode,
|
||||
save(Node *node, const AllTransitionsWrapper &data, bool has_spam_mode,
|
||||
int num_parents) {
|
||||
|
||||
States::iterator si;
|
||||
|
|
@ -142,7 +143,7 @@ save(Node *node, const NodeAttributes &data, bool has_spam_mode,
|
|||
|
||||
if (si != _saved_states.end()) {
|
||||
SavedState &state = (*si).second;
|
||||
state._data.merge_from(state._data, data);
|
||||
state._data.compose_from(state._data, data);
|
||||
state._has_spam_mode = state._has_spam_mode || has_spam_mode;
|
||||
state._num_parents_so_far++;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@
|
|||
#ifndef DATAGRAPHTRAVERSER_H
|
||||
#define DATAGRAPHTRAVERSER_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
#include <nodeAttributes.h>
|
||||
#include "allTransitionsWrapper.h"
|
||||
|
||||
class Node;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DataGraphTraverser
|
||||
// Description : This class manages the traversal of the data graph,
|
||||
// so that all data attributes generated by nodes in the
|
||||
// so that all data transitions generated by nodes in the
|
||||
// graph are transmitted to nodes below them.
|
||||
//
|
||||
// A bit of logic is employed to ensure that if a node
|
||||
|
|
@ -42,19 +42,19 @@ public:
|
|||
INLINE DataGraphTraverser();
|
||||
|
||||
INLINE void traverse(Node *node);
|
||||
INLINE void traverse_below(Node *node, const NodeAttributes &data);
|
||||
INLINE void traverse_below(Node *node, const AllTransitionsWrapper &data);
|
||||
|
||||
private:
|
||||
class SavedState {
|
||||
public:
|
||||
NodeAttributes _data;
|
||||
AllTransitionsWrapper _data;
|
||||
bool _has_spam_mode;
|
||||
int _num_parents_so_far;
|
||||
};
|
||||
|
||||
void r_traverse(Node *node, NodeAttributes &data, bool has_spam_mode);
|
||||
void r_traverse_below(Node *node, NodeAttributes &data, bool has_spam_mode);
|
||||
void save(Node *node, const NodeAttributes &data, bool has_spam_mode,
|
||||
void r_traverse(Node *node, AllTransitionsWrapper &data, bool has_spam_mode);
|
||||
void r_traverse_below(Node *node, AllTransitionsWrapper &data, bool has_spam_mode);
|
||||
void save(Node *node, const AllTransitionsWrapper &data, bool has_spam_mode,
|
||||
int num_parents);
|
||||
void resume(Node *node, SavedState &state);
|
||||
void resume_all();
|
||||
|
|
|
|||
|
|
@ -37,15 +37,15 @@ DataNode(const string &name) : NamedNode(name) {
|
|||
// Description: Should be overridden in a derived class that wants to
|
||||
// send a different data stream to each child.
|
||||
// Normally, a node only overrides transmit_data(),
|
||||
// which takes a set of input data attributes and
|
||||
// generates a set of output data attributes. A node
|
||||
// which takes a set of input data transitions and
|
||||
// generates a set of output data transitions. A node
|
||||
// may also override transmit_data_per_child(), which is
|
||||
// called after transmit_data(), once per child; this
|
||||
// function may be used to send individual data
|
||||
// attributes to each child.
|
||||
// transitions to each child.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void DataNode::
|
||||
transmit_data_per_child(NodeAttributes &, int) {
|
||||
transmit_data_per_child(AllTransitionsWrapper &, int) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -38,22 +38,22 @@
|
|||
// the scene graph.
|
||||
//
|
||||
// In a normal scene graph, the arcs transmit state, and each node
|
||||
// inherits a collection of NodeAttribute values that are defined by
|
||||
// inherits a collection of NodeTransition values that are defined by
|
||||
// the total set of arcs above it. In a data graph, the arcs transmit
|
||||
// data instead of state, and each piece of data is stored in a
|
||||
// NodeAttribute value. Thus, each data node still inherits a
|
||||
// collection of NodeAttribute values, but now those values contain
|
||||
// NodeTransition value. Thus, each data node still inherits a
|
||||
// collection of NodeTransition values, but now those values contain
|
||||
// data instead of state information. In addition, a data node may
|
||||
// retransmit a different set of NodeAttribute values further down the
|
||||
// retransmit a different set of NodeTransition values further down the
|
||||
// chain. This is implemented via the transmit_data() function, below.
|
||||
//
|
||||
// Each data node may define its own set of input values and output
|
||||
// values, each with its own unique attribute type. This could be
|
||||
// done by subclassing a different kind of NodeAttribute for each
|
||||
// values, each with its own unique transition type. This could be
|
||||
// done by subclassing a different kind of NodeTransition for each
|
||||
// different input or output value, but this quickly gets unwieldy.
|
||||
// Instead, you may find it convenient to use the function
|
||||
// register_data_transition(), below, which creates a new TypeHandle
|
||||
// associated with some existing NodeAttribute type, based on the
|
||||
// associated with some existing NodeTransition type, based on the
|
||||
// unique name you give it. This allows producers and consumers to
|
||||
// match their corresponding data values up by TypeHandle number (and
|
||||
// hence by name); this matching happens more or less transparently by
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
|
||||
#include <namedNode.h>
|
||||
|
||||
class NodeAttributes;
|
||||
class AllTransitionsWrapper;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DataNode
|
||||
|
|
@ -81,10 +81,10 @@ public:
|
|||
DataNode(const string &name = "");
|
||||
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data)=0;
|
||||
transmit_data(AllTransitionsWrapper &data)=0;
|
||||
|
||||
virtual void
|
||||
transmit_data_per_child(NodeAttributes &data, int child_index);
|
||||
transmit_data_per_child(AllTransitionsWrapper &data, int child_index);
|
||||
|
||||
PUBLISHED:
|
||||
void set_spam_mode(bool flag);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,8 @@
|
|||
#include "dataGraphTraversal.h"
|
||||
#include "describe_data_verbose.h"
|
||||
|
||||
#include <indent.h>
|
||||
|
||||
#include <nodeAttributes.h>
|
||||
#include "indent.h"
|
||||
#include "allTransitionsWrapper.h"
|
||||
|
||||
// The number of columns in from the start of the name to print the
|
||||
// data value.
|
||||
|
|
@ -35,13 +34,13 @@ static const int data_indent_level = 12;
|
|||
// data values included in the indicated state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
describe_data_verbose(ostream &out, const NodeAttributes &state,
|
||||
describe_data_verbose(ostream &out, const AllTransitionsWrapper &state,
|
||||
int indent_level) {
|
||||
NodeAttributes::const_iterator nai;
|
||||
AllTransitionsWrapper::const_iterator nai;
|
||||
|
||||
for (nai = state.begin(); nai != state.end(); ++nai) {
|
||||
const PT(NodeAttribute) &attrib = (*nai).second;
|
||||
if (attrib != (NodeAttribute *)NULL) {
|
||||
const PT(NodeTransition) &attrib = (*nai).second;
|
||||
if (attrib != (NodeTransition *)NULL) {
|
||||
// Now extract the type name out of the type flag.
|
||||
TypeHandle type = (*nai).first;
|
||||
string actual_name = type.get_name();
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@
|
|||
#ifndef DESCRIBE_DATA_VERBOSE_H
|
||||
#define DESCRIBE_DATA_VERBOSE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
class NodeAttributes;
|
||||
class AllTransitionsWrapper;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: describe_data_verbose
|
||||
|
|
@ -29,7 +29,7 @@ class NodeAttributes;
|
|||
// nicely-formatted, multi-line description of all the
|
||||
// data values included in the indicated state.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void describe_data_verbose(ostream &out, const NodeAttributes &state,
|
||||
void describe_data_verbose(ostream &out, const AllTransitionsWrapper &state,
|
||||
int indent_level = 0);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
|
||||
#include "buttonEventDataAttribute.cxx"
|
||||
#include "buttonEventDataTransition.cxx"
|
||||
#include "config_dgraph.cxx"
|
||||
#include "matrixDataAttribute.cxx"
|
||||
#include "matrixDataTransition.cxx"
|
||||
#include "vec3DataAttribute.cxx"
|
||||
#include "vec3DataTransition.cxx"
|
||||
#include "vec4DataAttribute.cxx"
|
||||
#include "vec4DataTransition.cxx"
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
#include "dataNode.cxx"
|
||||
#include "dataRelation.cxx"
|
||||
#include "describe_data_verbose.cxx"
|
||||
#include "doubleDataAttribute.cxx"
|
||||
#include "doubleDataTransition.cxx"
|
||||
#include "doublePtrDataAttribute.cxx"
|
||||
#include "doublePtrDataTransition.cxx"
|
||||
#include "intDataAttribute.cxx"
|
||||
#include "intDataTransition.cxx"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
// Filename: dgraph_headers.h
|
||||
// Created by: georges (30May01)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <indent.h>
|
||||
|
||||
#include "buttonEventDataAttribute.h"
|
||||
#include "buttonEventDataTransition.h"
|
||||
#include "config_dgraph.h"
|
||||
#include "dataGraphTraversal.h"
|
||||
#include "dataGraphTraverser.h"
|
||||
#include "dataNode.h"
|
||||
#include "dataRelation.h"
|
||||
#include "describe_data_verbose.h"
|
||||
#include "doubleDataAttribute.h"
|
||||
#include "doubleDataTransition.h"
|
||||
#include "doublePtrDataAttribute.h"
|
||||
#include "doublePtrDataTransition.h"
|
||||
#include "intDataAttribute.h"
|
||||
#include "intDataTransition.h"
|
||||
#include "matrixDataAttribute.h"
|
||||
#include "matrixDataTransition.h"
|
||||
#include "vec3DataAttribute.h"
|
||||
#include "vec3DataTransition.h"
|
||||
#include "vec4DataAttribute.h"
|
||||
#include "vec4DataTransition.h"
|
||||
|
||||
#pragma hdrstop
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
// Filename: doubleDataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoubleDataAttribute::
|
||||
DoubleDataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoubleDataAttribute::
|
||||
DoubleDataAttribute(double value) : NumericDataAttribute<double>(value) {
|
||||
}
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: doubleDataAttribute.cxx
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "doubleDataAttribute.h"
|
||||
#include "doubleDataTransition.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle DoubleDataAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *DoubleDataAttribute::
|
||||
make_copy() const {
|
||||
return new DoubleDataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *DoubleDataAttribute::
|
||||
make_initial() const {
|
||||
return new DoubleDataAttribute;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
// Filename: doubleDataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DOUBLEDATAATTRIBUTE_H
|
||||
#define DOUBLEDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "numericDataAttribute.h"
|
||||
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataAttribute<double>);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DoubleDataAttribute
|
||||
// Description : A NumericDataAttribute templated on double types.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA DoubleDataAttribute :
|
||||
public NumericDataAttribute<double> {
|
||||
public:
|
||||
INLINE DoubleDataAttribute();
|
||||
INLINE DoubleDataAttribute(double value);
|
||||
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NumericDataAttribute<double>::init_type();
|
||||
register_type(_type_handle, "DoubleDataAttribute",
|
||||
NumericDataAttribute<double>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "doubleDataAttribute.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -16,14 +16,6 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoubleDataTransition::
|
||||
DoubleDataTransition() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataTransition::Constructor
|
||||
|
|
@ -31,8 +23,8 @@ DoubleDataTransition() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoubleDataTransition::
|
||||
DoubleDataTransition(double scale, double offset) :
|
||||
NumericDataTransition<double>(scale, offset)
|
||||
DoubleDataTransition(double value) :
|
||||
NumericDataTransition<double>(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
|
||||
#include "doubleDataTransition.h"
|
||||
#include "doubleDataAttribute.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -36,13 +35,3 @@ NodeTransition *DoubleDataTransition::
|
|||
make_copy() const {
|
||||
return new DoubleDataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoubleDataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *DoubleDataTransition::
|
||||
make_attrib() const {
|
||||
return new DoubleDataAttribute;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,9 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataTransition<double>);
|
|||
class EXPCL_PANDA DoubleDataTransition :
|
||||
public NumericDataTransition<double> {
|
||||
public:
|
||||
INLINE DoubleDataTransition();
|
||||
INLINE DoubleDataTransition(double scale, double offset);
|
||||
INLINE DoubleDataTransition(double value = 0.0);
|
||||
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
// Filename: doublePtrDataAttribute.I
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoublePtrDataAttribute::
|
||||
DoublePtrDataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoublePtrDataAttribute::
|
||||
DoublePtrDataAttribute(double* ptr) : PointerDataAttribute<double>(ptr) {
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: doublePtrDataAttribute.cxx
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "doublePtrDataAttribute.h"
|
||||
#include "doublePtrDataTransition.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle DoublePtrDataAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *DoublePtrDataAttribute::
|
||||
make_copy() const {
|
||||
return new DoublePtrDataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *DoublePtrDataAttribute::
|
||||
make_initial() const {
|
||||
return new DoublePtrDataAttribute;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
// Filename: doublePtrDataAttribute.h
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DOUBLEPTRDATAATTRIBUTE_H
|
||||
#define DOUBLEPTRDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "pointerDataAttribute.h"
|
||||
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerDataAttribute<double>);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DoublePtrDataAttribute
|
||||
// Description : A PointerDataAttribute templated on double types.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA DoublePtrDataAttribute :
|
||||
public PointerDataAttribute<double> {
|
||||
public:
|
||||
INLINE DoublePtrDataAttribute();
|
||||
INLINE DoublePtrDataAttribute(double* ptr);
|
||||
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
PointerDataAttribute<double>::init_type();
|
||||
register_type(_type_handle, "DoublePtrDataAttribute",
|
||||
PointerDataAttribute<double>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "doublePtrDataAttribute.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
// Filename: doublePtrDataTransition.I
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoublePtrDataTransition::
|
||||
DoublePtrDataTransition() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE DoublePtrDataTransition::
|
||||
DoublePtrDataTransition(double* ptr) :
|
||||
PointerDataTransition<double>(ptr)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: doublePtrDataTransition.cxx
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "doublePtrDataTransition.h"
|
||||
#include "doublePtrDataAttribute.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle DoublePtrDataTransition::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataTransition::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeTransition *DoublePtrDataTransition::
|
||||
make_copy() const {
|
||||
return new DoublePtrDataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DoublePtrDataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *DoublePtrDataTransition::
|
||||
make_attrib() const {
|
||||
return new DoublePtrDataAttribute;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
// Filename: doublePtrDataTransition.h
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef DOUBLEPTRDATATRANSITION_H
|
||||
#define DOUBLEPTRDATATRANSITION_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "pointerDataTransition.h"
|
||||
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerDataTransition<double>);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : DoublePtrDataTransition
|
||||
// Description : A PointerDataTransition templated on double types.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA DoublePtrDataTransition :
|
||||
public PointerDataTransition<double> {
|
||||
public:
|
||||
INLINE DoublePtrDataTransition();
|
||||
INLINE DoublePtrDataTransition(double* ptr);
|
||||
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
PointerDataTransition<double>::init_type();
|
||||
register_type(_type_handle, "DoublePtrDataTransition",
|
||||
PointerDataTransition<double>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "doublePtrDataTransition.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
// Filename: intDataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IntDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IntDataAttribute::
|
||||
IntDataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IntDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IntDataAttribute::
|
||||
IntDataAttribute(int value) : NumericDataAttribute<int>(value) {
|
||||
}
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: intDataAttribute.cxx
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "intDataAttribute.h"
|
||||
#include "intDataTransition.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle IntDataAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IntDataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *IntDataAttribute::
|
||||
make_copy() const {
|
||||
return new IntDataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IntDataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *IntDataAttribute::
|
||||
make_initial() const {
|
||||
return new IntDataAttribute;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
// Filename: intDataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INTDATAATTRIBUTE_H
|
||||
#define INTDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "numericDataAttribute.h"
|
||||
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataAttribute<int>);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : IntDataAttribute
|
||||
// Description : A NumericDataAttribute templated on integer types.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA IntDataAttribute :
|
||||
public NumericDataAttribute<int> {
|
||||
public:
|
||||
INLINE IntDataAttribute();
|
||||
INLINE IntDataAttribute(int value);
|
||||
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NumericDataAttribute<int>::init_type();
|
||||
register_type(_type_handle, "IntDataAttribute",
|
||||
NumericDataAttribute<int>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "intDataAttribute.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -22,17 +22,8 @@
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IntDataTransition::
|
||||
IntDataTransition() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IntDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE IntDataTransition::
|
||||
IntDataTransition(int scale, int offset) :
|
||||
NumericDataTransition<int>(scale, offset)
|
||||
IntDataTransition(int value) :
|
||||
NumericDataTransition<int>(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
|
||||
#include "intDataTransition.h"
|
||||
#include "intDataAttribute.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -36,13 +35,3 @@ NodeTransition *IntDataTransition::
|
|||
make_copy() const {
|
||||
return new IntDataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: IntDataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *IntDataTransition::
|
||||
make_attrib() const {
|
||||
return new IntDataAttribute;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,9 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataTransition<int>);
|
|||
class EXPCL_PANDA IntDataTransition :
|
||||
public NumericDataTransition<int> {
|
||||
public:
|
||||
INLINE IntDataTransition();
|
||||
INLINE IntDataTransition(int scale, int offset);
|
||||
INLINE IntDataTransition(int value = 0);
|
||||
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
// Filename: matrixDataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MatrixDataAttribute::
|
||||
MatrixDataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MatrixDataAttribute::
|
||||
MatrixDataAttribute(const LMatrix4f &value) :
|
||||
VectorDataAttribute<LMatrix4f, LMatrix4f>(value)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: matrixDataAttribute.cxx
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "matrixDataAttribute.h"
|
||||
#include "matrixDataTransition.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle MatrixDataAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *MatrixDataAttribute::
|
||||
make_copy() const {
|
||||
return new MatrixDataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *MatrixDataAttribute::
|
||||
make_initial() const {
|
||||
return new MatrixDataAttribute;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// Filename: matrixDataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef MATRIXDATAATTRIBUTE_H
|
||||
#define MATRIXDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "vectorDataAttribute.h"
|
||||
|
||||
#include <luse.h>
|
||||
|
||||
// We need to define this temporary macro so we can pass a parameter
|
||||
// containing a comma through the macro.
|
||||
#define VECTORDATAATTRIBUTE_LMATRIX4F VectorDataAttribute<LMatrix4f, LMatrix4f>
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LMATRIX4F);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : MatrixDataAttribute
|
||||
// Description : A VectorDataAttribute templated on LMatrix4f.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA MatrixDataAttribute :
|
||||
public VectorDataAttribute<LMatrix4f, LMatrix4f> {
|
||||
public:
|
||||
INLINE MatrixDataAttribute();
|
||||
INLINE MatrixDataAttribute(const LMatrix4f &value);
|
||||
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
VectorDataAttribute<LMatrix4f, LMatrix4f>::init_type();
|
||||
register_type(_type_handle, "MatrixDataAttribute",
|
||||
VectorDataAttribute<LMatrix4f, LMatrix4f>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "matrixDataAttribute.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -16,14 +16,6 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MatrixDataTransition::
|
||||
MatrixDataTransition() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataTransition::Constructor
|
||||
|
|
@ -31,8 +23,8 @@ MatrixDataTransition() {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MatrixDataTransition::
|
||||
MatrixDataTransition(const LMatrix4f &matrix) :
|
||||
VectorDataTransition<LMatrix4f, LMatrix4f>(matrix)
|
||||
MatrixDataTransition(const LMatrix4f &value) :
|
||||
VectorDataTransition<LMatrix4f>(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
|
||||
#include "matrixDataTransition.h"
|
||||
#include "matrixDataAttribute.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -36,13 +35,3 @@ NodeTransition *MatrixDataTransition::
|
|||
make_copy() const {
|
||||
return new MatrixDataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: MatrixDataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *MatrixDataTransition::
|
||||
make_attrib() const {
|
||||
return new MatrixDataAttribute;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// We need to define this temporary macro so we can pass a parameter
|
||||
// containing a comma through the macro.
|
||||
#define VECTORDATATRANSITION_LMATRIX4F VectorDataTransition<LMatrix4f, LMatrix4f>
|
||||
#define VECTORDATATRANSITION_LMATRIX4F VectorDataTransition<LMatrix4f>
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LMATRIX4F);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -35,13 +35,11 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LMATRIX4F);
|
|||
// Description : A VectorDataTransition templated on LMatrix4f.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA MatrixDataTransition :
|
||||
public VectorDataTransition<LMatrix4f, LMatrix4f> {
|
||||
public VectorDataTransition<LMatrix4f> {
|
||||
public:
|
||||
INLINE MatrixDataTransition();
|
||||
INLINE MatrixDataTransition(const LMatrix4f &matrix);
|
||||
INLINE MatrixDataTransition(const LMatrix4f &value = LMatrix4f::ident_mat());
|
||||
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
@ -52,9 +50,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
VectorDataTransition<LMatrix4f, LMatrix4f>::init_type();
|
||||
VectorDataTransition<LMatrix4f>::init_type();
|
||||
register_type(_type_handle, "MatrixDataTransition",
|
||||
VectorDataTransition<LMatrix4f, LMatrix4f>::get_class_type());
|
||||
VectorDataTransition<LMatrix4f>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,145 +0,0 @@
|
|||
// Filename: numericDataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* okcircular */
|
||||
#include "numericDataTransition.h"
|
||||
|
||||
|
||||
template<class NumType>
|
||||
TypeHandle NumericDataAttribute<NumType>::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE NumericDataAttribute<NumType>::
|
||||
NumericDataAttribute() {
|
||||
_value = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE NumericDataAttribute<NumType>::
|
||||
NumericDataAttribute(NumType value) :
|
||||
_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE NumericDataAttribute<NumType>::
|
||||
NumericDataAttribute(const NumericDataAttribute<NumType> ©) :
|
||||
NodeAttribute(copy),
|
||||
_value(copy._value)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE void NumericDataAttribute<NumType>::
|
||||
operator = (const NumericDataAttribute<NumType> ©) {
|
||||
NodeAttribute::operator = (copy);
|
||||
_value = copy._value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::set_value
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE void NumericDataAttribute<NumType>::
|
||||
set_value(NumType value) {
|
||||
_value = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::get_value
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE NumType NumericDataAttribute<NumType>::
|
||||
get_value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::get_handle
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
TypeHandle NumericDataAttribute<NumType>::
|
||||
get_handle() const {
|
||||
return NumericDataTransition<NumType>::get_class_type();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataAttribute<NumType>::
|
||||
output(ostream &out) const {
|
||||
out << _value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataAttribute<NumType>::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << _value << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::internal_compare_to
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
int NumericDataAttribute<NumType>::
|
||||
internal_compare_to(const NodeAttribute *other) const {
|
||||
const NumericDataAttribute<NumType> *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
if (_value != ot->_value) {
|
||||
return (_value < ot->_value) ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
// Filename: numericDataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef NUMERICDATAATTRIBUTE_H
|
||||
#define NUMERICDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <indent.h>
|
||||
#include <nodeAttribute.h>
|
||||
|
||||
template<class NumType>
|
||||
class NumericDataTransition;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : NumericDataAttribute
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
class NumericDataAttribute : public NodeAttribute {
|
||||
public:
|
||||
INLINE NumericDataAttribute();
|
||||
INLINE NumericDataAttribute(NumType value);
|
||||
INLINE NumericDataAttribute(const NumericDataAttribute<NumType> ©);
|
||||
INLINE void operator = (const NumericDataAttribute<NumType> ©);
|
||||
|
||||
public:
|
||||
INLINE void set_value(NumType value);
|
||||
INLINE NumType get_value() const;
|
||||
|
||||
virtual TypeHandle get_handle() const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeAttribute *other) const;
|
||||
|
||||
private:
|
||||
NumType _value;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NodeAttribute::init_type();
|
||||
register_type(_type_handle,
|
||||
string("NumericDataAttribute<") +
|
||||
get_type_handle(NumType).get_name() + ">",
|
||||
NodeAttribute::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
friend class NumericDataTransition<NumType>;
|
||||
};
|
||||
|
||||
#include "numericDataAttribute.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -16,9 +16,6 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* okcircular */
|
||||
#include "numericDataAttribute.h"
|
||||
|
||||
template<class NumType>
|
||||
TypeHandle NumericDataTransition<NumType>::_type_handle;
|
||||
|
||||
|
|
@ -29,22 +26,8 @@ TypeHandle NumericDataTransition<NumType>::_type_handle;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE NumericDataTransition<NumType>::
|
||||
NumericDataTransition() :
|
||||
_scale(1),
|
||||
_offset(0)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE NumericDataTransition<NumType>::
|
||||
NumericDataTransition(NumType scale, NumType offset) :
|
||||
_scale(scale),
|
||||
_offset(offset)
|
||||
NumericDataTransition(NumType value) :
|
||||
_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -56,9 +39,8 @@ NumericDataTransition(NumType scale, NumType offset) :
|
|||
template<class NumType>
|
||||
INLINE NumericDataTransition<NumType>::
|
||||
NumericDataTransition(const NumericDataTransition<NumType> ©) :
|
||||
NodeTransition(copy),
|
||||
_scale(copy._scale),
|
||||
_offset(copy._offset)
|
||||
OnTransition(copy),
|
||||
_value(copy._value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -70,195 +52,85 @@ NumericDataTransition(const NumericDataTransition<NumType> ©) :
|
|||
template<class NumType>
|
||||
INLINE void NumericDataTransition<NumType>::
|
||||
operator = (const NumericDataTransition<NumType> ©) {
|
||||
NodeTransition::operator = (copy);
|
||||
_scale = copy._scale;
|
||||
_offset = copy._offset;
|
||||
OnTransition::operator = (copy);
|
||||
_value = copy._value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::is_identity
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns true if this transition does not affect any
|
||||
// numbers going through it.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
INLINE bool NumericDataTransition<NumType>::
|
||||
is_identity() const {
|
||||
return (_scale == 1.0 && _offset == 0.0);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::set_scale
|
||||
// Function: NumericDataTransition::set_value
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataTransition<NumType>::
|
||||
set_scale(NumType scale) {
|
||||
_scale = scale;
|
||||
INLINE void NumericDataTransition<NumType>::
|
||||
set_value(NumType value) {
|
||||
_value = value;
|
||||
state_changed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::get_scale
|
||||
// Function: NumericDataTransition::get_value
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
NumType NumericDataTransition<NumType>::
|
||||
get_scale() const {
|
||||
return _scale;
|
||||
INLINE NumType NumericDataTransition<NumType>::
|
||||
get_value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::set_offset
|
||||
// Function: NumericDataTransition::set_value_from
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
// Description: Copies the value from the other transition pointer,
|
||||
// which is guaranteed to be another NumericDataTransition.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataTransition<NumType>::
|
||||
set_offset(NumType offset) {
|
||||
_offset = offset;
|
||||
state_changed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::get_offset
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
NumType NumericDataTransition<NumType>::
|
||||
get_offset() const {
|
||||
return _offset;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::compose
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a new transition that corresponds to the
|
||||
// composition of this transition with the second
|
||||
// transition (which must be of an equivalent type).
|
||||
// This may return the same pointer as either source
|
||||
// transition. Applying the transition returned from
|
||||
// this function to an attribute attribute will produce
|
||||
// the same effect as applying each transition
|
||||
// separately.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
NodeTransition *NumericDataTransition<NumType>::
|
||||
compose(const NodeTransition *other) const {
|
||||
set_value_from(const OnTransition *other) {
|
||||
const NumericDataTransition<NumType> *ot;
|
||||
DCAST_INTO_R(ot, other, NULL);
|
||||
|
||||
if (is_identity()) {
|
||||
return (NumericDataTransition<NumType> *)ot;
|
||||
|
||||
} else if (ot->is_identity()) {
|
||||
return (NumericDataTransition<NumType> *)this;
|
||||
|
||||
} else {
|
||||
NodeTransition *c = make_copy();
|
||||
NumericDataTransition<NumType> *result;
|
||||
DCAST_INTO_R(result, c, NULL);
|
||||
|
||||
result->_offset = _offset + _scale * ot->_offset;
|
||||
result->_scale = _scale * ot->_scale;
|
||||
return result;
|
||||
}
|
||||
DCAST_INTO_V(ot, other);
|
||||
_value = ot->_value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::invert
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
NodeTransition *NumericDataTransition<NumType>::
|
||||
invert() const {
|
||||
if (is_identity()) {
|
||||
return (NumericDataTransition<NumType> *)this;
|
||||
|
||||
} else if (_scale == 0) {
|
||||
// Singular; cannot invert.
|
||||
return NULL;
|
||||
|
||||
} else {
|
||||
NodeTransition *c = make_copy();
|
||||
NumericDataTransition<NumType> *result;
|
||||
DCAST_INTO_R(result, c, NULL);
|
||||
|
||||
result->_offset = - _offset / _scale;
|
||||
result->_scale = (NumType)1 / _scale;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::apply
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a new attribute (or possibly the same
|
||||
// attribute) that represents the effect of applying this
|
||||
// indicated transition to the indicated attribute. The
|
||||
// source attribute may be NULL, indicating the initial
|
||||
// attribute.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
NodeAttribute *NumericDataTransition<NumType>::
|
||||
apply(const NodeAttribute *attrib) const {
|
||||
const NumericDataAttribute<NumType> *at;
|
||||
DCAST_INTO_R(at, attrib, NULL);
|
||||
|
||||
if (is_identity()) {
|
||||
return (NumericDataAttribute<NumType> *)attrib;
|
||||
}
|
||||
|
||||
NodeAttribute *c = make_attrib();
|
||||
NumericDataAttribute<NumType> *result;
|
||||
DCAST_INTO_R(result, c, NULL);
|
||||
|
||||
result->_value = at->_value * _scale + _offset;
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataTransition<NumType>::
|
||||
output(ostream &out) const {
|
||||
out << _scale << "x + " << _offset;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataTransition<NumType>::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << _scale << "x + " << _offset << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::internal_compare_to
|
||||
// Function: NumericDataTransition::compare_values
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
int NumericDataTransition<NumType>::
|
||||
internal_compare_to(const NodeTransition *other) const {
|
||||
compare_values(const OnTransition *other) const {
|
||||
const NumericDataTransition<NumType> *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
if (_scale != ot->_scale) {
|
||||
return (_scale < ot->_scale) ? -1 : 1;
|
||||
if (_value < ot->_value) {
|
||||
return -1;
|
||||
} else if (ot->_value < _value) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (_offset != ot->_offset) {
|
||||
return (_offset < ot->_offset) ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::output_value
|
||||
// Access: Protected, Virtual
|
||||
// Description: Formats the value for human consumption on one line.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataTransition<NumType>::
|
||||
output_value(ostream &out) const {
|
||||
out << _value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataTransition::write_value
|
||||
// Access: Protected, Virtual
|
||||
// Description: Formats the value for human consumption on multiple
|
||||
// lines if necessary.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
void NumericDataTransition<NumType>::
|
||||
write_value(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << _value << "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,50 +19,36 @@
|
|||
#ifndef NUMERICDATATRANSITION_H
|
||||
#define NUMERICDATATRANSITION_H
|
||||
|
||||
#include <pandabase.h>
|
||||
#include "pandabase.h"
|
||||
|
||||
#include <nodeTransition.h>
|
||||
#include <indent.h>
|
||||
#include "onTransition.h"
|
||||
#include "indent.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : NumericDataTransition
|
||||
// Description : A NumericDataAttribute is a special data graph
|
||||
// Description : A NumericDataTransition is a special data graph
|
||||
// attribute that is used to pass around a single
|
||||
// number. A NumericDataTransition isn't often used,
|
||||
// but when it is it may transform the number by a scale
|
||||
// and/or offset.
|
||||
// number.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class NumType>
|
||||
class NumericDataTransition : public NodeTransition {
|
||||
class NumericDataTransition : public OnTransition {
|
||||
public:
|
||||
INLINE NumericDataTransition();
|
||||
INLINE NumericDataTransition(NumType scale, NumType offset);
|
||||
INLINE NumericDataTransition(NumType value);
|
||||
INLINE NumericDataTransition(const NumericDataTransition<NumType> ©);
|
||||
INLINE void operator = (const NumericDataTransition<NumType> ©);
|
||||
|
||||
public:
|
||||
|
||||
INLINE bool is_identity() const;
|
||||
|
||||
INLINE void set_scale(NumType scale);
|
||||
INLINE NumType get_scale() const;
|
||||
|
||||
INLINE void set_offset(NumType offset);
|
||||
INLINE NumType get_offset() const;
|
||||
|
||||
virtual NodeTransition *compose(const NodeTransition *other) const;
|
||||
virtual NodeTransition *invert() const;
|
||||
virtual NodeAttribute *apply(const NodeAttribute *attrib) const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
INLINE void set_value(NumType value);
|
||||
INLINE NumType get_value() const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeTransition *other) const;
|
||||
virtual void set_value_from(const OnTransition *other);
|
||||
virtual int compare_values(const OnTransition *other) const;
|
||||
virtual void output_value(ostream &out) const;
|
||||
virtual void write_value(ostream &out, int indent_level) const;
|
||||
|
||||
private:
|
||||
NumType _scale;
|
||||
NumType _offset;
|
||||
NumType _value;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
@ -73,11 +59,11 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NodeTransition::init_type();
|
||||
OnTransition::init_type();
|
||||
register_type(_type_handle,
|
||||
string("NumericDataTransition<") +
|
||||
get_type_handle(NumType).get_name() + ">",
|
||||
NodeTransition::get_class_type());
|
||||
OnTransition::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,148 +0,0 @@
|
|||
// Filename: pointerDataAttribute.I
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* okcircular */
|
||||
#include "pointerDataTransition.h"
|
||||
|
||||
template<class PtrType>
|
||||
TypeHandle PointerDataAttribute<PtrType>::_type_handle;
|
||||
|
||||
template<class PtrType>
|
||||
PtrType* PointerDataAttribute<PtrType>::_null_ptr = (PtrType*)NULL;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE PointerDataAttribute<PtrType>::
|
||||
PointerDataAttribute() :
|
||||
_ptr(_null_ptr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE PointerDataAttribute<PtrType>::
|
||||
PointerDataAttribute(PtrType* ptr) :
|
||||
_ptr(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE PointerDataAttribute<PtrType>::
|
||||
PointerDataAttribute(const PointerDataAttribute<PtrType> ©) :
|
||||
NodeAttribute(copy), _ptr(copy._ptr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE void PointerDataAttribute<PtrType>::
|
||||
operator = (const PointerDataAttribute<PtrType> ©) {
|
||||
NodeAttribute::operator = (copy);
|
||||
_ptr = copy._ptr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::set_value
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
void PointerDataAttribute<PtrType>::
|
||||
set_value(PtrType* ptr) {
|
||||
_ptr = ptr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::get_value
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
PtrType* PointerDataAttribute<PtrType>::
|
||||
get_value() const {
|
||||
return _ptr;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: NumericDataAttribute::get_handle
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
TypeHandle PointerDataAttribute<PtrType>::
|
||||
get_handle() const {
|
||||
return PointerDataTransition<PtrType>::get_class_type();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
void PointerDataAttribute<PtrType>::
|
||||
output(ostream &out) const {
|
||||
out << (void*)_ptr << endl;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
void PointerDataAttribute<PtrType>::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << (void*)_ptr << endl;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataAttribute::internal_compare_to
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
int PointerDataAttribute<PtrType>::
|
||||
internal_compare_to(const NodeAttribute *other) const {
|
||||
const PointerDataAttribute<PtrType> *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
if (_ptr != ot->_ptr) {
|
||||
return (_ptr > ot->_ptr) ? 1 : -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
// Filename: pointerDataAttribute.h
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef POINTERDATAATTRIBUTE_H
|
||||
#define POINTERDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <nodeAttribute.h>
|
||||
#include <indent.h>
|
||||
|
||||
template<class PtrType>
|
||||
class PointerDataTransition;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : PointerDataTransition
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
class PointerDataAttribute : public NodeAttribute {
|
||||
public:
|
||||
INLINE PointerDataAttribute();
|
||||
INLINE PointerDataAttribute(PtrType* ptr);
|
||||
INLINE PointerDataAttribute(const PointerDataAttribute<PtrType> ©);
|
||||
INLINE void operator = (const PointerDataAttribute<PtrType> ©);
|
||||
|
||||
public:
|
||||
INLINE void set_value(PtrType* ptr);
|
||||
INLINE PtrType* get_value() const;
|
||||
|
||||
virtual TypeHandle get_handle() const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeAttribute *other) const;
|
||||
|
||||
private:
|
||||
PtrType* _ptr;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NodeAttribute::init_type();
|
||||
register_type(_type_handle,
|
||||
string("PointerDataAttribute<") +
|
||||
get_type_handle(PtrType).get_name() + ">",
|
||||
NodeAttribute::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
friend class PointerDataTransition<PtrType>;
|
||||
|
||||
//Variable is just to make the compiler happy for the default
|
||||
//constructor
|
||||
static PtrType* _null_ptr;
|
||||
};
|
||||
|
||||
#include "pointerDataAttribute.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
// Filename: pointerDataTransition.I
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* okcircular */
|
||||
#include "pointerDataAttribute.h"
|
||||
|
||||
template<class PtrType>
|
||||
TypeHandle PointerDataTransition<PtrType>::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE PointerDataTransition<PtrType>::
|
||||
PointerDataTransition() :
|
||||
_ptr(PointerDataAttribute<PtrType>::_null_ptr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE PointerDataTransition<PtrType>::
|
||||
PointerDataTransition(PtrType* ptr) :
|
||||
_ptr(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE PointerDataTransition<PtrType>::
|
||||
PointerDataTransition(const PointerDataTransition<PtrType> ©) :
|
||||
NodeTransition(copy), _ptr(copy._ptr)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
INLINE void PointerDataTransition<PtrType>::
|
||||
operator = (const PointerDataTransition<PtrType> ©) {
|
||||
NodeTransition::operator = (copy);
|
||||
_ptr = copy._ptr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::set_value
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
void PointerDataTransition<PtrType>::
|
||||
set_value(PtrType* ptr) {
|
||||
_ptr = ptr;
|
||||
state_changed();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::get_value
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
PtrType* PointerDataTransition<PtrType>::
|
||||
get_value() const {
|
||||
return _ptr;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::compose
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a new transition that corresponds to the
|
||||
// composition of this transition with the second
|
||||
// transition (which must be of an equivalent type).
|
||||
// This may return the same pointer as either source
|
||||
// transition. Applying the transition returned from
|
||||
// this function to an attribute attribute will produce
|
||||
// the same effect as applying each transition
|
||||
// separately.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
NodeTransition *PointerDataTransition<PtrType>::
|
||||
compose(const NodeTransition *other) const {
|
||||
const PointerDataTransition<PtrType> *ot;
|
||||
DCAST_INTO_R(ot, other, NULL);
|
||||
|
||||
return (NodeTransition*)other;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::invert
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
NodeTransition *PointerDataTransition<PtrType>::
|
||||
invert() const {
|
||||
return (NodeTransition*)this;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::apply
|
||||
// Access: Public, Virtual
|
||||
// Description: Returns a new attribute (or possibly the same
|
||||
// attribute) that represents the effect of applying this
|
||||
// indicated transition to the indicated attribute. The
|
||||
// source attribute may be NULL, indicating the initial
|
||||
// attribute.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
NodeAttribute *PointerDataTransition<PtrType>::
|
||||
apply(const NodeAttribute *attrib) const {
|
||||
const PointerDataAttribute<PtrType> *at;
|
||||
DCAST_INTO_R(at, attrib, NULL);
|
||||
|
||||
return (NodeAttribute*)attrib;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
void PointerDataTransition<PtrType>::
|
||||
output(ostream &out) const {
|
||||
out << (void*)_ptr << endl;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
void PointerDataTransition<PtrType>::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << (void*)_ptr << endl;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Function: PointerDataTransition::internal_compare_to
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
int PointerDataTransition<PtrType>::
|
||||
internal_compare_to(const NodeTransition *other) const {
|
||||
const PointerDataTransition<PtrType> *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
if (_ptr != ot->_ptr) {
|
||||
return (_ptr > ot->_ptr) ? 1 : -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
// Filename: pointerDataTransition.h
|
||||
// Created by: jason (07Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef POINTERDATATRANSITION_H
|
||||
#define POINTERDATATRANSITION_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <nodeTransition.h>
|
||||
#include <indent.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : PointerDataTransition
|
||||
// Description : A PointerDataAttribute is a special data graph
|
||||
// attribute that is used to pass around a single
|
||||
// pointer.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class PtrType>
|
||||
class PointerDataTransition : public NodeTransition {
|
||||
public:
|
||||
INLINE PointerDataTransition();
|
||||
INLINE PointerDataTransition(PtrType* ptr);
|
||||
INLINE PointerDataTransition(const PointerDataTransition<PtrType> ©);
|
||||
INLINE void operator = (const PointerDataTransition<PtrType> ©);
|
||||
|
||||
public:
|
||||
INLINE void set_value(PtrType* ptr);
|
||||
INLINE PtrType* get_value() const;
|
||||
|
||||
virtual NodeTransition *compose(const NodeTransition *other) const;
|
||||
virtual NodeTransition *invert() const;
|
||||
virtual NodeAttribute *apply(const NodeAttribute *attrib) const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeTransition *other) const;
|
||||
|
||||
private:
|
||||
PtrType* _ptr;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NodeTransition::init_type();
|
||||
register_type(_type_handle,
|
||||
string("PointerDataTransition<") +
|
||||
get_type_handle(PtrType).get_name() + ">",
|
||||
NodeTransition::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "pointerDataTransition.I"
|
||||
|
||||
#endif
|
||||
|
|
@ -22,9 +22,7 @@
|
|||
#include "dataRelation.h"
|
||||
#include "dataGraphTraversal.h"
|
||||
#include "doubleDataTransition.h"
|
||||
#include "doubleDataAttribute.h"
|
||||
#include "vec3DataTransition.h"
|
||||
#include "vec3DataAttribute.h"
|
||||
|
||||
#include <pt_NamedNode.h>
|
||||
|
||||
|
|
@ -40,11 +38,11 @@ public:
|
|||
Producer(const string &name);
|
||||
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
NodeAttributes _attrib;
|
||||
PT(DoubleDataAttribute) _t;
|
||||
PT(Vec3DataAttribute) _xyz;
|
||||
AllTransitionsWrapper _attrib;
|
||||
PT(DoubleDataTransition) _t;
|
||||
PT(Vec3DataTransition) _xyz;
|
||||
|
||||
static TypeHandle _t_type;
|
||||
static TypeHandle _xyz_type;
|
||||
|
|
@ -82,18 +80,18 @@ TypeHandle Producer::_xyz_type;
|
|||
|
||||
Producer::
|
||||
Producer(const string &name) : DataNode(name) {
|
||||
_t = new DoubleDataAttribute(0.0);
|
||||
_xyz = new Vec3DataAttribute(LPoint3f(0.0, 0.0, 0.0));
|
||||
_t = new DoubleDataTransition(0.0);
|
||||
_xyz = new Vec3DataTransition(LPoint3f(0.0, 0.0, 0.0));
|
||||
|
||||
// Set up our _attrib member to directly reference our data members.
|
||||
// This way we can simply return a reference to our _attrib member,
|
||||
// without bothering to construct a new one each time.
|
||||
_attrib.set_attribute(_t_type, _t);
|
||||
_attrib.set_attribute(_xyz_type, _xyz);
|
||||
_attrib.set_transition(_t_type, _t);
|
||||
_attrib.set_transition(_xyz_type, _xyz);
|
||||
}
|
||||
|
||||
void Producer::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
nout << get_name() << " sending xyz " << *_xyz << " t " << *_t << "\n";
|
||||
data = _attrib;
|
||||
}
|
||||
|
|
@ -112,7 +110,7 @@ public:
|
|||
Consumer(const string &name) : DataNode(name) { }
|
||||
|
||||
virtual void
|
||||
transmit_data(NodeAttributes &data);
|
||||
transmit_data(AllTransitionsWrapper &data);
|
||||
|
||||
|
||||
static TypeHandle _s_type;
|
||||
|
|
@ -154,14 +152,14 @@ TypeHandle Consumer::_t_type;
|
|||
TypeHandle Consumer::_xyz_type;
|
||||
|
||||
void Consumer::
|
||||
transmit_data(NodeAttributes &data) {
|
||||
const DoubleDataAttribute *s;
|
||||
const DoubleDataAttribute *t;
|
||||
const Vec3DataAttribute *xyz;
|
||||
transmit_data(AllTransitionsWrapper &data) {
|
||||
const DoubleDataTransition *s;
|
||||
const DoubleDataTransition *t;
|
||||
const Vec3DataTransition *xyz;
|
||||
|
||||
if (get_attribute_into(s, data, _s_type) &&
|
||||
get_attribute_into(t, data, _t_type) &&
|
||||
get_attribute_into(xyz, data, _xyz_type)) {
|
||||
if (get_transition_into(s, data, _s_type) &&
|
||||
get_transition_into(t, data, _t_type) &&
|
||||
get_transition_into(xyz, data, _xyz_type)) {
|
||||
nout << get_name() << " got xyz " << *xyz << " s " << *s
|
||||
<< " t " << *t << "\n";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
// Filename: vec3DataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec3DataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec3DataAttribute::
|
||||
Vec3DataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec3DataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec3DataAttribute::
|
||||
Vec3DataAttribute(const LVecBase3f &value) :
|
||||
VectorDataAttribute<LPoint3f, LMatrix4f>(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: vec3DataAttribute.cxx
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "vec3DataAttribute.h"
|
||||
#include "vec3DataTransition.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle Vec3DataAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec3DataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *Vec3DataAttribute::
|
||||
make_copy() const {
|
||||
return new Vec3DataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec3DataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *Vec3DataAttribute::
|
||||
make_initial() const {
|
||||
return new Vec3DataAttribute;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// Filename: vec3DataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef VEC3DATAATTRIBUTE_H
|
||||
#define VEC3DATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "vectorDataAttribute.h"
|
||||
|
||||
#include <luse.h>
|
||||
|
||||
// We need to define this temporary macro so we can pass a parameter
|
||||
// containing a comma through the macro.
|
||||
#define VECTORDATAATTRIBUTE_LPOINT3F VectorDataAttribute<LPoint3f, LMatrix4f>
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LPOINT3F);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : Vec3DataAttribute
|
||||
// Description : A VectorDataAttribute templated on LPoint3f.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA Vec3DataAttribute :
|
||||
public VectorDataAttribute<LPoint3f, LMatrix4f> {
|
||||
public:
|
||||
INLINE Vec3DataAttribute();
|
||||
INLINE Vec3DataAttribute(const LVecBase3f &value);
|
||||
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
VectorDataAttribute<LPoint3f, LMatrix4f>::init_type();
|
||||
register_type(_type_handle, "Vec3DataAttribute",
|
||||
VectorDataAttribute<LPoint3f, LMatrix4f>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "vec3DataAttribute.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -22,17 +22,8 @@
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec3DataTransition::
|
||||
Vec3DataTransition() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec3DataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec3DataTransition::
|
||||
Vec3DataTransition(const LMatrix4f &matrix) :
|
||||
VectorDataTransition<LPoint3f, LMatrix4f>(matrix)
|
||||
Vec3DataTransition(const LPoint3f &value) :
|
||||
VectorDataTransition<LPoint3f>(value)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
|
||||
#include "vec3DataTransition.h"
|
||||
#include "vec3DataAttribute.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -36,13 +35,3 @@ NodeTransition *Vec3DataTransition::
|
|||
make_copy() const {
|
||||
return new Vec3DataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec3DataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *Vec3DataTransition::
|
||||
make_attrib() const {
|
||||
return new Vec3DataAttribute;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// We need to define this temporary macro so we can pass a parameter
|
||||
// containing a comma through the macro.
|
||||
#define VECTORDATATRANSITION_LPOINT3F VectorDataTransition<LPoint3f, LMatrix4f>
|
||||
#define VECTORDATATRANSITION_LPOINT3F VectorDataTransition<LPoint3f>
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LPOINT3F);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -35,13 +35,11 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LPOINT3F);
|
|||
// Description : A VectorDataTransition templated on LPoint3f.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA Vec3DataTransition :
|
||||
public VectorDataTransition<LPoint3f, LMatrix4f> {
|
||||
public VectorDataTransition<LPoint3f> {
|
||||
public:
|
||||
INLINE Vec3DataTransition();
|
||||
INLINE Vec3DataTransition(const LMatrix4f &matrix);
|
||||
INLINE Vec3DataTransition(const LPoint3f &value = LPoint3f(0.0, 0.0, 0.0));
|
||||
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
@ -52,9 +50,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
VectorDataTransition<LPoint3f, LMatrix4f>::init_type();
|
||||
VectorDataTransition<LPoint3f>::init_type();
|
||||
register_type(_type_handle, "Vec3DataTransition",
|
||||
VectorDataTransition<LPoint3f, LMatrix4f>::get_class_type());
|
||||
VectorDataTransition<LPoint3f>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
// Filename: vec4DataAttribute.I
|
||||
// Created by: jason (03Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec4DataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec4DataAttribute::
|
||||
Vec4DataAttribute() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec4DataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec4DataAttribute::
|
||||
Vec4DataAttribute(const LVecBase4f &value) :
|
||||
VectorDataAttribute<LPoint4f, LMatrix4f>(value)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// Filename: vec4DataAttribute.cxx
|
||||
// Created by: jason (04Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "vec4DataAttribute.h"
|
||||
#include "vec4DataTransition.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
TypeHandle Vec4DataAttribute::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec4DataAttribute::make_copy
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *Vec4DataAttribute::
|
||||
make_copy() const {
|
||||
return new Vec4DataAttribute(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec4DataAttribute::make_initial
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *Vec4DataAttribute::
|
||||
make_initial() const {
|
||||
return new Vec4DataAttribute;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
// Filename: vec4DataAttribute.h
|
||||
// Created by: jason (03Aug00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef VEC4DATAATTRIBUTE_H
|
||||
#define VEC4DATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include "vectorDataAttribute.h"
|
||||
|
||||
#include <luse.h>
|
||||
|
||||
// We need to define this temporary macro so we can pass a parameter
|
||||
// containing a comma through the macro.
|
||||
#define VECTORDATAATTRIBUTE_LPOINT4F VectorDataAttribute<LPoint4f, LMatrix4f>
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LPOINT4F);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : Vec4DataAttribute
|
||||
// Description : A VectorDataAttribute templated on LPoint4f.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA Vec4DataAttribute :
|
||||
public VectorDataAttribute<LPoint4f, LMatrix4f> {
|
||||
public:
|
||||
INLINE Vec4DataAttribute();
|
||||
INLINE Vec4DataAttribute(const LVecBase4f &value);
|
||||
|
||||
virtual NodeAttribute *make_copy() const;
|
||||
virtual NodeAttribute *make_initial() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
VectorDataAttribute<LPoint4f, LMatrix4f>::init_type();
|
||||
register_type(_type_handle, "Vec4DataAttribute",
|
||||
VectorDataAttribute<LPoint4f, LMatrix4f>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
#include "vec4DataAttribute.I"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -22,16 +22,7 @@
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec4DataTransition::
|
||||
Vec4DataTransition() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec4DataTransition::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE Vec4DataTransition::
|
||||
Vec4DataTransition(const LMatrix4f &matrix) :
|
||||
VectorDataTransition<LPoint4f, LMatrix4f>(matrix)
|
||||
Vec4DataTransition(const LPoint4f &value) :
|
||||
VectorDataTransition<LPoint4f>(value)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "vec4DataTransition.h"
|
||||
#include "vec4DataAttribute.h"
|
||||
|
||||
// Tell GCC that we'll take care of the instantiation explicitly here.
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -35,13 +34,3 @@ NodeTransition *Vec4DataTransition::
|
|||
make_copy() const {
|
||||
return new Vec4DataTransition(*this);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: Vec4DataTransition::make_attrib
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
NodeAttribute *Vec4DataTransition::
|
||||
make_attrib() const {
|
||||
return new Vec4DataAttribute;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// We need to define this temporary macro so we can pass a parameter
|
||||
// containing a comma through the macro.
|
||||
#define VECTORDATATRANSITION_LPOINT4F VectorDataTransition<LPoint4f, LMatrix4f>
|
||||
#define VECTORDATATRANSITION_LPOINT4F VectorDataTransition<LPoint4f>
|
||||
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LPOINT4F);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -35,13 +35,11 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATATRANSITION_LPOINT4F);
|
|||
// Description : A VectorDataTransition templated on LPoint4f.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA Vec4DataTransition :
|
||||
public VectorDataTransition<LPoint4f, LMatrix4f> {
|
||||
public VectorDataTransition<LPoint4f> {
|
||||
public:
|
||||
INLINE Vec4DataTransition();
|
||||
INLINE Vec4DataTransition(const LMatrix4f &matrix);
|
||||
INLINE Vec4DataTransition(const LPoint4f &value = LPoint4f(0.0, 0.0, 0.0, 0.0));
|
||||
|
||||
virtual NodeTransition *make_copy() const;
|
||||
virtual NodeAttribute *make_attrib() const;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
|
|
@ -52,9 +50,9 @@ public:
|
|||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
VectorDataTransition<LPoint4f, LMatrix4f>::init_type();
|
||||
VectorDataTransition<LPoint4f>::init_type();
|
||||
register_type(_type_handle, "Vec4DataTransition",
|
||||
VectorDataTransition<LPoint4f, LMatrix4f>::get_class_type());
|
||||
VectorDataTransition<LPoint4f>::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,141 +0,0 @@
|
|||
// Filename: vectorDataAttribute.I
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* okcircular */
|
||||
#include "vectorDataTransition.h"
|
||||
|
||||
template<class VecType, class MatType>
|
||||
TypeHandle VectorDataAttribute<VecType, MatType>::_type_handle;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
INLINE VectorDataAttribute<VecType, MatType>::
|
||||
VectorDataAttribute() {
|
||||
_value = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
INLINE VectorDataAttribute<VecType, MatType>::
|
||||
VectorDataAttribute(const VecType &value) :
|
||||
_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::Copy Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
INLINE VectorDataAttribute<VecType, MatType>::
|
||||
VectorDataAttribute(const VectorDataAttribute<VecType, MatType> ©) :
|
||||
NodeAttribute(copy),
|
||||
_value(copy._value)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::Copy Assignment Operator
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
INLINE void VectorDataAttribute<VecType, MatType>::
|
||||
operator = (const VectorDataAttribute<VecType, MatType> ©) {
|
||||
NodeAttribute::operator = (copy);
|
||||
_value = copy._value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::set_value
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
INLINE void VectorDataAttribute<VecType, MatType>::
|
||||
set_value(const VecType &value) {
|
||||
_value = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::get_value
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
INLINE const VecType &VectorDataAttribute<VecType, MatType>::
|
||||
get_value() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::get_handle
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
TypeHandle VectorDataAttribute<VecType, MatType>::
|
||||
get_handle() const {
|
||||
return VectorDataTransition<VecType, MatType>::get_class_type();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::output
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
void VectorDataAttribute<VecType, MatType>::
|
||||
output(ostream &out) const {
|
||||
out << _value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::write
|
||||
// Access: Public, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
void VectorDataAttribute<VecType, MatType>::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << _value << "\n";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: VectorDataAttribute::internal_compare_to
|
||||
// Access: Protected, Virtual
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
int VectorDataAttribute<VecType, MatType>::
|
||||
internal_compare_to(const NodeAttribute *other) const {
|
||||
const VectorDataAttribute<VecType, MatType> *ot;
|
||||
DCAST_INTO_R(ot, other, false);
|
||||
|
||||
return _value.compare_to(ot->_value);
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
// Filename: vectorDataAttribute.h
|
||||
// Created by: drose (27Mar00)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://www.panda3d.org/license.txt .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d@yahoogroups.com .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef VECTORDATAATTRIBUTE_H
|
||||
#define VECTORDATAATTRIBUTE_H
|
||||
|
||||
#include <pandabase.h>
|
||||
|
||||
#include <nodeAttribute.h>
|
||||
#include <indent.h>
|
||||
|
||||
template<class VecType, class MatType>
|
||||
class VectorDataTransition;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : VectorDataAttribute
|
||||
// Description :
|
||||
////////////////////////////////////////////////////////////////////
|
||||
template<class VecType, class MatType>
|
||||
class VectorDataAttribute : public NodeAttribute {
|
||||
public:
|
||||
INLINE VectorDataAttribute();
|
||||
INLINE VectorDataAttribute(const VecType &value);
|
||||
INLINE VectorDataAttribute(const VectorDataAttribute<VecType, MatType> ©);
|
||||
INLINE void operator = (const VectorDataAttribute<VecType, MatType> ©);
|
||||
|
||||
public:
|
||||
INLINE void set_value(const VecType &value);
|
||||
INLINE const VecType &get_value() const;
|
||||
|
||||
virtual TypeHandle get_handle() const;
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
protected:
|
||||
virtual int internal_compare_to(const NodeAttribute *other) const;
|
||||
|
||||
private:
|
||||
VecType _value;
|
||||
|
||||
public:
|
||||
virtual TypeHandle get_type() const {
|
||||
return get_class_type();
|
||||
}
|
||||
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
}
|
||||
static void init_type() {
|
||||
NodeAttribute::init_type();
|
||||
register_type(_type_handle,
|
||||
string("VectorDataAttribute<") +
|
||||
get_type_handle(VecType).get_name() + "," +
|
||||
get_type_handle(MatType).get_name() + ">",
|
||||
NodeAttribute::get_class_type());
|
||||
}
|
||||
|
||||
private:
|
||||
static TypeHandle _type_handle;
|
||||
friend class VectorDataTransition<VecType, MatType>;
|
||||
};
|
||||
|
||||
#include "vectorDataAttribute.I"
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue