diff --git a/panda/src/builder/test_builder.cxx b/panda/src/builder/test_builder.cxx index 72431e34a4..3a62313831 100644 --- a/panda/src/builder/test_builder.cxx +++ b/panda/src/builder/test_builder.cxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -48,11 +47,11 @@ extern int num_polys; class ReportGeoms : public TraverserVisitor { 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 diff --git a/panda/src/chat/chatInput.cxx b/panda/src/chat/chatInput.cxx index 09b2be463f..6c1fb3e794 100644 --- a/panda/src/chat/chatInput.cxx +++ b/panda/src/chat/chatInput.cxx @@ -17,11 +17,11 @@ //////////////////////////////////////////////////////////////////// #include "chatInput.h" -#include -#include -#include -#include -#include + +#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); diff --git a/panda/src/chat/chatInput.h b/panda/src/chat/chatInput.h index 03a0862687..00f3600355 100644 --- a/panda/src/chat/chatInput.h +++ b/panda/src/chat/chatInput.h @@ -15,22 +15,16 @@ // panda3d@yahoogroups.com . // //////////////////////////////////////////////////////////////////// + #ifndef CHATINPUT_H #define CHATINPUT_H -// -//////////////////////////////////////////////////////////////////// -// Includes -//////////////////////////////////////////////////////////////////// -#include -#include -#include -#include -#include +#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; diff --git a/panda/src/cull/Sources.pp b/panda/src/cull/Sources.pp index a7f1165aa9..0a42f64d23 100644 --- a/panda/src/cull/Sources.pp +++ b/panda/src/cull/Sources.pp @@ -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 \ diff --git a/panda/src/cull/config_cull.cxx b/panda/src/cull/config_cull.cxx index 8485da7dcf..ce0cfcd6ce 100644 --- a/panda/src/cull/config_cull.cxx +++ b/panda/src/cull/config_cull.cxx @@ -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(); diff --git a/panda/src/cull/cullState.cxx b/panda/src/cull/cullState.cxx index aaf49895b9..cda91901d4 100644 --- a/panda/src/cull/cullState.cxx +++ b/panda/src/cull/cullState.cxx @@ -23,8 +23,6 @@ #include #include -#include - //////////////////////////////////////////////////////////////////// // Function: CullState::check_currency // Access: Public diff --git a/panda/src/cull/cullTraverser.cxx b/panda/src/cull/cullTraverser.cxx index dcde3077e3..49c600c899 100644 --- a/panda/src/cull/cullTraverser.cxx +++ b/panda/src/cull/cullTraverser.cxx @@ -19,7 +19,6 @@ #include "cullTraverser.h" #include "geomBinTransition.h" -#include "geomBinAttribute.h" #include "cullStateSubtree.h" #include "geomBinNormal.h" #include "geomBinFixed.h" diff --git a/panda/src/cull/cull_composite2.cxx b/panda/src/cull/cull_composite2.cxx index f83a4073db..510620bd53 100644 --- a/panda/src/cull/cull_composite2.cxx +++ b/panda/src/cull/cull_composite2.cxx @@ -1,6 +1,5 @@ #include "geomBin.cxx" -#include "geomBinAttribute.cxx" #include "geomBinBackToFront.cxx" #include "geomBinFixed.cxx" #include "geomBinGroup.cxx" diff --git a/panda/src/cull/cull_headers.h b/panda/src/cull/cull_headers.h deleted file mode 100644 index cf7835a3a4..0000000000 --- a/panda/src/cull/cull_headers.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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 - diff --git a/panda/src/cull/directRenderTransition.h b/panda/src/cull/directRenderTransition.h index dfef265aff..bef7e8c78a 100644 --- a/panda/src/cull/directRenderTransition.h +++ b/panda/src/cull/directRenderTransition.h @@ -67,7 +67,6 @@ public: private: static TypeHandle _type_handle; - friend class DirectRenderAttribute; }; #include "directRenderTransition.I" diff --git a/panda/src/cull/geomBin.cxx b/panda/src/cull/geomBin.cxx index f9bdbff36b..c2e9f80f2e 100644 --- a/panda/src/cull/geomBin.cxx +++ b/panda/src/cull/geomBin.cxx @@ -26,7 +26,6 @@ #include "geomBinBackToFront.h" #include -#include #include #include diff --git a/panda/src/cull/geomBinAttribute.I b/panda/src/cull/geomBinAttribute.I deleted file mode 100644 index d3b94bdf59..0000000000 --- a/panda/src/cull/geomBinAttribute.I +++ /dev/null @@ -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; -} - diff --git a/panda/src/cull/geomBinAttribute.N b/panda/src/cull/geomBinAttribute.N deleted file mode 100644 index 4efaa99498..0000000000 --- a/panda/src/cull/geomBinAttribute.N +++ /dev/null @@ -1 +0,0 @@ -ignoremember get_handle diff --git a/panda/src/cull/geomBinAttribute.cxx b/panda/src/cull/geomBinAttribute.cxx deleted file mode 100644 index 11129a2ebe..0000000000 --- a/panda/src/cull/geomBinAttribute.cxx +++ /dev/null @@ -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 -#include - -#include - -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"; -} diff --git a/panda/src/cull/geomBinAttribute.h b/panda/src/cull/geomBinAttribute.h deleted file mode 100644 index 307e587d12..0000000000 --- a/panda/src/cull/geomBinAttribute.h +++ /dev/null @@ -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 - -#include "geomBin.h" - -#include - -//////////////////////////////////////////////////////////////////// -// 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 diff --git a/panda/src/cull/geomBinGroup.cxx b/panda/src/cull/geomBinGroup.cxx index 7fa699582f..079497a758 100644 --- a/panda/src/cull/geomBinGroup.cxx +++ b/panda/src/cull/geomBinGroup.cxx @@ -20,7 +20,6 @@ #include "geomBinGroup.h" #include "cullTraverser.h" #include -#include #include TypeHandle GeomBinGroup::_type_handle; diff --git a/panda/src/cull/geomBinTransition.cxx b/panda/src/cull/geomBinTransition.cxx index 8ae9d1f6a1..1a3784d270 100644 --- a/panda/src/cull/geomBinTransition.cxx +++ b/panda/src/cull/geomBinTransition.cxx @@ -18,7 +18,6 @@ #include "geomBinTransition.h" -#include "geomBinAttribute.h" #include #include @@ -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 diff --git a/panda/src/cull/geomBinTransition.h b/panda/src/cull/geomBinTransition.h index 10fcd9b111..c51c21ffef 100644 --- a/panda/src/cull/geomBinTransition.h +++ b/panda/src/cull/geomBinTransition.h @@ -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" diff --git a/panda/src/cull/geomBinUnsorted.cxx b/panda/src/cull/geomBinUnsorted.cxx index fc0b1a8b8e..2c9a4ed63c 100644 --- a/panda/src/cull/geomBinUnsorted.cxx +++ b/panda/src/cull/geomBinUnsorted.cxx @@ -19,7 +19,6 @@ #include "geomBinUnsorted.h" #include "cullTraverser.h" #include -#include #include #include diff --git a/panda/src/cull/test_cull.cxx b/panda/src/cull/test_cull.cxx index 7e78b4d1d6..75d0e02c82 100644 --- a/panda/src/cull/test_cull.cxx +++ b/panda/src/cull/test_cull.cxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -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); diff --git a/panda/src/device/analogNode.cxx b/panda/src/device/analogNode.cxx index 2e28783cf7..3176000458 100644 --- a/panda/src/device/analogNode.cxx +++ b/panda/src/device/analogNode.cxx @@ -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(); diff --git a/panda/src/device/analogNode.h b/panda/src/device/analogNode.h index e8a1759739..ba068c415e 100644 --- a/panda/src/device/analogNode.h +++ b/panda/src/device/analogNode.h @@ -25,9 +25,9 @@ #include "clientAnalogDevice.h" #include -#include +#include +#include #include -#include //////////////////////////////////////////////////////////////////// @@ -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; diff --git a/panda/src/device/buttonNode.cxx b/panda/src/device/buttonNode.cxx index 419b340eae..4b49f4ce40 100644 --- a/panda/src/device/buttonNode.cxx +++ b/panda/src/device/buttonNode.cxx @@ -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); } } diff --git a/panda/src/device/buttonNode.h b/panda/src/device/buttonNode.h index 29c375ba89..f4bba7181d 100644 --- a/panda/src/device/buttonNode.h +++ b/panda/src/device/buttonNode.h @@ -25,7 +25,7 @@ #include "clientButtonDevice.h" #include -#include +#include //////////////////////////////////////////////////////////////////// @@ -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; diff --git a/panda/src/device/clientButtonDevice.I b/panda/src/device/clientButtonDevice.I index bc432655a6..6f88f84d45 100644 --- a/panda/src/device/clientButtonDevice.I +++ b/panda/src/device/clientButtonDevice.I @@ -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; } diff --git a/panda/src/device/clientButtonDevice.cxx b/panda/src/device/clientButtonDevice.cxx index 3d324aa609..5f1a0ecfe6 100644 --- a/panda/src/device/clientButtonDevice.cxx +++ b/panda/src/device/clientButtonDevice.cxx @@ -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(); } diff --git a/panda/src/device/clientButtonDevice.h b/panda/src/device/clientButtonDevice.h index b8d81b2e46..519620696c 100644 --- a/panda/src/device/clientButtonDevice.h +++ b/panda/src/device/clientButtonDevice.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include //////////////////////////////////////////////////////////////////// @@ -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 Buttons; Buttons _buttons; - PT(ButtonEventDataAttribute) _button_events; + PT(ButtonEventDataTransition) _button_events; public: static TypeHandle get_class_type() { diff --git a/panda/src/device/dialNode.cxx b/panda/src/device/dialNode.cxx index 7974641886..8b1eb7b5d0 100644 --- a/panda/src/device/dialNode.cxx +++ b/panda/src/device/dialNode.cxx @@ -72,7 +72,7 @@ DialNode:: // Description: //////////////////////////////////////////////////////////////////// void DialNode:: -transmit_data(NodeAttributes &data) { +transmit_data(AllTransitionsWrapper &data) { if (is_valid()) { _dial->poll(); diff --git a/panda/src/device/dialNode.h b/panda/src/device/dialNode.h index 3b10df4796..217ea17df2 100644 --- a/panda/src/device/dialNode.h +++ b/panda/src/device/dialNode.h @@ -25,7 +25,7 @@ #include "clientDialDevice.h" #include -#include +#include //////////////////////////////////////////////////////////////////// @@ -59,9 +59,9 @@ PUBLISHED: //////////////////////////////////////////////////////////////////// public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); - NodeAttributes _attrib; + AllTransitionsWrapper _attrib; private: PT(ClientDialDevice) _dial; diff --git a/panda/src/device/mouse.cxx b/panda/src/device/mouse.cxx index ba3fce6163..489eb4ed0d 100644 --- a/panda/src/device/mouse.cxx +++ b/panda/src/device/mouse.cxx @@ -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)) { diff --git a/panda/src/device/mouse.h b/panda/src/device/mouse.h index b19268d9ad..3c2af495fe 100644 --- a/panda/src/device/mouse.h +++ b/panda/src/device/mouse.h @@ -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; diff --git a/panda/src/device/trackerNode.cxx b/panda/src/device/trackerNode.cxx index 9e1dc27252..501f472964 100644 --- a/panda/src/device/trackerNode.cxx +++ b/panda/src/device/trackerNode.cxx @@ -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); } } diff --git a/panda/src/device/trackerNode.h b/panda/src/device/trackerNode.h index fde5efcdfb..9998873de7 100644 --- a/panda/src/device/trackerNode.h +++ b/panda/src/device/trackerNode.h @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -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; diff --git a/panda/src/dgraph/Sources.pp b/panda/src/dgraph/Sources.pp index a0e076379c..e43a2151ee 100644 --- a/panda/src/dgraph/Sources.pp +++ b/panda/src/dgraph/Sources.pp @@ -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 \ diff --git a/panda/src/dgraph/buttonEventDataAttribute.I b/panda/src/dgraph/buttonEventDataAttribute.I deleted file mode 100644 index 213904a4db..0000000000 --- a/panda/src/dgraph/buttonEventDataAttribute.I +++ /dev/null @@ -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); -} diff --git a/panda/src/dgraph/buttonEventDataAttribute.cxx b/panda/src/dgraph/buttonEventDataAttribute.cxx deleted file mode 100644 index 2052b12a39..0000000000 --- a/panda/src/dgraph/buttonEventDataAttribute.cxx +++ /dev/null @@ -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 - -#include -#include - -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 -} diff --git a/panda/src/dgraph/buttonEventDataAttribute.h b/panda/src/dgraph/buttonEventDataAttribute.h deleted file mode 100644 index c4588005a6..0000000000 --- a/panda/src/dgraph/buttonEventDataAttribute.h +++ /dev/null @@ -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 - -#include -#include - -#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 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 diff --git a/panda/src/dgraph/buttonEventDataTransition.I b/panda/src/dgraph/buttonEventDataTransition.I index d90798f2b8..43a2f651cf 100644 --- a/panda/src/dgraph/buttonEventDataTransition.I +++ b/panda/src/dgraph/buttonEventDataTransition.I @@ -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); } diff --git a/panda/src/dgraph/buttonEventDataTransition.cxx b/panda/src/dgraph/buttonEventDataTransition.cxx index 96b056af6a..3b41d27a56 100644 --- a/panda/src/dgraph/buttonEventDataTransition.cxx +++ b/panda/src/dgraph/buttonEventDataTransition.cxx @@ -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 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 } diff --git a/panda/src/dgraph/buttonEventDataTransition.h b/panda/src/dgraph/buttonEventDataTransition.h index 0d99feacc4..3596ed1441 100644 --- a/panda/src/dgraph/buttonEventDataTransition.h +++ b/panda/src/dgraph/buttonEventDataTransition.h @@ -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 +#include "pandabase.h" -#include +#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 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(); diff --git a/panda/src/dgraph/config_dgraph.cxx b/panda/src/dgraph/config_dgraph.cxx index 1aa367fdf8..3602ccb003 100644 --- a/panda/src/dgraph/config_dgraph.cxx +++ b/panda/src/dgraph/config_dgraph.cxx @@ -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 @@ -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(); } diff --git a/panda/src/dgraph/dataGraphTraversal.cxx b/panda/src/dgraph/dataGraphTraversal.cxx index 831b40b6cd..22e81b7976 100644 --- a/panda/src/dgraph/dataGraphTraversal.cxx +++ b/panda/src/dgraph/dataGraphTraversal.cxx @@ -20,8 +20,8 @@ #include "dataGraphTraversal.h" #include "dataGraphTraverser.h" -#include -#include +#include "pStatTimer.h" +#include "pStatCollector.h" #ifndef CPPPARSER PStatCollector _dgraph_pcollector("App:Data graph"); diff --git a/panda/src/dgraph/dataGraphTraversal.h b/panda/src/dgraph/dataGraphTraversal.h index b81b070a47..7a8cc995b9 100644 --- a/panda/src/dgraph/dataGraphTraversal.h +++ b/panda/src/dgraph/dataGraphTraversal.h @@ -33,7 +33,7 @@ // //////////////////////////////////////////////////////////////////// -#include +#include "pandabase.h" class Node; diff --git a/panda/src/dgraph/dataGraphTraverser.I b/panda/src/dgraph/dataGraphTraverser.I index 262154ad39..89ae2d7e2d 100644 --- a/panda/src/dgraph/dataGraphTraverser.I +++ b/panda/src/dgraph/dataGraphTraverser.I @@ -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(); } diff --git a/panda/src/dgraph/dataGraphTraverser.cxx b/panda/src/dgraph/dataGraphTraverser.cxx index 5d72118182..1810f0d4b1 100644 --- a/panda/src/dgraph/dataGraphTraverser.cxx +++ b/panda/src/dgraph/dataGraphTraverser.cxx @@ -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++; diff --git a/panda/src/dgraph/dataGraphTraverser.h b/panda/src/dgraph/dataGraphTraverser.h index 5b9cdc8f6f..746c623d00 100644 --- a/panda/src/dgraph/dataGraphTraverser.h +++ b/panda/src/dgraph/dataGraphTraverser.h @@ -19,16 +19,16 @@ #ifndef DATAGRAPHTRAVERSER_H #define DATAGRAPHTRAVERSER_H -#include +#include "pandabase.h" -#include +#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(); diff --git a/panda/src/dgraph/dataNode.cxx b/panda/src/dgraph/dataNode.cxx index 5e804dc074..dc7555bddf 100644 --- a/panda/src/dgraph/dataNode.cxx +++ b/panda/src/dgraph/dataNode.cxx @@ -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) { } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/dgraph/dataNode.h b/panda/src/dgraph/dataNode.h index 18af7ba975..6a33ebd972 100644 --- a/panda/src/dgraph/dataNode.h +++ b/panda/src/dgraph/dataNode.h @@ -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 -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); diff --git a/panda/src/dgraph/describe_data_verbose.cxx b/panda/src/dgraph/describe_data_verbose.cxx index aed183f1c8..972def94eb 100644 --- a/panda/src/dgraph/describe_data_verbose.cxx +++ b/panda/src/dgraph/describe_data_verbose.cxx @@ -20,9 +20,8 @@ #include "dataGraphTraversal.h" #include "describe_data_verbose.h" -#include - -#include +#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(); diff --git a/panda/src/dgraph/describe_data_verbose.h b/panda/src/dgraph/describe_data_verbose.h index 958e892c00..26df64e8d4 100644 --- a/panda/src/dgraph/describe_data_verbose.h +++ b/panda/src/dgraph/describe_data_verbose.h @@ -19,9 +19,9 @@ #ifndef DESCRIBE_DATA_VERBOSE_H #define DESCRIBE_DATA_VERBOSE_H -#include +#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 diff --git a/panda/src/dgraph/dgraph_composite1.cxx b/panda/src/dgraph/dgraph_composite1.cxx index e010f5c642..8c0cc4cb87 100644 --- a/panda/src/dgraph/dgraph_composite1.cxx +++ b/panda/src/dgraph/dgraph_composite1.cxx @@ -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" diff --git a/panda/src/dgraph/dgraph_composite2.cxx b/panda/src/dgraph/dgraph_composite2.cxx index be92a5389b..0c75ba6520 100644 --- a/panda/src/dgraph/dgraph_composite2.cxx +++ b/panda/src/dgraph/dgraph_composite2.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" diff --git a/panda/src/dgraph/dgraph_headers.h b/panda/src/dgraph/dgraph_headers.h deleted file mode 100644 index ed465171ef..0000000000 --- a/panda/src/dgraph/dgraph_headers.h +++ /dev/null @@ -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 - -#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 - diff --git a/panda/src/dgraph/doubleDataAttribute.I b/panda/src/dgraph/doubleDataAttribute.I deleted file mode 100644 index ce3877f08d..0000000000 --- a/panda/src/dgraph/doubleDataAttribute.I +++ /dev/null @@ -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(value) { -} - diff --git a/panda/src/dgraph/doubleDataAttribute.cxx b/panda/src/dgraph/doubleDataAttribute.cxx deleted file mode 100644 index c37eb5b673..0000000000 --- a/panda/src/dgraph/doubleDataAttribute.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/doubleDataAttribute.h b/panda/src/dgraph/doubleDataAttribute.h deleted file mode 100644 index 070e920c16..0000000000 --- a/panda/src/dgraph/doubleDataAttribute.h +++ /dev/null @@ -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 - -#include "numericDataAttribute.h" - -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataAttribute); - -//////////////////////////////////////////////////////////////////// -// Class : DoubleDataAttribute -// Description : A NumericDataAttribute templated on double types. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA DoubleDataAttribute : - public NumericDataAttribute { -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::init_type(); - register_type(_type_handle, "DoubleDataAttribute", - NumericDataAttribute::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 diff --git a/panda/src/dgraph/doubleDataTransition.I b/panda/src/dgraph/doubleDataTransition.I index 7b8350abfb..ae3f456e07 100644 --- a/panda/src/dgraph/doubleDataTransition.I +++ b/panda/src/dgraph/doubleDataTransition.I @@ -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(scale, offset) +DoubleDataTransition(double value) : + NumericDataTransition(value) { } diff --git a/panda/src/dgraph/doubleDataTransition.cxx b/panda/src/dgraph/doubleDataTransition.cxx index 2e95f7efeb..7a66a1670a 100644 --- a/panda/src/dgraph/doubleDataTransition.cxx +++ b/panda/src/dgraph/doubleDataTransition.cxx @@ -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; -} diff --git a/panda/src/dgraph/doubleDataTransition.h b/panda/src/dgraph/doubleDataTransition.h index 75a2dd909b..c1113a9075 100644 --- a/panda/src/dgraph/doubleDataTransition.h +++ b/panda/src/dgraph/doubleDataTransition.h @@ -32,11 +32,9 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataTransition); class EXPCL_PANDA DoubleDataTransition : public NumericDataTransition { 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 { diff --git a/panda/src/dgraph/doublePtrDataAttribute.I b/panda/src/dgraph/doublePtrDataAttribute.I deleted file mode 100644 index 60c1125756..0000000000 --- a/panda/src/dgraph/doublePtrDataAttribute.I +++ /dev/null @@ -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(ptr) { -} diff --git a/panda/src/dgraph/doublePtrDataAttribute.cxx b/panda/src/dgraph/doublePtrDataAttribute.cxx deleted file mode 100644 index 0ec157faa4..0000000000 --- a/panda/src/dgraph/doublePtrDataAttribute.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/doublePtrDataAttribute.h b/panda/src/dgraph/doublePtrDataAttribute.h deleted file mode 100644 index 73e850b498..0000000000 --- a/panda/src/dgraph/doublePtrDataAttribute.h +++ /dev/null @@ -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 - -#include "pointerDataAttribute.h" - -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerDataAttribute); - -//////////////////////////////////////////////////////////////////// -// Class : DoublePtrDataAttribute -// Description : A PointerDataAttribute templated on double types. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA DoublePtrDataAttribute : - public PointerDataAttribute { -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::init_type(); - register_type(_type_handle, "DoublePtrDataAttribute", - PointerDataAttribute::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 diff --git a/panda/src/dgraph/doublePtrDataTransition.I b/panda/src/dgraph/doublePtrDataTransition.I deleted file mode 100644 index 25bae3c09f..0000000000 --- a/panda/src/dgraph/doublePtrDataTransition.I +++ /dev/null @@ -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(ptr) -{ -} diff --git a/panda/src/dgraph/doublePtrDataTransition.cxx b/panda/src/dgraph/doublePtrDataTransition.cxx deleted file mode 100644 index bddff08d50..0000000000 --- a/panda/src/dgraph/doublePtrDataTransition.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/doublePtrDataTransition.h b/panda/src/dgraph/doublePtrDataTransition.h deleted file mode 100644 index e7bf6fafc9..0000000000 --- a/panda/src/dgraph/doublePtrDataTransition.h +++ /dev/null @@ -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 - -#include "pointerDataTransition.h" - -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerDataTransition); - -//////////////////////////////////////////////////////////////////// -// Class : DoublePtrDataTransition -// Description : A PointerDataTransition templated on double types. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA DoublePtrDataTransition : - public PointerDataTransition { -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::init_type(); - register_type(_type_handle, "DoublePtrDataTransition", - PointerDataTransition::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 diff --git a/panda/src/dgraph/intDataAttribute.I b/panda/src/dgraph/intDataAttribute.I deleted file mode 100644 index 9aa34d4103..0000000000 --- a/panda/src/dgraph/intDataAttribute.I +++ /dev/null @@ -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(value) { -} - diff --git a/panda/src/dgraph/intDataAttribute.cxx b/panda/src/dgraph/intDataAttribute.cxx deleted file mode 100644 index faa7443503..0000000000 --- a/panda/src/dgraph/intDataAttribute.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/intDataAttribute.h b/panda/src/dgraph/intDataAttribute.h deleted file mode 100644 index 7bfb27c0f7..0000000000 --- a/panda/src/dgraph/intDataAttribute.h +++ /dev/null @@ -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 - -#include "numericDataAttribute.h" - -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataAttribute); - -//////////////////////////////////////////////////////////////////// -// Class : IntDataAttribute -// Description : A NumericDataAttribute templated on integer types. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA IntDataAttribute : - public NumericDataAttribute { -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::init_type(); - register_type(_type_handle, "IntDataAttribute", - NumericDataAttribute::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 diff --git a/panda/src/dgraph/intDataTransition.I b/panda/src/dgraph/intDataTransition.I index ad16d8b0ac..38f356f011 100644 --- a/panda/src/dgraph/intDataTransition.I +++ b/panda/src/dgraph/intDataTransition.I @@ -22,17 +22,8 @@ // Description: //////////////////////////////////////////////////////////////////// INLINE IntDataTransition:: -IntDataTransition() { -} - -//////////////////////////////////////////////////////////////////// -// Function: IntDataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE IntDataTransition:: -IntDataTransition(int scale, int offset) : - NumericDataTransition(scale, offset) +IntDataTransition(int value) : + NumericDataTransition(value) { } diff --git a/panda/src/dgraph/intDataTransition.cxx b/panda/src/dgraph/intDataTransition.cxx index f0bcbc3e55..3722b3b70b 100644 --- a/panda/src/dgraph/intDataTransition.cxx +++ b/panda/src/dgraph/intDataTransition.cxx @@ -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; -} diff --git a/panda/src/dgraph/intDataTransition.h b/panda/src/dgraph/intDataTransition.h index d29d64e45c..e1335bccd9 100644 --- a/panda/src/dgraph/intDataTransition.h +++ b/panda/src/dgraph/intDataTransition.h @@ -32,11 +32,9 @@ EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, NumericDataTransition); class EXPCL_PANDA IntDataTransition : public NumericDataTransition { 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 { diff --git a/panda/src/dgraph/matrixDataAttribute.I b/panda/src/dgraph/matrixDataAttribute.I deleted file mode 100644 index 094ad86bba..0000000000 --- a/panda/src/dgraph/matrixDataAttribute.I +++ /dev/null @@ -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(value) -{ -} diff --git a/panda/src/dgraph/matrixDataAttribute.cxx b/panda/src/dgraph/matrixDataAttribute.cxx deleted file mode 100644 index 3404ac02a9..0000000000 --- a/panda/src/dgraph/matrixDataAttribute.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/matrixDataAttribute.h b/panda/src/dgraph/matrixDataAttribute.h deleted file mode 100644 index 2dc07dd6bb..0000000000 --- a/panda/src/dgraph/matrixDataAttribute.h +++ /dev/null @@ -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 - -#include "vectorDataAttribute.h" - -#include - -// We need to define this temporary macro so we can pass a parameter -// containing a comma through the macro. -#define VECTORDATAATTRIBUTE_LMATRIX4F VectorDataAttribute -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LMATRIX4F); - -//////////////////////////////////////////////////////////////////// -// Class : MatrixDataAttribute -// Description : A VectorDataAttribute templated on LMatrix4f. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA MatrixDataAttribute : - public VectorDataAttribute { -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::init_type(); - register_type(_type_handle, "MatrixDataAttribute", - VectorDataAttribute::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 diff --git a/panda/src/dgraph/matrixDataTransition.I b/panda/src/dgraph/matrixDataTransition.I index 1feb118f3d..bd7c1b9f6b 100644 --- a/panda/src/dgraph/matrixDataTransition.I +++ b/panda/src/dgraph/matrixDataTransition.I @@ -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(matrix) +MatrixDataTransition(const LMatrix4f &value) : + VectorDataTransition(value) { } diff --git a/panda/src/dgraph/matrixDataTransition.cxx b/panda/src/dgraph/matrixDataTransition.cxx index 345d73f003..fcbee940a2 100644 --- a/panda/src/dgraph/matrixDataTransition.cxx +++ b/panda/src/dgraph/matrixDataTransition.cxx @@ -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; -} diff --git a/panda/src/dgraph/matrixDataTransition.h b/panda/src/dgraph/matrixDataTransition.h index 431359fd99..10f4ca9ea9 100644 --- a/panda/src/dgraph/matrixDataTransition.h +++ b/panda/src/dgraph/matrixDataTransition.h @@ -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 +#define VECTORDATATRANSITION_LMATRIX4F VectorDataTransition 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 { + public VectorDataTransition { 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::init_type(); + VectorDataTransition::init_type(); register_type(_type_handle, "MatrixDataTransition", - VectorDataTransition::get_class_type()); + VectorDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/numericDataAttribute.I b/panda/src/dgraph/numericDataAttribute.I deleted file mode 100644 index e194e72056..0000000000 --- a/panda/src/dgraph/numericDataAttribute.I +++ /dev/null @@ -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 -TypeHandle NumericDataAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NumericDataAttribute:: -NumericDataAttribute() { - _value = 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NumericDataAttribute:: -NumericDataAttribute(NumType value) : - _value(value) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NumericDataAttribute:: -NumericDataAttribute(const NumericDataAttribute ©) : - NodeAttribute(copy), - _value(copy._value) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void NumericDataAttribute:: -operator = (const NumericDataAttribute ©) { - NodeAttribute::operator = (copy); - _value = copy._value; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::set_value -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void NumericDataAttribute:: -set_value(NumType value) { - _value = value; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::get_value -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NumType NumericDataAttribute:: -get_value() const { - return _value; -} - - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::get_handle -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -TypeHandle NumericDataAttribute:: -get_handle() const { - return NumericDataTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void NumericDataAttribute:: -output(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void NumericDataAttribute:: -write(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int NumericDataAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const NumericDataAttribute *ot; - DCAST_INTO_R(ot, other, false); - - if (_value != ot->_value) { - return (_value < ot->_value) ? -1 : 1; - } - return 0; -} diff --git a/panda/src/dgraph/numericDataAttribute.h b/panda/src/dgraph/numericDataAttribute.h deleted file mode 100644 index 3aa2d14251..0000000000 --- a/panda/src/dgraph/numericDataAttribute.h +++ /dev/null @@ -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 - -#include -#include - -template -class NumericDataTransition; - -//////////////////////////////////////////////////////////////////// -// Class : NumericDataAttribute -// Description : -//////////////////////////////////////////////////////////////////// -template -class NumericDataAttribute : public NodeAttribute { -public: - INLINE NumericDataAttribute(); - INLINE NumericDataAttribute(NumType value); - INLINE NumericDataAttribute(const NumericDataAttribute ©); - INLINE void operator = (const NumericDataAttribute ©); - -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; -}; - -#include "numericDataAttribute.I" - -#endif diff --git a/panda/src/dgraph/numericDataTransition.I b/panda/src/dgraph/numericDataTransition.I index 785abcc961..b1ee587296 100644 --- a/panda/src/dgraph/numericDataTransition.I +++ b/panda/src/dgraph/numericDataTransition.I @@ -16,9 +16,6 @@ // //////////////////////////////////////////////////////////////////// -/* okcircular */ -#include "numericDataAttribute.h" - template TypeHandle NumericDataTransition::_type_handle; @@ -29,22 +26,8 @@ TypeHandle NumericDataTransition::_type_handle; //////////////////////////////////////////////////////////////////// template INLINE NumericDataTransition:: -NumericDataTransition() : - _scale(1), - _offset(0) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE NumericDataTransition:: -NumericDataTransition(NumType scale, NumType offset) : - _scale(scale), - _offset(offset) +NumericDataTransition(NumType value) : + _value(value) { } @@ -56,9 +39,8 @@ NumericDataTransition(NumType scale, NumType offset) : template INLINE NumericDataTransition:: NumericDataTransition(const NumericDataTransition ©) : - NodeTransition(copy), - _scale(copy._scale), - _offset(copy._offset) + OnTransition(copy), + _value(copy._value) { } @@ -70,195 +52,85 @@ NumericDataTransition(const NumericDataTransition ©) : template INLINE void NumericDataTransition:: operator = (const NumericDataTransition ©) { - 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 -INLINE bool NumericDataTransition:: -is_identity() const { - return (_scale == 1.0 && _offset == 0.0); -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataTransition::set_scale +// Function: NumericDataTransition::set_value // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// template -void NumericDataTransition:: -set_scale(NumType scale) { - _scale = scale; +INLINE void NumericDataTransition:: +set_value(NumType value) { + _value = value; state_changed(); } //////////////////////////////////////////////////////////////////// -// Function: NumericDataTransition::get_scale +// Function: NumericDataTransition::get_value // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// template -NumType NumericDataTransition:: -get_scale() const { - return _scale; +INLINE NumType NumericDataTransition:: +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 void NumericDataTransition:: -set_offset(NumType offset) { - _offset = offset; - state_changed(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataTransition::get_offset -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -NumType NumericDataTransition:: -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 -NodeTransition *NumericDataTransition:: -compose(const NodeTransition *other) const { +set_value_from(const OnTransition *other) { const NumericDataTransition *ot; - DCAST_INTO_R(ot, other, NULL); - - if (is_identity()) { - return (NumericDataTransition *)ot; - - } else if (ot->is_identity()) { - return (NumericDataTransition *)this; - - } else { - NodeTransition *c = make_copy(); - NumericDataTransition *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 -NodeTransition *NumericDataTransition:: -invert() const { - if (is_identity()) { - return (NumericDataTransition *)this; - - } else if (_scale == 0) { - // Singular; cannot invert. - return NULL; - - } else { - NodeTransition *c = make_copy(); - NumericDataTransition *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 -NodeAttribute *NumericDataTransition:: -apply(const NodeAttribute *attrib) const { - const NumericDataAttribute *at; - DCAST_INTO_R(at, attrib, NULL); - - if (is_identity()) { - return (NumericDataAttribute *)attrib; - } - - NodeAttribute *c = make_attrib(); - NumericDataAttribute *result; - DCAST_INTO_R(result, c, NULL); - - result->_value = at->_value * _scale + _offset; - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataTransition::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void NumericDataTransition:: -output(ostream &out) const { - out << _scale << "x + " << _offset; -} - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataTransition::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void NumericDataTransition:: -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 int NumericDataTransition:: -internal_compare_to(const NodeTransition *other) const { +compare_values(const OnTransition *other) const { const NumericDataTransition *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 +void NumericDataTransition:: +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 +void NumericDataTransition:: +write_value(ostream &out, int indent_level) const { + indent(out, indent_level) << _value << "\n"; } diff --git a/panda/src/dgraph/numericDataTransition.h b/panda/src/dgraph/numericDataTransition.h index 91f24f847f..2b250d1eff 100644 --- a/panda/src/dgraph/numericDataTransition.h +++ b/panda/src/dgraph/numericDataTransition.h @@ -19,50 +19,36 @@ #ifndef NUMERICDATATRANSITION_H #define NUMERICDATATRANSITION_H -#include +#include "pandabase.h" -#include -#include +#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 NumericDataTransition : public NodeTransition { +class NumericDataTransition : public OnTransition { public: - INLINE NumericDataTransition(); - INLINE NumericDataTransition(NumType scale, NumType offset); + INLINE NumericDataTransition(NumType value); INLINE NumericDataTransition(const NumericDataTransition ©); INLINE void operator = (const NumericDataTransition ©); 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: diff --git a/panda/src/dgraph/pointerDataAttribute.I b/panda/src/dgraph/pointerDataAttribute.I deleted file mode 100644 index da1dea4187..0000000000 --- a/panda/src/dgraph/pointerDataAttribute.I +++ /dev/null @@ -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 -TypeHandle PointerDataAttribute::_type_handle; - -template -PtrType* PointerDataAttribute::_null_ptr = (PtrType*)NULL; - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerDataAttribute:: -PointerDataAttribute() : - _ptr(_null_ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerDataAttribute:: -PointerDataAttribute(PtrType* ptr) : - _ptr(ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerDataAttribute:: -PointerDataAttribute(const PointerDataAttribute ©) : - NodeAttribute(copy), _ptr(copy._ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void PointerDataAttribute:: -operator = (const PointerDataAttribute ©) { - NodeAttribute::operator = (copy); - _ptr = copy._ptr; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::set_value -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void PointerDataAttribute:: -set_value(PtrType* ptr) { - _ptr = ptr; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::get_value -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -PtrType* PointerDataAttribute:: -get_value() const { - return _ptr; -} - - -//////////////////////////////////////////////////////////////////// -// Function: NumericDataAttribute::get_handle -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -TypeHandle PointerDataAttribute:: -get_handle() const { - return PointerDataTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void PointerDataAttribute:: -output(ostream &out) const { - out << (void*)_ptr << endl; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void PointerDataAttribute:: -write(ostream &out, int indent_level) const { - indent(out, indent_level) << (void*)_ptr << endl; -} - -/////////////////////////////////////////////////////////////////// -// Function: PointerDataAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int PointerDataAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const PointerDataAttribute *ot; - DCAST_INTO_R(ot, other, false); - - if (_ptr != ot->_ptr) { - return (_ptr > ot->_ptr) ? 1 : -1; - } - - return 0; -} diff --git a/panda/src/dgraph/pointerDataAttribute.h b/panda/src/dgraph/pointerDataAttribute.h deleted file mode 100644 index 410ee41cc6..0000000000 --- a/panda/src/dgraph/pointerDataAttribute.h +++ /dev/null @@ -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 - -#include -#include - -template -class PointerDataTransition; - -//////////////////////////////////////////////////////////////////// -// Class : PointerDataTransition -// Description : -//////////////////////////////////////////////////////////////////// -template -class PointerDataAttribute : public NodeAttribute { -public: - INLINE PointerDataAttribute(); - INLINE PointerDataAttribute(PtrType* ptr); - INLINE PointerDataAttribute(const PointerDataAttribute ©); - INLINE void operator = (const PointerDataAttribute ©); - -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; - - //Variable is just to make the compiler happy for the default - //constructor - static PtrType* _null_ptr; -}; - -#include "pointerDataAttribute.I" - -#endif diff --git a/panda/src/dgraph/pointerDataTransition.I b/panda/src/dgraph/pointerDataTransition.I deleted file mode 100644 index 8c848b0069..0000000000 --- a/panda/src/dgraph/pointerDataTransition.I +++ /dev/null @@ -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 -TypeHandle PointerDataTransition::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerDataTransition:: -PointerDataTransition() : - _ptr(PointerDataAttribute::_null_ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerDataTransition:: -PointerDataTransition(PtrType* ptr) : - _ptr(ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE PointerDataTransition:: -PointerDataTransition(const PointerDataTransition ©) : - NodeTransition(copy), _ptr(copy._ptr) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void PointerDataTransition:: -operator = (const PointerDataTransition ©) { - NodeTransition::operator = (copy); - _ptr = copy._ptr; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::set_value -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void PointerDataTransition:: -set_value(PtrType* ptr) { - _ptr = ptr; - state_changed(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::get_value -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -PtrType* PointerDataTransition:: -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 -NodeTransition *PointerDataTransition:: -compose(const NodeTransition *other) const { - const PointerDataTransition *ot; - DCAST_INTO_R(ot, other, NULL); - - return (NodeTransition*)other; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::invert -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -NodeTransition *PointerDataTransition:: -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 -NodeAttribute *PointerDataTransition:: -apply(const NodeAttribute *attrib) const { - const PointerDataAttribute *at; - DCAST_INTO_R(at, attrib, NULL); - - return (NodeAttribute*)attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void PointerDataTransition:: -output(ostream &out) const { - out << (void*)_ptr << endl; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void PointerDataTransition:: -write(ostream &out, int indent_level) const { - indent(out, indent_level) << (void*)_ptr << endl; -} - -/////////////////////////////////////////////////////////////////// -// Function: PointerDataTransition::internal_compare_to -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int PointerDataTransition:: -internal_compare_to(const NodeTransition *other) const { - const PointerDataTransition *ot; - DCAST_INTO_R(ot, other, false); - - if (_ptr != ot->_ptr) { - return (_ptr > ot->_ptr) ? 1 : -1; - } - - return 0; -} - - - - - - - - - - diff --git a/panda/src/dgraph/pointerDataTransition.h b/panda/src/dgraph/pointerDataTransition.h deleted file mode 100644 index d5ff2ad355..0000000000 --- a/panda/src/dgraph/pointerDataTransition.h +++ /dev/null @@ -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 - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : PointerDataTransition -// Description : A PointerDataAttribute is a special data graph -// attribute that is used to pass around a single -// pointer. -//////////////////////////////////////////////////////////////////// -template -class PointerDataTransition : public NodeTransition { -public: - INLINE PointerDataTransition(); - INLINE PointerDataTransition(PtrType* ptr); - INLINE PointerDataTransition(const PointerDataTransition ©); - INLINE void operator = (const PointerDataTransition ©); - -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 diff --git a/panda/src/dgraph/test_dgraph.cxx b/panda/src/dgraph/test_dgraph.cxx index 68624750a4..bd3ad695fc 100644 --- a/panda/src/dgraph/test_dgraph.cxx +++ b/panda/src/dgraph/test_dgraph.cxx @@ -22,9 +22,7 @@ #include "dataRelation.h" #include "dataGraphTraversal.h" #include "doubleDataTransition.h" -#include "doubleDataAttribute.h" #include "vec3DataTransition.h" -#include "vec3DataAttribute.h" #include @@ -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 { diff --git a/panda/src/dgraph/vec3DataAttribute.I b/panda/src/dgraph/vec3DataAttribute.I deleted file mode 100644 index 4eb73f4891..0000000000 --- a/panda/src/dgraph/vec3DataAttribute.I +++ /dev/null @@ -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(value) -{ -} - diff --git a/panda/src/dgraph/vec3DataAttribute.cxx b/panda/src/dgraph/vec3DataAttribute.cxx deleted file mode 100644 index deb3a14dbf..0000000000 --- a/panda/src/dgraph/vec3DataAttribute.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/vec3DataAttribute.h b/panda/src/dgraph/vec3DataAttribute.h deleted file mode 100644 index fa40f35cb9..0000000000 --- a/panda/src/dgraph/vec3DataAttribute.h +++ /dev/null @@ -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 - -#include "vectorDataAttribute.h" - -#include - -// We need to define this temporary macro so we can pass a parameter -// containing a comma through the macro. -#define VECTORDATAATTRIBUTE_LPOINT3F VectorDataAttribute -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LPOINT3F); - -//////////////////////////////////////////////////////////////////// -// Class : Vec3DataAttribute -// Description : A VectorDataAttribute templated on LPoint3f. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA Vec3DataAttribute : - public VectorDataAttribute { -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::init_type(); - register_type(_type_handle, "Vec3DataAttribute", - VectorDataAttribute::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 diff --git a/panda/src/dgraph/vec3DataTransition.I b/panda/src/dgraph/vec3DataTransition.I index 3833fe1fc5..8d03bc96bd 100644 --- a/panda/src/dgraph/vec3DataTransition.I +++ b/panda/src/dgraph/vec3DataTransition.I @@ -22,17 +22,8 @@ // Description: //////////////////////////////////////////////////////////////////// INLINE Vec3DataTransition:: -Vec3DataTransition() { -} - -//////////////////////////////////////////////////////////////////// -// Function: Vec3DataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Vec3DataTransition:: -Vec3DataTransition(const LMatrix4f &matrix) : - VectorDataTransition(matrix) +Vec3DataTransition(const LPoint3f &value) : + VectorDataTransition(value) { } diff --git a/panda/src/dgraph/vec3DataTransition.cxx b/panda/src/dgraph/vec3DataTransition.cxx index 7c29d99de0..9c9bb8f9e6 100644 --- a/panda/src/dgraph/vec3DataTransition.cxx +++ b/panda/src/dgraph/vec3DataTransition.cxx @@ -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; -} diff --git a/panda/src/dgraph/vec3DataTransition.h b/panda/src/dgraph/vec3DataTransition.h index 11d567ed83..2767123e99 100644 --- a/panda/src/dgraph/vec3DataTransition.h +++ b/panda/src/dgraph/vec3DataTransition.h @@ -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 +#define VECTORDATATRANSITION_LPOINT3F VectorDataTransition 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 { + public VectorDataTransition { 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::init_type(); + VectorDataTransition::init_type(); register_type(_type_handle, "Vec3DataTransition", - VectorDataTransition::get_class_type()); + VectorDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/vec4DataAttribute.I b/panda/src/dgraph/vec4DataAttribute.I deleted file mode 100644 index 282347f135..0000000000 --- a/panda/src/dgraph/vec4DataAttribute.I +++ /dev/null @@ -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(value) -{ -} diff --git a/panda/src/dgraph/vec4DataAttribute.cxx b/panda/src/dgraph/vec4DataAttribute.cxx deleted file mode 100644 index b56b798d65..0000000000 --- a/panda/src/dgraph/vec4DataAttribute.cxx +++ /dev/null @@ -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; -} diff --git a/panda/src/dgraph/vec4DataAttribute.h b/panda/src/dgraph/vec4DataAttribute.h deleted file mode 100644 index 20f3a83f6b..0000000000 --- a/panda/src/dgraph/vec4DataAttribute.h +++ /dev/null @@ -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 - -#include "vectorDataAttribute.h" - -#include - -// We need to define this temporary macro so we can pass a parameter -// containing a comma through the macro. -#define VECTORDATAATTRIBUTE_LPOINT4F VectorDataAttribute -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, VECTORDATAATTRIBUTE_LPOINT4F); - -//////////////////////////////////////////////////////////////////// -// Class : Vec4DataAttribute -// Description : A VectorDataAttribute templated on LPoint4f. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA Vec4DataAttribute : - public VectorDataAttribute { -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::init_type(); - register_type(_type_handle, "Vec4DataAttribute", - VectorDataAttribute::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 diff --git a/panda/src/dgraph/vec4DataTransition.I b/panda/src/dgraph/vec4DataTransition.I index 5171df1b18..f271a966af 100644 --- a/panda/src/dgraph/vec4DataTransition.I +++ b/panda/src/dgraph/vec4DataTransition.I @@ -22,16 +22,7 @@ // Description: //////////////////////////////////////////////////////////////////// INLINE Vec4DataTransition:: -Vec4DataTransition() { -} - -//////////////////////////////////////////////////////////////////// -// Function: Vec4DataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE Vec4DataTransition:: -Vec4DataTransition(const LMatrix4f &matrix) : - VectorDataTransition(matrix) +Vec4DataTransition(const LPoint4f &value) : + VectorDataTransition(value) { } diff --git a/panda/src/dgraph/vec4DataTransition.cxx b/panda/src/dgraph/vec4DataTransition.cxx index ed19176f77..721b927c7b 100644 --- a/panda/src/dgraph/vec4DataTransition.cxx +++ b/panda/src/dgraph/vec4DataTransition.cxx @@ -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; -} diff --git a/panda/src/dgraph/vec4DataTransition.h b/panda/src/dgraph/vec4DataTransition.h index 4c07fb2f14..c277e6b94f 100644 --- a/panda/src/dgraph/vec4DataTransition.h +++ b/panda/src/dgraph/vec4DataTransition.h @@ -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 +#define VECTORDATATRANSITION_LPOINT4F VectorDataTransition 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 { + public VectorDataTransition { 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::init_type(); + VectorDataTransition::init_type(); register_type(_type_handle, "Vec4DataTransition", - VectorDataTransition::get_class_type()); + VectorDataTransition::get_class_type()); } private: diff --git a/panda/src/dgraph/vectorDataAttribute.I b/panda/src/dgraph/vectorDataAttribute.I deleted file mode 100644 index d45d64c200..0000000000 --- a/panda/src/dgraph/vectorDataAttribute.I +++ /dev/null @@ -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 -TypeHandle VectorDataAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE VectorDataAttribute:: -VectorDataAttribute() { - _value = 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE VectorDataAttribute:: -VectorDataAttribute(const VecType &value) : - _value(value) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE VectorDataAttribute:: -VectorDataAttribute(const VectorDataAttribute ©) : - NodeAttribute(copy), - _value(copy._value) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void VectorDataAttribute:: -operator = (const VectorDataAttribute ©) { - NodeAttribute::operator = (copy); - _value = copy._value; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::set_value -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE void VectorDataAttribute:: -set_value(const VecType &value) { - _value = value; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::get_value -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE const VecType &VectorDataAttribute:: -get_value() const { - return _value; -} - - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::get_handle -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -TypeHandle VectorDataAttribute:: -get_handle() const { - return VectorDataTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void VectorDataAttribute:: -output(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void VectorDataAttribute:: -write(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int VectorDataAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const VectorDataAttribute *ot; - DCAST_INTO_R(ot, other, false); - - return _value.compare_to(ot->_value); -} diff --git a/panda/src/dgraph/vectorDataAttribute.h b/panda/src/dgraph/vectorDataAttribute.h deleted file mode 100644 index 7edbd11e49..0000000000 --- a/panda/src/dgraph/vectorDataAttribute.h +++ /dev/null @@ -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 - -#include -#include - -template -class VectorDataTransition; - -//////////////////////////////////////////////////////////////////// -// Class : VectorDataAttribute -// Description : -//////////////////////////////////////////////////////////////////// -template -class VectorDataAttribute : public NodeAttribute { -public: - INLINE VectorDataAttribute(); - INLINE VectorDataAttribute(const VecType &value); - INLINE VectorDataAttribute(const VectorDataAttribute ©); - INLINE void operator = (const VectorDataAttribute ©); - -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; -}; - -#include "vectorDataAttribute.I" - -#endif diff --git a/panda/src/dgraph/vectorDataTransition.I b/panda/src/dgraph/vectorDataTransition.I index 743bf49ba8..6980d2bf73 100644 --- a/panda/src/dgraph/vectorDataTransition.I +++ b/panda/src/dgraph/vectorDataTransition.I @@ -16,32 +16,18 @@ // //////////////////////////////////////////////////////////////////// -/* okcircular */ -#include "vectorDataAttribute.h" - -template -TypeHandle VectorDataTransition::_type_handle; +template +TypeHandle VectorDataTransition::_type_handle; //////////////////////////////////////////////////////////////////// // Function: VectorDataTransition::Constructor // Access: Public // Description: //////////////////////////////////////////////////////////////////// -template -INLINE VectorDataTransition:: -VectorDataTransition() { - _matrix = MatType::ident_mat(); -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE VectorDataTransition:: -VectorDataTransition(const MatType &matrix) : - _matrix(matrix) +template +INLINE VectorDataTransition:: +VectorDataTransition(const VecType &value) : + _value(value) { } @@ -50,11 +36,11 @@ VectorDataTransition(const MatType &matrix) : // Access: Public // Description: //////////////////////////////////////////////////////////////////// -template -INLINE VectorDataTransition:: -VectorDataTransition(const VectorDataTransition ©) : - NodeTransition(copy), - _matrix(copy._matrix) +template +INLINE VectorDataTransition:: +VectorDataTransition(const VectorDataTransition ©) : + OnTransition(copy), + _value(copy._value) { } @@ -63,165 +49,84 @@ VectorDataTransition(const VectorDataTransition ©) : // Access: Public // Description: //////////////////////////////////////////////////////////////////// -template -INLINE void VectorDataTransition:: -operator = (const VectorDataTransition ©) { - NodeTransition::operator = (copy); - _matrix = copy._matrix; +template +INLINE void VectorDataTransition:: +operator = (const VectorDataTransition ©) { + OnTransition::operator = (copy); + _value = copy._value; } //////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::is_identity -// Access: Public, Virtual -// Description: Returns true if this transition does not affect any -// numbers going through it. -//////////////////////////////////////////////////////////////////// -template -INLINE bool VectorDataTransition:: -is_identity() const { - return _matrix.almost_equal(MatType::ident_mat()); -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::set_matrix +// Function: VectorDataTransition::set_value // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// -template -void VectorDataTransition:: -set_matrix(const MatType &matrix) { - _matrix = matrix; +template +INLINE void VectorDataTransition:: +set_value(const VecType &value) { + _value = value; state_changed(); } //////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::get_matrix +// Function: VectorDataTransition::get_value // Access: Public, Virtual // Description: //////////////////////////////////////////////////////////////////// -template -const MatType &VectorDataTransition:: -get_matrix() const { - return _matrix; +template +INLINE const VecType &VectorDataTransition:: +get_value() const { + return _value; } //////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::compose +// Function: VectorDataTransition::set_value_from // 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: Copies the value from the other transition pointer, +// which is guaranteed to be another VectorDataTransition. //////////////////////////////////////////////////////////////////// -template -NodeTransition *VectorDataTransition:: -compose(const NodeTransition *other) const { - const VectorDataTransition *ot; - DCAST_INTO_R(ot, other, NULL); - - if (is_identity()) { - return (VectorDataTransition *)ot; - - } else if (ot->is_identity()) { - return (VectorDataTransition *)this; - - } else { - NodeTransition *c = make_copy(); - VectorDataTransition *result; - DCAST_INTO_R(result, c, NULL); - - result->_matrix = ot->_matrix * _matrix; - return result; - } +template +void VectorDataTransition:: +set_value_from(const OnTransition *other) { + const VectorDataTransition *ot; + DCAST_INTO_V(ot, other); + _value = ot->_value; } //////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::invert -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -NodeTransition *VectorDataTransition:: -invert() const { - if (is_identity()) { - return (VectorDataTransition *)this; - - } else { - PT(NodeTransition) c = make_copy(); - VectorDataTransition *result; - DCAST_INTO_R(result, c, NULL); - - bool invertible = result->_matrix.invert_from(_matrix); - if (!invertible) { - return NULL; - } - return result; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::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 -NodeAttribute *VectorDataTransition:: -apply(const NodeAttribute *attrib) const { - const VectorDataAttribute *at; - DCAST_INTO_R(at, attrib, NULL); - - if (is_identity()) { - return (VectorDataAttribute *)attrib; - } - - NodeAttribute *c = make_attrib(); - VectorDataAttribute *result; - DCAST_INTO_R(result, c, NULL); - - result->_value = at->_value * _matrix; - return result; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void VectorDataTransition:: -output(ostream &out) const { - out << _matrix; -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void VectorDataTransition:: -write(ostream &out, int indent_level) const { - _matrix.write(out, indent_level); -} - -//////////////////////////////////////////////////////////////////// -// Function: VectorDataTransition::internal_compare_to +// Function: VectorDataTransition::compare_values // Access: Protected, Virtual // Description: //////////////////////////////////////////////////////////////////// -template -int VectorDataTransition:: -internal_compare_to(const NodeTransition *other) const { - const VectorDataTransition *ot; +template +int VectorDataTransition:: +compare_values(const OnTransition *other) const { + const VectorDataTransition *ot; DCAST_INTO_R(ot, other, false); - - return _matrix.compare_to(ot->_matrix); + return _value.compare_to(ot->_value); +} + +//////////////////////////////////////////////////////////////////// +// Function: VectorDataTransition::output_value +// Access: Protected, Virtual +// Description: Formats the value for human consumption on one line. +//////////////////////////////////////////////////////////////////// +template +void VectorDataTransition:: +output_value(ostream &out) const { + out << _value; +} + +//////////////////////////////////////////////////////////////////// +// Function: VectorDataTransition::write_value +// Access: Protected, Virtual +// Description: Formats the value for human consumption on multiple +// lines if necessary. +//////////////////////////////////////////////////////////////////// +template +void VectorDataTransition:: +write_value(ostream &out, int indent_level) const { + // Oops, this isn't defined for vectors. + // _value.write(out, indent_level); + indent(out, indent_level) << _value << "\n"; } diff --git a/panda/src/dgraph/vectorDataTransition.h b/panda/src/dgraph/vectorDataTransition.h index 120cee8d3c..5d440b27ef 100644 --- a/panda/src/dgraph/vectorDataTransition.h +++ b/panda/src/dgraph/vectorDataTransition.h @@ -19,51 +19,39 @@ #ifndef VECTORDATATRANSITION_H #define VECTORDATATRANSITION_H -#include +#include "pandabase.h" -#include -#include -#include -#include +#include "onTransition.h" +#include "luse.h" +#include "indent.h" +#include "pointerTo.h" //////////////////////////////////////////////////////////////////// // Class : VectorDataTransition -// Description : A VectorDataAttribute is a special data graph +// Description : A VectorDataTransition is a special data graph // attribute that is used to pass around a complex -// number like a vector or a matrix. The Transition -// isn't often used, but it may contain a matrix that -// modifies the vector in the attribute. (Note that a -// LMatrix4DataAttribute actually derives from -// VectorDataAttribute, even though its base type is a -// matrix, not a vector.) +// number like a vector or a matrix. Matrices do not +// accumulate; each matrix replaces the one before. //////////////////////////////////////////////////////////////////// -template -class VectorDataTransition : public NodeTransition { +template +class VectorDataTransition : public OnTransition { public: - INLINE VectorDataTransition(); - INLINE VectorDataTransition(const MatType &matrix); - INLINE VectorDataTransition(const VectorDataTransition ©); - INLINE void operator = (const VectorDataTransition ©); + INLINE VectorDataTransition(const VecType &value); + INLINE VectorDataTransition(const VectorDataTransition ©); + INLINE void operator = (const VectorDataTransition ©); public: - - INLINE bool is_identity() const; - - INLINE void set_matrix(const MatType &matrix); - INLINE const MatType &get_matrix() 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(const VecType &value); + INLINE const VecType &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: - MatType _matrix; + VecType _value; public: virtual TypeHandle get_type() const { @@ -74,14 +62,12 @@ public: return _type_handle; } static void init_type() { - NodeTransition::init_type(); + OnTransition::init_type(); do_init_type(VecType); - do_init_type(MatType); register_type(_type_handle, string("VectorDataTransition<") + - get_type_handle(VecType).get_name() + "," + - get_type_handle(MatType).get_name() + ">", - NodeTransition::get_class_type()); + get_type_handle(VecType).get_name() + ">", + OnTransition::get_class_type()); } private: diff --git a/panda/src/framework/framework.cxx b/panda/src/framework/framework.cxx index 9409bf0c94..efe905da74 100644 --- a/panda/src/framework/framework.cxx +++ b/panda/src/framework/framework.cxx @@ -48,7 +48,6 @@ #include "pt_NamedNode.h" #include "colorTransition.h" #include "renderModeTransition.h" -#include "renderModeAttribute.h" #include "materialTransition.h" #include "dataGraphTraversal.h" #include "trackball.h" @@ -57,15 +56,12 @@ #include "texture.h" #include "texturePool.h" #include "textureTransition.h" -#include "textureAttribute.h" #include "interactiveGraphicsPipe.h" #include "noninteractiveGraphicsPipe.h" #include "graphicsWindow.h" #include "plist.h" #include "lightTransition.h" -#include "lightAttribute.h" #include "materialTransition.h" -#include "materialAttribute.h" #include "animControl.h" #include "animControlCollection.h" #include "auto_bind.h" @@ -75,13 +71,11 @@ #include "spotlight.h" #include "dconfig.h" #include "cullFaceTransition.h" -#include "cullFaceAttribute.h" #include "pruneTransition.h" #include "dftraverser.h" #include "renderBuffer.h" #include "loader.h" #include "fogTransition.h" -#include "fogAttribute.h" #include "clockObject.h" #include "compose_matrix.h" #include "notify.h" diff --git a/panda/src/glutdisplay/test_glut.cxx b/panda/src/glutdisplay/test_glut.cxx index 44daeead8c..e6203f00e4 100644 --- a/panda/src/glutdisplay/test_glut.cxx +++ b/panda/src/glutdisplay/test_glut.cxx @@ -20,7 +20,6 @@ //#include "glutGraphicsWindow.h" #include #include -#include #include #include @@ -28,14 +27,13 @@ PT(GraphicsPipe) main_pipe; PT(GraphicsWindow) main_win; PT_NamedNode render; -NodeAttributes initial_state; void render_frame(GraphicsPipe *pipe) { GraphicsPipe::wins_iterator wi; for (wi = pipe->get_win_begin(); wi != pipe->get_win_end(); ++wi) { - (*wi)->get_gsg()->render_frame(render, initial_state); + (*wi)->get_gsg()->render_frame(render); } } diff --git a/panda/src/graph/Sources.pp b/panda/src/graph/Sources.pp index 5110e7b697..4a90d4ff6c 100644 --- a/panda/src/graph/Sources.pp +++ b/panda/src/graph/Sources.pp @@ -9,24 +9,20 @@ #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx #define SOURCES \ - allAttributesWrapper.I allAttributesWrapper.T \ - allAttributesWrapper.h allTransitionsWrapper.I \ + allTransitionsWrapper.I \ allTransitionsWrapper.T allTransitionsWrapper.h arcChain.I \ - arcChain.h bitMask32Transition.h bitMaskAttribute.T \ - bitMaskAttribute.h bitMaskTransition.T bitMaskTransition.h \ + arcChain.h bitMask32Transition.h bitMaskTransition.T \ + bitMaskTransition.h \ boundedObject.I boundedObject.N boundedObject.h \ config_graph.h dftraverser.T dftraverser.h \ - graphHashGenerator.h graphReducer.h immediateAttribute.h \ + graphHashGenerator.h graphReducer.h \ immediateTransition.I immediateTransition.h \ - lmatrix4fTransition.h matrixAttribute.T matrixAttribute.h \ - matrixTransition.T matrixTransition.h multiAttribute.T \ - multiAttribute.h multiNodeAttribute.h multiNodeTransition.h \ + lmatrix4fTransition.h \ + matrixTransition.T matrixTransition.h multiNodeTransition.h \ multiTransition.T multiTransition.h multiTransitionHelpers.I \ multiTransitionHelpers.h namedNode.I namedNode.h node.I \ - node.h nodeAttribute.I nodeAttribute.N nodeAttribute.h \ - nodeAttributeWrapper.I nodeAttributeWrapper.T \ - nodeAttributeWrapper.h nodeAttributes.I nodeAttributes.N \ - nodeAttributes.T nodeAttributes.h nodeConnection.I \ + node.h \ + nodeConnection.I \ nodeConnection.h nodeRelation.I nodeRelation.N \ nodeRelation.T nodeRelation.h nodeTransition.I \ nodeTransition.N nodeTransition.h nodeTransitionCache.I \ @@ -34,10 +30,8 @@ nodeTransitionCacheEntry.h nodeTransitionWrapper.I \ nodeTransitionWrapper.T nodeTransitionWrapper.h \ nodeTransitions.I nodeTransitions.T nodeTransitions.h \ - nullAttributeWrapper.I nullAttributeWrapper.h \ nullLevelState.h nullTransitionWrapper.I \ - nullTransitionWrapper.h onAttribute.h onOffAttribute.I \ - onOffAttribute.h onOffTransition.I onOffTransition.h \ + nullTransitionWrapper.h onOffTransition.I onOffTransition.h \ onTransition.I onTransition.h pointerNameClass.h \ pt_NamedNode.N pt_NamedNode.h pt_Node.N pt_Node.h \ pt_NodeRelation.h setTransitionHelpers.T \ @@ -47,51 +41,46 @@ wrt.h #define INCLUDED_SOURCES \ - allAttributesWrapper.cxx allTransitionsWrapper.cxx \ + allTransitionsWrapper.cxx \ arcChain.cxx bitMask32Transition.cxx \ boundedObject.cxx config_graph.cxx graphReducer.cxx \ - immediateAttribute.cxx immediateTransition.cxx \ - lmatrix4fTransition.cxx multiNodeAttribute.cxx \ + immediateTransition.cxx \ + lmatrix4fTransition.cxx \ multiNodeTransition.cxx namedNode.cxx node.cxx \ - nodeAttribute.cxx nodeAttributeWrapper.cxx \ - nodeAttributes.cxx nodeConnection.cxx nodeRelation.cxx \ + nodeConnection.cxx nodeRelation.cxx \ nodeTransition.cxx nodeTransitionCache.cxx \ nodeTransitionCacheEntry.cxx nodeTransitionWrapper.cxx \ nodeTransitions.cxx \ - nullAttributeWrapper.cxx nullLevelState.cxx \ - nullTransitionWrapper.cxx onAttribute.cxx onOffAttribute.cxx \ + nullLevelState.cxx \ + nullTransitionWrapper.cxx \ onOffTransition.cxx onTransition.cxx pt_NamedNode.cxx \ pt_Node.cxx pt_NodeRelation.cxx vector_PT_Node.cxx \ vector_PT_NodeRelation.cxx vector_NodeRelation_star.cxx \ wrt.cxx #define INSTALL_HEADERS \ - allAttributesWrapper.I allAttributesWrapper.T \ - allAttributesWrapper.h allTransitionsWrapper.I \ + allTransitionsWrapper.I \ allTransitionsWrapper.T allTransitionsWrapper.h arcChain.I \ - arcChain.h bitMask32Transition.h bitMaskAttribute.T \ - bitMaskAttribute.h bitMaskTransition.T bitMaskTransition.h \ + arcChain.h bitMask32Transition.h \ + bitMaskTransition.T bitMaskTransition.h \ boundedObject.I boundedObject.h config_graph.h dftraverser.T \ dftraverser.h graphHashGenerator.h \ - graphReducer.h immediateAttribute.h \ + graphReducer.h \ immediateTransition.I immediateTransition.h lmatrix4fTransition.h \ - matrixAttribute.T matrixAttribute.h matrixTransition.T \ - matrixTransition.h multiAttribute.T multiAttribute.h \ - multiNodeAttribute.h multiNodeTransition.h multiTransition.T \ + matrixTransition.T \ + matrixTransition.h \ + multiNodeTransition.h multiTransition.T \ multiTransition.h multiTransitionHelpers.I \ multiTransitionHelpers.h namedNode.I namedNode.h node.I node.h \ - nodeAttribute.I nodeAttribute.h nodeAttributeWrapper.I \ - nodeAttributeWrapper.T nodeAttributeWrapper.h nodeAttributes.I \ - nodeAttributes.T nodeAttributes.h nodeConnection.I \ + nodeConnection.I \ nodeConnection.h nodeRelation.I nodeRelation.T nodeRelation.h \ nodeTransition.I nodeTransition.h nodeTransitionCache.I \ nodeTransitionCache.h nodeTransitionCacheEntry.I \ nodeTransitionCacheEntry.h nodeTransitionWrapper.I \ nodeTransitionWrapper.T nodeTransitionWrapper.h nodeTransitions.I \ - nodeTransitions.T nodeTransitions.h nullAttributeWrapper.I \ - nullAttributeWrapper.h nullLevelState.h nullTransitionWrapper.I \ - nullTransitionWrapper.h onAttribute.h onOffAttribute.I \ - onOffAttribute.h onOffTransition.I onOffTransition.h \ + nodeTransitions.T nodeTransitions.h \ + nullLevelState.h nullTransitionWrapper.I \ + nullTransitionWrapper.h onOffTransition.I onOffTransition.h \ onTransition.I onTransition.h pointerNameClass.h pt_NamedNode.h \ pt_Node.h pt_NodeRelation.h \ setTransitionHelpers.T setTransitionHelpers.h \ diff --git a/panda/src/graph/allAttributesWrapper.I b/panda/src/graph/allAttributesWrapper.I deleted file mode 100644 index 9e85ef790b..0000000000 --- a/panda/src/graph/allAttributesWrapper.I +++ /dev/null @@ -1,225 +0,0 @@ -// Filename: allAttributesWrapper.I -// Created by: drose (21Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: AllAttributesWrapper::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH AllAttributesWrapper:: -AllAttributesWrapper() { -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH AllAttributesWrapper:: -AllAttributesWrapper(const NodeAttributes &attrib) : - _attrib(attrib) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH AllAttributesWrapper:: -AllAttributesWrapper(const AllAttributesWrapper ©) : - _attrib(copy._attrib) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void AllAttributesWrapper:: -operator = (const AllAttributesWrapper ©) { - _attrib = copy._attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::init_from -// Access: Public, Static -// Description: This is a named constructor that creates an empty -// AllAttributesWrapper ready to access the same type -// of AllAttributes as the other. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH AllAttributesWrapper AllAttributesWrapper:: -init_from(const AllTransitionsWrapper &) { - return AllAttributesWrapper(); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH AllAttributesWrapper:: -~AllAttributesWrapper() { -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::is_empty -// Access: Public -// Description: Returns true if there are no Attributes stored in -// the set, or false if there are any (even initial) -// Attributes. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool AllAttributesWrapper:: -is_empty() const { - return _attrib.is_empty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::set_attribute -// Access: Public -// Description: This flavor of set_attribute() accepts a specific -// TypeHandle, indicating the type of attribute that we -// are setting, and a NodeAttribute pointer indicating -// the value of the attribute. The NodeAttribute may -// be NULL indicating that the attribute should be -// cleared. If the NodeAttribute is not NULL, it must -// match the type indicated by the TypeHandle. -// -// The return value is a pointer to the *previous* -// attribute in the set, if any, or NULL if there was -// none. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH PT(NodeAttribute) AllAttributesWrapper:: -set_attribute(TypeHandle handle, NodeAttribute *trans) { - return _attrib.set_attribute(handle, trans); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::set_attribute -// Access: Public -// Description: This flavor of set_attribute() accepts a pointer to -// a NodeAttribute only. It infers the type of the -// NodeAttribute from the pointer. However, it is not -// valid to pass a NULL pointer to this flavor of -// set_attribute; if the pointer might be NULL, use the -// above flavor instead (or just call clear_attribute). -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH PT(NodeAttribute) AllAttributesWrapper:: -set_attribute(NodeAttribute *trans) { - nassertr(trans != (NodeAttribute *)NULL, NULL); - nassertr(trans->get_handle() != TypeHandle::none(), NULL); - return set_attribute(trans->get_handle(), trans); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::clear_attribute -// Access: Public -// Description: Removes any attribute associated with the indicated -// handle from the set. -// -// The return value is a pointer to the previous -// attribute in the set, if any, or NULL if there was -// none. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH PT(NodeAttribute) AllAttributesWrapper:: -clear_attribute(TypeHandle handle) { - return _attrib.clear_attribute(handle); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::has_attribute -// Access: Public -// Description: Returns true if ab attribute associated with the -// indicated handle has been stored in the set (even if -// it is the initial attribute), or false otherwise. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool AllAttributesWrapper:: -has_attribute(TypeHandle handle) const { - return _attrib.has_attribute(handle); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::get_attribute -// Access: Public -// Description: Returns the attribute associated with the indicated -// handle, or NULL if no such attribute has been stored -// in the set. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttribute *AllAttributesWrapper:: -get_attribute(TypeHandle handle) const { - return _attrib.get_attribute(handle); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::get_attributes -// Access: Public -// Description: Returns the entire set of attributes associated with -// the wrapper. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH const NodeAttributes &AllAttributesWrapper:: -get_attributes() const { - return _attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::get_attributes -// Access: Public -// Description: Returns the entire set of attributes associated with -// the wrapper. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes &AllAttributesWrapper:: -get_attributes() { - return _attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::is_initial -// Access: Public -// Description: Returns true if the wrapper represents an initial -// attribute. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool AllAttributesWrapper:: -is_initial() const { - return _attrib.is_initial(); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::compare_to -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH int AllAttributesWrapper:: -compare_to(const AllAttributesWrapper &other) const { - return _attrib.compare_to(other._attrib); -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::make_initial -// Access: Public -// Description: Resets the wrapper to the initial attribute. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void AllAttributesWrapper:: -make_initial() { - _attrib.clear(); -} - -INLINE_GRAPH ostream &operator << (ostream &out, const AllAttributesWrapper &a) { - a.output(out); - return out; -} diff --git a/panda/src/graph/allAttributesWrapper.T b/panda/src/graph/allAttributesWrapper.T deleted file mode 100644 index d58973bf57..0000000000 --- a/panda/src/graph/allAttributesWrapper.T +++ /dev/null @@ -1,41 +0,0 @@ -// Filename: allAttributesWrapper.T -// Created by: drose (21Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: get_attribute_into -// Description: This external template function is handy for -// extracting a attribute of a particular type from the -// set. If the attribute exists, it is automatically -// downcasted to the correct type and stored in the -// pointer given in the first parameter, and the return -// value is true. If the attribute does not exist, the -// pointer is filled with NULL and the return value is -// false. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH bool -get_attribute_into(Attribute *&ptr, const AllAttributesWrapper &attrib, - TypeHandle transition_type) { - NodeAttribute *nt = attrib.get_attribute(transition_type); - if (nt == (NodeAttribute *)NULL) { - ptr = (Attribute *)NULL; - return false; - } - DCAST_INTO_R(ptr, nt, false); - return true; -} diff --git a/panda/src/graph/allAttributesWrapper.cxx b/panda/src/graph/allAttributesWrapper.cxx deleted file mode 100644 index 7eeadfdf18..0000000000 --- a/panda/src/graph/allAttributesWrapper.cxx +++ /dev/null @@ -1,86 +0,0 @@ -// Filename: allAttributesWrapper.cxx -// Created by: drose (21Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "allAttributesWrapper.h" -#include "allTransitionsWrapper.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::apply_in_place -// Access: Public -// Description: Modifies the attribute by applying the transition. -//////////////////////////////////////////////////////////////////// -void AllAttributesWrapper:: -apply_in_place(const AllTransitionsWrapper &trans) { - if (trans._cache != (NodeTransitionCache *)NULL) { - _attrib.apply_in_place(*trans._cache); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::apply_from -// Access: Public -// Description: Modifies the attribute to reflect the application of -// the indicated transition to the other attribute. -//////////////////////////////////////////////////////////////////// -void AllAttributesWrapper:: -apply_from(const AllAttributesWrapper &other, - const AllTransitionsWrapper &trans) { - if (trans._cache != (NodeTransitionCache *)NULL) { - _attrib.apply_from(other._attrib, *trans._cache); - } else { - _attrib = other._attrib; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::apply -// Access: Public -// Description: Allocates and returns a new NodeAttributes object -// that reflects the application of the transitions to -// this wrapper. -//////////////////////////////////////////////////////////////////// -NodeAttributes *AllAttributesWrapper:: -apply(const AllTransitionsWrapper &trans) const { - if (trans._cache != (NodeTransitionCache *)NULL) { - return _attrib.apply(*trans._cache); - } else { - return new NodeAttributes(_attrib); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void AllAttributesWrapper:: -output(ostream &out) const { - out << _attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: AllAttributesWrapper::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void AllAttributesWrapper:: -write(ostream &out, int indent_level) const { - _attrib.write(out, indent_level); -} diff --git a/panda/src/graph/allAttributesWrapper.h b/panda/src/graph/allAttributesWrapper.h deleted file mode 100644 index ea3cb26d6e..0000000000 --- a/panda/src/graph/allAttributesWrapper.h +++ /dev/null @@ -1,83 +0,0 @@ -// Filename: allAttributesWrapper.h -// Created by: drose (21Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 ALLATTRIBUTESWRAPPER_H -#define ALLATTRIBUTESWRAPPER_H - -#include - -#include "nodeAttributes.h" - -#include -#include - -class AllTransitionsWrapper; - -//////////////////////////////////////////////////////////////////// -// Class : AllAttributesWrapper -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA AllAttributesWrapper { -public: - typedef AllTransitionsWrapper TransitionWrapper; - typedef AllAttributesWrapper AttributeWrapper; - - INLINE_GRAPH AllAttributesWrapper(); - INLINE_GRAPH AllAttributesWrapper(const NodeAttributes &attrib); - INLINE_GRAPH AllAttributesWrapper(const AllAttributesWrapper ©); - INLINE_GRAPH void operator = (const AllAttributesWrapper ©); - INLINE_GRAPH static AllAttributesWrapper - init_from(const AllTransitionsWrapper &trans); - INLINE_GRAPH ~AllAttributesWrapper(); - - INLINE_GRAPH bool is_empty() const; - INLINE_GRAPH PT(NodeAttribute) set_attribute(TypeHandle handle, - NodeAttribute *trans); - INLINE_GRAPH PT(NodeAttribute) set_attribute(NodeAttribute *trans); - INLINE_GRAPH PT(NodeAttribute) clear_attribute(TypeHandle handle); - INLINE_GRAPH bool has_attribute(TypeHandle handle) const; - INLINE_GRAPH NodeAttribute *get_attribute(TypeHandle handle) const; - - INLINE_GRAPH const NodeAttributes &get_attributes() const; - INLINE_GRAPH NodeAttributes &get_attributes(); - - INLINE_GRAPH bool is_initial() const; - INLINE_GRAPH int compare_to(const AllAttributesWrapper &other) const; - - INLINE_GRAPH void make_initial(); - void apply_in_place(const AllTransitionsWrapper &trans); - void apply_from(const AllAttributesWrapper &other, - const AllTransitionsWrapper &trans); - NodeAttributes *apply(const AllTransitionsWrapper &trans) const; - - void output(ostream &out) const; - void write(ostream &out, int indent_level = 0) const; - -private: - NodeAttributes _attrib; -}; - -EXPCL_PANDA INLINE_GRAPH ostream &operator << (ostream &out, const AllAttributesWrapper &a); - -#include "allAttributesWrapper.T" - -#ifndef DONT_INLINE_GRAPH -#include "allAttributesWrapper.I" -#endif - -#endif diff --git a/panda/src/graph/allTransitionsWrapper.I b/panda/src/graph/allTransitionsWrapper.I index 075bc38e41..5dcbbee4ae 100644 --- a/panda/src/graph/allTransitionsWrapper.I +++ b/panda/src/graph/allTransitionsWrapper.I @@ -71,18 +71,6 @@ init_from(const AllTransitionsWrapper &) { return AllTransitionsWrapper(); } -//////////////////////////////////////////////////////////////////// -// Function: AllTransitionsWrapper::init_from -// Access: Public, Static -// Description: This is a named constructor that creates an empty -// AllTransitionsWrapper ready to access the same type -// of NodeTransition as the other. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH AllTransitionsWrapper AllTransitionsWrapper:: -init_from(const AllAttributesWrapper &) { - return AllTransitionsWrapper(); -} - //////////////////////////////////////////////////////////////////// // Function: AllTransitionsWrapper::is_empty // Access: Public @@ -97,30 +85,6 @@ is_empty() const { _cache->is_empty(); } -//////////////////////////////////////////////////////////////////// -// Function: AllTransitionsWrapper::set_transition -// Access: Public -// Description: This flavor of set_transition() accepts a specific -// TypeHandle, indicating the type of transition that we -// are setting, and a NodeTransition pointer indicating -// the value of the transition. The NodeTransition may -// be NULL indicating that the transition should be -// cleared. If the NodeTransition is not NULL, it must -// match the type indicated by the TypeHandle. -// -// The return value is a pointer to the *previous* -// transition in the set, if any, or NULL if there was -// none. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH PT(NodeTransition) AllTransitionsWrapper:: -set_transition(TypeHandle handle, NodeTransition *trans) { - if (_cache == (NodeTransitionCache *)NULL) { - _cache = new NodeTransitionCache; - } - _all_verified.clear(); - return _cache->set_transition(handle, trans); -} - //////////////////////////////////////////////////////////////////// // Function: AllTransitionsWrapper::set_transition // Access: Public @@ -138,25 +102,6 @@ set_transition(NodeTransition *trans) { return set_transition(trans->get_handle(), trans); } -//////////////////////////////////////////////////////////////////// -// Function: AllTransitionsWrapper::clear_transition -// Access: Public -// Description: Removes any transition associated with the indicated -// handle from the set. -// -// The return value is a pointer to the previous -// transition in the set, if any, or NULL if there was -// none. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH PT(NodeTransition) AllTransitionsWrapper:: -clear_transition(TypeHandle handle) { - if (_cache == (NodeTransitionCache *)NULL) { - return NULL; - } - _all_verified.clear(); - return _cache->clear_transition(handle); -} - //////////////////////////////////////////////////////////////////// // Function: AllTransitionsWrapper::has_transition // Access: Public @@ -187,6 +132,17 @@ get_transition(TypeHandle handle) const { return _cache->get_transition(handle); } +//////////////////////////////////////////////////////////////////// +// Function: AllTransitionsWrapper::clear +// Access: Public +// Description: Completely empties the set of Transitions stored in +// the wrapper. +//////////////////////////////////////////////////////////////////// +INLINE_GRAPH void AllTransitionsWrapper:: +clear() { + _cache = (NodeTransitionCache *)NULL; +} + //////////////////////////////////////////////////////////////////// // Function: AllTransitionsWrapper::get_transitions // Access: Public diff --git a/panda/src/graph/allTransitionsWrapper.cxx b/panda/src/graph/allTransitionsWrapper.cxx index d639e09dac..cf5382f5fb 100644 --- a/panda/src/graph/allTransitionsWrapper.cxx +++ b/panda/src/graph/allTransitionsWrapper.cxx @@ -23,6 +23,59 @@ NodeTransitionCache AllTransitionsWrapper::_empty_cache; +//////////////////////////////////////////////////////////////////// +// Function: AllTransitionsWrapper::set_transition +// Access: Public +// Description: This flavor of set_transition() accepts a specific +// TypeHandle, indicating the type of transition that we +// are setting, and a NodeTransition pointer indicating +// the value of the transition. The NodeTransition may +// be NULL indicating that the transition should be +// cleared. If the NodeTransition is not NULL, it must +// match the type indicated by the TypeHandle. +// +// The return value is a pointer to the *previous* +// transition in the set, if any, or NULL if there was +// none. +//////////////////////////////////////////////////////////////////// +PT(NodeTransition) AllTransitionsWrapper:: +set_transition(TypeHandle handle, NodeTransition *trans) { + if (_cache == (NodeTransitionCache *)NULL) { + _cache = new NodeTransitionCache; + + } else if (_cache->get_ref_count() != 1) { + // Copy-on-write. + _cache = new NodeTransitionCache(*_cache); + } + + _all_verified.clear(); + return _cache->set_transition(handle, trans); +} + +//////////////////////////////////////////////////////////////////// +// Function: AllTransitionsWrapper::clear_transition +// Access: Public +// Description: Removes any transition associated with the indicated +// handle from the set. +// +// The return value is a pointer to the previous +// transition in the set, if any, or NULL if there was +// none. +//////////////////////////////////////////////////////////////////// +PT(NodeTransition) AllTransitionsWrapper:: +clear_transition(TypeHandle handle) { + if (_cache == (NodeTransitionCache *)NULL) { + return NULL; + + } else if (_cache->get_ref_count() != 1) { + // Copy-on-write. + _cache = new NodeTransitionCache(*_cache); + } + + _all_verified.clear(); + return _cache->clear_transition(handle); +} + //////////////////////////////////////////////////////////////////// // Function: AllTransitionsWrapper::output // Access: Public, Virtual diff --git a/panda/src/graph/allTransitionsWrapper.h b/panda/src/graph/allTransitionsWrapper.h index 8b43b0ed31..63fc3929e8 100644 --- a/panda/src/graph/allTransitionsWrapper.h +++ b/panda/src/graph/allTransitionsWrapper.h @@ -20,9 +20,8 @@ #define ALLTRANSITIONSWRAPPER_H // -// There are several flavors of TransitionWrappers (and their -// corresponding AttributeWrappers). These are classes that represent -// one or a number of transitions (or attributes) simultaneously and +// There are several flavors of TransitionWrappers. These are classes +// that represent one or a number of transitions simultaneously and // are passed to template functions like df_traverse() and wrt() so // that the same functions can be used to operate on either one // transition type or a number of them. @@ -43,8 +42,6 @@ class Node; class NodeRelation; -class NodeAttribute; -class AllAttributesWrapper; //////////////////////////////////////////////////////////////////// // Class : AllTransitionsWrapper @@ -56,7 +53,6 @@ class AllAttributesWrapper; class EXPCL_PANDA AllTransitionsWrapper { public: typedef AllTransitionsWrapper TransitionWrapper; - typedef AllAttributesWrapper AttributeWrapper; typedef GraphHashGenerator HashGenerator; INLINE_GRAPH AllTransitionsWrapper(); @@ -66,17 +62,17 @@ public: INLINE_GRAPH static AllTransitionsWrapper init_from(const AllTransitionsWrapper &other); - INLINE_GRAPH static AllTransitionsWrapper - init_from(const AllAttributesWrapper &attrib); INLINE_GRAPH bool is_empty() const; - INLINE_GRAPH PT(NodeTransition) set_transition(TypeHandle handle, - NodeTransition *trans); + PT(NodeTransition) set_transition(TypeHandle handle, + NodeTransition *trans); INLINE_GRAPH PT(NodeTransition) set_transition(NodeTransition *trans); - INLINE_GRAPH PT(NodeTransition) clear_transition(TypeHandle handle); + PT(NodeTransition) clear_transition(TypeHandle handle); INLINE_GRAPH bool has_transition(TypeHandle handle) const; INLINE_GRAPH NodeTransition *get_transition(TypeHandle handle) const; + INLINE_GRAPH void clear(); + INLINE_GRAPH const NodeTransitionCache &get_transitions() const; INLINE_GRAPH bool is_identity() const; @@ -130,7 +126,6 @@ private: // empty. It's used just so we can have a sensible return value // from begin() and end() when our pointer is NULL. static NodeTransitionCache _empty_cache; - friend class AllAttributesWrapper; }; EXPCL_PANDA INLINE_GRAPH ostream &operator << (ostream &out, const AllTransitionsWrapper &ntw); diff --git a/panda/src/graph/bitMask32Transition.h b/panda/src/graph/bitMask32Transition.h index 95cdf5f961..07b68bb121 100644 --- a/panda/src/graph/bitMask32Transition.h +++ b/panda/src/graph/bitMask32Transition.h @@ -22,7 +22,6 @@ #include #include "bitMaskTransition.h" -#include "bitMaskAttribute.h" #include @@ -34,10 +33,8 @@ //////////////////////////////////////////////////////////////////// EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, BitMaskTransition); -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, BitMaskAttribute); typedef BitMaskTransition BitMask32Transition; -typedef BitMaskAttribute BitMask32Attribute; #ifdef __GNUC__ #pragma interface diff --git a/panda/src/graph/bitMaskAttribute.T b/panda/src/graph/bitMaskAttribute.T deleted file mode 100644 index d893c2ac47..0000000000 --- a/panda/src/graph/bitMaskAttribute.T +++ /dev/null @@ -1,116 +0,0 @@ -// Filename: bitMaskAttribute.T -// Created by: drose (08Jun00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 - -template -TypeHandle BitMaskAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH BitMaskAttribute:: -BitMaskAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH BitMaskAttribute:: -BitMaskAttribute(const MaskType &mask) : - _mask(mask) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH BitMaskAttribute:: -BitMaskAttribute(const BitMaskAttribute ©) : - NodeAttribute(copy), - _mask(copy._mask) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH void BitMaskAttribute:: -operator = (const BitMaskAttribute ©) { - NodeAttribute::operator = (copy); - _mask = copy._mask; -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::set_mask -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH void BitMaskAttribute:: -set_mask(const MaskType &mask) { - _mask = mask; -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::get_maskType -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH const MaskType &BitMaskAttribute:: -get_mask() const { - return _mask; -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void BitMaskAttribute:: -output(ostream &out) const { - out << _mask; -} - -//////////////////////////////////////////////////////////////////// -// Function: BitMaskAttribute::internal_compare_to -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int BitMaskAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const BitMaskAttribute *ot; - DCAST_INTO_R(ot, other, false); - - return _mask.compare_to(ot->_mask); -} diff --git a/panda/src/graph/bitMaskAttribute.h b/panda/src/graph/bitMaskAttribute.h deleted file mode 100644 index 48f0136a23..0000000000 --- a/panda/src/graph/bitMaskAttribute.h +++ /dev/null @@ -1,77 +0,0 @@ -// Filename: bitMaskAttribute.h -// Created by: drose (08Jun00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 BITMASKATTRIBUTE_H -#define BITMASKATTRIBUTE_H - -#include - -#include "nodeAttribute.h" - -template -class BitMaskTransition; - -//////////////////////////////////////////////////////////////////// -// Class : BitMaskAttribute -// Description : -//////////////////////////////////////////////////////////////////// -template -class BitMaskAttribute : public NodeAttribute { -protected: - INLINE_GRAPH BitMaskAttribute(); - INLINE_GRAPH BitMaskAttribute(const MaskType &mask); - INLINE_GRAPH BitMaskAttribute(const BitMaskAttribute ©); - INLINE_GRAPH void operator = (const BitMaskAttribute ©); - -public: - INLINE_GRAPH void set_mask(const MaskType &mask); - INLINE_GRAPH const MaskType &get_mask() const; - - virtual void output(ostream &out) const; - -protected: - virtual int internal_compare_to(const NodeAttribute *other) const; - -private: - MaskType _mask; - -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(); - MaskType::init_type(); - register_type(_type_handle, - string("BitMaskAttribute<") + - MaskType::get_class_type().get_name() + ">", - NodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -friend class BitMaskTransition; -}; - -#include "bitMaskAttribute.T" - -#endif diff --git a/panda/src/graph/bitMaskTransition.T b/panda/src/graph/bitMaskTransition.T index 7926ab3f6a..9ea185b25d 100644 --- a/panda/src/graph/bitMaskTransition.T +++ b/panda/src/graph/bitMaskTransition.T @@ -16,7 +16,6 @@ // //////////////////////////////////////////////////////////////////// -#include "bitMaskAttribute.h" template TypeHandle BitMaskTransition::_type_handle; @@ -156,40 +155,6 @@ invert() const { return NULL; } -//////////////////////////////////////////////////////////////////// -// Function: BitMaskTransition::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 -NodeAttribute *BitMaskTransition:: -apply(const NodeAttribute *attrib) const { - BitMaskAttribute *result; - DCAST_INTO_R(result, make_attrib(), NULL); - - if (attrib == (const NodeAttribute *)NULL) { - // If there is no root attribute, the default attribute is always - // all bits on. - result->_mask = (MaskType::all_on() & _and) | _or; - return result; - } - - if (_priority < result->_priority) { - // The priority is too low to affect the attribute. - return result; - } - - const BitMaskAttribute *at; - DCAST_INTO_R(at, attrib, NULL); - - result->_mask = (at->_mask & _and) | _or; - return result; -} - //////////////////////////////////////////////////////////////////// // Function: BitMaskTransition::output // Access: Public, Virtual diff --git a/panda/src/graph/bitMaskTransition.h b/panda/src/graph/bitMaskTransition.h index 86f8484b14..6e18972ee2 100644 --- a/panda/src/graph/bitMaskTransition.h +++ b/panda/src/graph/bitMaskTransition.h @@ -23,7 +23,6 @@ #include "nodeTransition.h" -class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// @@ -52,7 +51,6 @@ public: virtual NodeTransition *compose(const NodeTransition *other) const; virtual NodeTransition *invert() const; - virtual NodeAttribute *apply(const NodeAttribute *attrib) const; virtual void output(ostream &out) const; diff --git a/panda/src/graph/config_graph.cxx b/panda/src/graph/config_graph.cxx index 813d63d878..716ed894f5 100644 --- a/panda/src/graph/config_graph.cxx +++ b/panda/src/graph/config_graph.cxx @@ -23,13 +23,9 @@ #include "nodeRelation.h" #include "nodeTransition.h" #include "nodeTransitionCache.h" -#include "nodeAttribute.h" #include "onOffTransition.h" -#include "onOffAttribute.h" #include "multiNodeTransition.h" -#include "multiNodeAttribute.h" #include "immediateTransition.h" -#include "immediateAttribute.h" #include @@ -95,13 +91,9 @@ init_libgraph() { NodeRelation::init_type(); NodeTransition::init_type(); NodeTransitionCache::init_type(); - NodeAttribute::init_type(); OnOffTransition::init_type(); - OnOffAttribute::init_type(); MultiNodeTransition::init_type(); - MultiNodeAttribute::init_type(); ImmediateTransition::init_type(); - ImmediateAttribute::init_type(); NodeRelation::register_with_factory(); diff --git a/panda/src/graph/graphHashGenerator.h b/panda/src/graph/graphHashGenerator.h index ae00c69b52..e5267e9461 100644 --- a/panda/src/graph/graphHashGenerator.h +++ b/panda/src/graph/graphHashGenerator.h @@ -22,10 +22,9 @@ //////////////////////////////////////////////////////////////////// // // This file defines the typedef for GraphHashGenerator, which defines -// the kind of HashGenerator used by all the NodeTransitions and -// NodeAttributes. By changing this typedef we can change the -// fundamental hash generation mechanism for these things, if -// necessary. +// the kind of HashGenerator used by all the NodeTransitions. By +// changing this typedef we can change the fundamental hash generation +// mechanism for these things, if necessary. // // These hash codes are used to uniquify NodeTransitions, particularly // in the cull traverser, but only if the hashtable based extensions diff --git a/panda/src/graph/graph_composite1.cxx b/panda/src/graph/graph_composite1.cxx index aae7e9abd6..7ccf588a56 100644 --- a/panda/src/graph/graph_composite1.cxx +++ b/panda/src/graph/graph_composite1.cxx @@ -1,18 +1,13 @@ -#include "allAttributesWrapper.cxx" #include "allTransitionsWrapper.cxx" #include "arcChain.cxx" #include "bitMask32Transition.cxx" #include "boundedObject.cxx" #include "config_graph.cxx" #include "graphReducer.cxx" -#include "immediateAttribute.cxx" #include "immediateTransition.cxx" #include "lmatrix4fTransition.cxx" -#include "multiNodeAttribute.cxx" #include "multiNodeTransition.cxx" -#include "onAttribute.cxx" -#include "onOffAttribute.cxx" #include "onOffTransition.cxx" #include "onTransition.cxx" #include "pt_NamedNode.cxx" diff --git a/panda/src/graph/graph_composite2.cxx b/panda/src/graph/graph_composite2.cxx index 19e60653f0..52faa5c8fc 100644 --- a/panda/src/graph/graph_composite2.cxx +++ b/panda/src/graph/graph_composite2.cxx @@ -1,9 +1,6 @@ #include "namedNode.cxx" #include "node.cxx" -#include "nodeAttribute.cxx" -#include "nodeAttributeWrapper.cxx" -#include "nodeAttributes.cxx" #include "nodeConnection.cxx" #include "nodeRelation.cxx" #include "nodeTransition.cxx" @@ -11,7 +8,6 @@ #include "nodeTransitionCacheEntry.cxx" #include "nodeTransitionWrapper.cxx" #include "nodeTransitions.cxx" -#include "nullAttributeWrapper.cxx" #include "nullLevelState.cxx" #include "nullTransitionWrapper.cxx" diff --git a/panda/src/graph/immediateAttribute.cxx b/panda/src/graph/immediateAttribute.cxx deleted file mode 100644 index d8271d6cd9..0000000000 --- a/panda/src/graph/immediateAttribute.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// Filename: immediateAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "immediateAttribute.h" -#include "immediateTransition.h" - -#include - -TypeHandle ImmediateAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: ImmediateAttribute::make_copy -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -NodeAttribute *ImmediateAttribute:: -make_copy() const { - return new ImmediateAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ImmediateAttribute::make_initial -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -NodeAttribute *ImmediateAttribute:: -make_initial() const { - return new ImmediateAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: ImmediateAttribute::get_handle -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -TypeHandle ImmediateAttribute:: -get_handle() const { - return ImmediateTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ImmediateAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int ImmediateAttribute:: -internal_compare_to(const NodeAttribute *) const { - return 0; -} diff --git a/panda/src/graph/immediateAttribute.h b/panda/src/graph/immediateAttribute.h deleted file mode 100644 index e28979b049..0000000000 --- a/panda/src/graph/immediateAttribute.h +++ /dev/null @@ -1,66 +0,0 @@ -// Filename: immediateAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 IMMEDIATEATTRIBUTE_H -#define IMMEDIATEATTRIBUTE_H - -#include - -#include "nodeAttribute.h" - -class ImmediateTransition; - -//////////////////////////////////////////////////////////////////// -// Class : ImmediateAttribute -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA ImmediateAttribute : public NodeAttribute { -public: - - INLINE_GRAPH ImmediateAttribute() {}; - INLINE_GRAPH ImmediateAttribute(const ImmediateAttribute ©) : - NodeAttribute(copy){}; - INLINE_GRAPH void operator = (const ImmediateAttribute ©) - {NodeAttribute::operator = (copy);} -public: - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - virtual TypeHandle get_handle() const; - -protected: - virtual int internal_compare_to(const NodeAttribute *other) 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() { - NodeAttribute::init_type(); - register_type(_type_handle, "ImmediateAttribute", - NodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#endif diff --git a/panda/src/graph/immediateTransition.cxx b/panda/src/graph/immediateTransition.cxx index aa6eb052d4..d9d0c5a0a4 100644 --- a/panda/src/graph/immediateTransition.cxx +++ b/panda/src/graph/immediateTransition.cxx @@ -17,22 +17,11 @@ //////////////////////////////////////////////////////////////////// #include "immediateTransition.h" -#include "immediateAttribute.h" #include TypeHandle ImmediateTransition::_type_handle; -//////////////////////////////////////////////////////////////////// -// Function: ImmediateTransition::make_attrib -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -NodeAttribute *ImmediateTransition:: -make_attrib() const { - return new ImmediateAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: ImmediateTransition::compose // Access: Public, Virtual @@ -63,20 +52,6 @@ invert() const { return NULL; } -//////////////////////////////////////////////////////////////////// -// Function: ImmediateTransition::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. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ImmediateTransition:: -apply(const NodeAttribute *) const { - return NULL; -} - //////////////////////////////////////////////////////////////////// // Function: ImmediateTransition::internal_compare_to // Access: Protected, Virtual diff --git a/panda/src/graph/immediateTransition.h b/panda/src/graph/immediateTransition.h index c1fe5f856c..b8f8bf62e3 100644 --- a/panda/src/graph/immediateTransition.h +++ b/panda/src/graph/immediateTransition.h @@ -23,7 +23,6 @@ #include "nodeTransition.h" -class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// @@ -40,12 +39,6 @@ class NodeRelation; // do nothing. Presumably any transitions that inherit // from ImmediateTransition will redefine sub_render() // to do something suitably interesting. -// -// Classes that derive from ImmediateTransition need not -// also define a corresponding derivation from -// ImmediateAttribute; since the attribute does not -// represent any actual state, you may use -// ImmediateAttribute directly (without extending it). //////////////////////////////////////////////////////////////////// class EXPCL_PANDA ImmediateTransition : public NodeTransition { protected: @@ -54,11 +47,8 @@ protected: INLINE_GRAPH void operator = (const ImmediateTransition ©); public: - virtual NodeAttribute *make_attrib() const; - virtual NodeTransition *compose(const NodeTransition *other) const; virtual NodeTransition *invert() const; - virtual NodeAttribute *apply(const NodeAttribute *attrib) const; protected: virtual int internal_compare_to(const NodeTransition *other) const; diff --git a/panda/src/graph/lmatrix4fTransition.h b/panda/src/graph/lmatrix4fTransition.h index 17aba5181b..61a887c91c 100644 --- a/panda/src/graph/lmatrix4fTransition.h +++ b/panda/src/graph/lmatrix4fTransition.h @@ -22,7 +22,6 @@ #include #include "matrixTransition.h" -#include "matrixAttribute.h" #include @@ -34,10 +33,8 @@ //////////////////////////////////////////////////////////////////// EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MatrixTransition); -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MatrixAttribute); typedef MatrixTransition LMatrix4fTransition; -typedef MatrixAttribute LMatrix4fAttribute; #ifdef __GNUC__ #pragma interface diff --git a/panda/src/graph/matrixAttribute.T b/panda/src/graph/matrixAttribute.T deleted file mode 100644 index 5e1510ccda..0000000000 --- a/panda/src/graph/matrixAttribute.T +++ /dev/null @@ -1,116 +0,0 @@ -// Filename: matrixAttribute.T -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 - -template -TypeHandle MatrixAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH MatrixAttribute:: -MatrixAttribute() { - _matrix = Matrix::ident_mat(); -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH MatrixAttribute:: -MatrixAttribute(const MatrixAttribute ©) : - NodeAttribute(copy), - _matrix(copy._matrix) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH void MatrixAttribute:: -operator = (const MatrixAttribute ©) { - NodeAttribute::operator = (copy); - _matrix = copy._matrix; -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::set_matrix -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH void MatrixAttribute:: -set_matrix(const Matrix &mat) { - _matrix = mat; -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::get_matrix -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH const Matrix &MatrixAttribute:: -get_matrix() const { - return _matrix; -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void MatrixAttribute:: -output(ostream &out) const { - out << _matrix; -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void MatrixAttribute:: -write(ostream &out, int indent_level) const { - _matrix.write(out, indent_level); -} - -//////////////////////////////////////////////////////////////////// -// Function: MatrixAttribute::internal_compare_to -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int MatrixAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const MatrixAttribute *ot; - DCAST_INTO_R(ot, other, false); - - return _matrix.compare_to(ot->_matrix); -} diff --git a/panda/src/graph/matrixAttribute.h b/panda/src/graph/matrixAttribute.h deleted file mode 100644 index a519024eda..0000000000 --- a/panda/src/graph/matrixAttribute.h +++ /dev/null @@ -1,77 +0,0 @@ -// Filename: matrixAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 MATRIXATTRIBUTE_H -#define MATRIXATTRIBUTE_H - -#include - -#include "nodeAttribute.h" - -template -class MatrixTransition; - -//////////////////////////////////////////////////////////////////// -// Class : MatrixAttribute -// Description : -//////////////////////////////////////////////////////////////////// -template -class MatrixAttribute : public NodeAttribute { -protected: - INLINE_GRAPH MatrixAttribute(); - INLINE_GRAPH MatrixAttribute(const MatrixAttribute ©); - INLINE_GRAPH void operator = (const MatrixAttribute ©); - -public: - INLINE_GRAPH void set_matrix(const Matrix &mat); - INLINE_GRAPH const Matrix &get_matrix() 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: - Matrix _matrix; - -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(); - Matrix::init_type(); - register_type(_type_handle, - string("MatrixAttribute<") + - Matrix::get_class_type().get_name() + ">", - NodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; - friend class MatrixTransition; -}; - -#include "matrixAttribute.T" - -#endif diff --git a/panda/src/graph/matrixTransition.T b/panda/src/graph/matrixTransition.T index 4292c9b357..db25f3d5e7 100644 --- a/panda/src/graph/matrixTransition.T +++ b/panda/src/graph/matrixTransition.T @@ -16,9 +16,6 @@ // //////////////////////////////////////////////////////////////////// -#include "matrixAttribute.h" - -#include template TypeHandle MatrixTransition::_type_handle; @@ -130,34 +127,6 @@ invert() const { return make_with_matrix(inverted); } -//////////////////////////////////////////////////////////////////// -// Function: MatrixTransition::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 -NodeAttribute *MatrixTransition:: -apply(const NodeAttribute *attrib) const { - - MatrixAttribute *result; - DCAST_INTO_R(result, make_attrib(), NULL); - - if (attrib == (const NodeAttribute *)NULL) { - result->_matrix = _matrix; - return result; - } - - const MatrixAttribute *at; - DCAST_INTO_R(at, attrib, NULL); - - result->_matrix = _matrix * at->_matrix; - return result; -} - //////////////////////////////////////////////////////////////////// // Function: MatrixTransition::output // Access: Public, Virtual diff --git a/panda/src/graph/matrixTransition.h b/panda/src/graph/matrixTransition.h index 5d1ac6aac1..ea42a281d3 100644 --- a/panda/src/graph/matrixTransition.h +++ b/panda/src/graph/matrixTransition.h @@ -19,11 +19,12 @@ #ifndef MATRIXTRANSITION_H #define MATRIXTRANSITION_H -#include +#include "pandabase.h" #include "nodeTransition.h" -class NodeAttribute; +#include "indent.h" + class NodeRelation; //////////////////////////////////////////////////////////////////// @@ -51,7 +52,6 @@ public: 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; diff --git a/panda/src/graph/multiAttribute.T b/panda/src/graph/multiAttribute.T deleted file mode 100644 index df6ebff446..0000000000 --- a/panda/src/graph/multiAttribute.T +++ /dev/null @@ -1,337 +0,0 @@ -// Filename: multiAttribute.T -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 . -// -//////////////////////////////////////////////////////////////////// - -template -TypeHandle MultiAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -MultiAttribute:: -MultiAttribute() { - _properties_is_on = true; -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -MultiAttribute:: -MultiAttribute(const MultiAttribute ©) : - NodeAttribute(copy), - _properties(copy._properties), - _properties_is_on(copy._properties_is_on) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -operator = (const MultiAttribute ©) { - NodeAttribute::operator = (copy); - _properties = copy._properties; - _properties_is_on = copy._properties_is_on; -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::set_on -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -set_on(const Property &property) { - if (_properties_is_on) { - set_property(property); - } else { - clear_property(property); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::set_off -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -set_off(const Property &property) { - if (_properties_is_on) { - clear_property(property); - } else { - set_property(property); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::is_on -// Access: Public -// Description: Returns true if the particular properties member is -// on, false if it is not. -//////////////////////////////////////////////////////////////////// -template -bool MultiAttribute:: -is_on(const Property &property) const { - if (_properties_is_on) { - return has_property(property); - } else { - return !has_property(property); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::is_off -// Access: Public -// Description: Returns true if the particular properties member is -// off, false if it is not. -//////////////////////////////////////////////////////////////////// -template -bool MultiAttribute:: -is_off(const Property &property) const { - if (_properties_is_on) { - return !has_property(property); - } else { - return has_property(property); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::properties_is_on -// Access: Public -// Description: Returns true if inclusion in the set traversible via -// begin()/end() indicates that the given property is -// on, the default. Returns false if inclusion in the -// set indicates that the given property is off. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH bool MultiAttribute:: -get_properties_is_on() const { - return _properties_is_on; -} - - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -output(ostream &out) const { - if (!_properties.empty()) { - Properties::const_iterator pi = _properties.begin(); - output_property(out, *pi); - ++pi; - while (pi != _properties.end()) { - out << " "; - output_property(out, *pi); - ++pi; - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -write(ostream &out, int indent_level) const { - Properties::const_iterator pi; - for (pi = _properties.begin(); pi != _properties.end(); ++pi) { - write_property(out, *pi, indent_level); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -template -int MultiAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const MultiAttribute *ot; - DCAST_INTO_R(ot, other, false); - - return bmap_compare(_properties.begin(), _properties.end(), - ot->_properties.begin(), ot->_properties.end()); -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::output_property -// Access: Public, Virtual -// Description: This is a pure virtual function and normally would -// not need a body, except that VC++ doesn't seem happy -// about instantiating the template otherwise. -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -output_property(ostream &, const Property &) const { -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::write_property -// Access: Public, Virtual -// Description: This is a pure virtual function and normally would -// not need a body, except that VC++ doesn't seem happy -// about instantiating the template otherwise. -//////////////////////////////////////////////////////////////////// -template -void MultiAttribute:: -write_property(ostream &, const Property &, int) const { -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::set_property -// Access: Private -// Description: An internal function that adds the indicated property -// to the sorted vector, if it is not already there. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH void MultiAttribute:: -set_property(const Property &prop) { - bool found_flag = false; - Properties::iterator pi = find_property(prop, found_flag); - if (!found_flag) { - _properties.insert(pi, prop); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::set_property -// Access: Private -// Description: An internal function that returns true if the -// indicated property is a member of the sorted vector, -// false if not. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH bool MultiAttribute:: -has_property(const Property &prop) const { - bool found_flag = false; - ((MultiAttribute *)this)->find_property(prop, found_flag); - return found_flag; -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::clear_property -// Access: Private -// Description: An internal function that removes the indicated -// property from the sorted vector. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH void MultiAttribute:: -clear_property(const Property &prop) { - bool found_flag = false; - Properties::iterator pi = find_property(prop, found_flag); - if (found_flag) { - _properties.erase(pi); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::find_property -// Access: Private -// Description: An internal function that searches for the indicated -// property within the sorted vector. If the property -// is found, found_flag is set true, and its iterator is -// returned; otherwise, found_flag is unchanged, and the -// iterator at which the property should be inserted is -// returned. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH MultiAttribute::Properties::iterator MultiAttribute:: -find_property(const Property &prop, bool &found_flag) { - return binary_search_property(_properties.begin(), _properties.end(), - prop, found_flag); -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::binary_search_property -// Access: Private -// Description: An internal function that implements a binary search -// for a particular property on the sorted vector. If -// the property is found, found_flag is set true, and -// its iterator is returned; otherwise, found_flag is -// unchanged, and the iterator at which the property -// should be inserted is returned. -//////////////////////////////////////////////////////////////////// -template -MultiAttribute::Properties::iterator MultiAttribute:: -binary_search_property(Properties::iterator begin, Properties::iterator end, - const Property &prop, bool &found_flag) { - if (begin == end) { - return begin; - } - Properties::iterator mid = begin + (end - begin) / 2; - if (prop < *mid) { - return binary_search_property(begin, mid, prop, found_flag); - - } else if (*mid < prop) { - return binary_search_property(mid + 1, end, prop, found_flag); - - } else { // *mid == prop - found_flag = true; - return mid; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::size -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH MultiAttribute::size_type MultiAttribute:: -size() const { - return _properties.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::begin -// Access: Public -// Description: Returns an iterator that begins the sequence of -// properties in the attribute. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH MultiAttribute::const_iterator MultiAttribute:: -begin() const { - return _properties.begin(); -} - -//////////////////////////////////////////////////////////////////// -// Function: MultiAttribute::end -// Access: Public -// Description: Returns an iterator that marks the end of the -// sequence of properties in the attribute. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH MultiAttribute::const_iterator MultiAttribute:: -end() const { - return _properties.end(); -} diff --git a/panda/src/graph/multiAttribute.h b/panda/src/graph/multiAttribute.h deleted file mode 100644 index e00aeaffb1..0000000000 --- a/panda/src/graph/multiAttribute.h +++ /dev/null @@ -1,123 +0,0 @@ -// Filename: multiAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 MULTIATTRIBUTE_H -#define MULTIATTRIBUTE_H - -#include - -#include "nodeAttribute.h" -#include "multiTransitionHelpers.h" - -#include -#include - -template -class MultiTransition; - -//////////////////////////////////////////////////////////////////// -// Class : MultiAttribute -// Description : -//////////////////////////////////////////////////////////////////// -template -class MultiAttribute : public NodeAttribute { -private: - typedef pvector Properties; - -protected: - MultiAttribute(); - MultiAttribute(const MultiAttribute ©); - void operator = (const MultiAttribute ©); - -PUBLISHED: - void set_on(const Property &prop); - void set_off(const Property &prop); - - bool is_on(const Property &prop) const; - bool is_off(const Property &prop) const; - - INLINE_GRAPH bool get_properties_is_on() const; - -public: - 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; - - virtual void output_property(ostream &out, const Property &prop) const=0; - virtual void write_property(ostream &out, const Property &prop, - int indent_level) const=0; - -private: - INLINE_GRAPH void set_property(const Property &prop); - INLINE_GRAPH bool has_property(const Property &prop) const; - INLINE_GRAPH void clear_property(const Property &prop); - - INLINE_GRAPH Properties::iterator - find_property(const Property &prop, bool &found_flag); - - Properties::iterator - binary_search_property(Properties::iterator begin, Properties::iterator end, - const Property &prop, bool &found_flag); - -public: - // These functions and typedefs allow one to peruse all of the - // Properties in the transition. Remember to export the - // pvector template class if you intend to use these - // outside of PANDA.DLL. - typedef Properties::const_iterator iterator; - typedef Properties::const_iterator const_iterator; - typedef Properties::value_type value_type; - typedef Properties::size_type size_type; - - INLINE_GRAPH size_type size() const; - INLINE_GRAPH const_iterator begin() const; - INLINE_GRAPH const_iterator end() const; - -private: - // The following is a set of properties listed in the attribute. If - // _properties_is_on is true, the default, it is a list of all 'on' - // properties; all others are off. If _properties_is_on is false, - // it is a list of all 'off' properties; all others are on. - Properties _properties; - bool _properties_is_on; - -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("MultiAttribute<")+NameClass::get_class_name()+">", - NodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; - friend class MultiTransition; -}; - -#include "multiAttribute.T" - -#endif diff --git a/panda/src/graph/multiNodeAttribute.cxx b/panda/src/graph/multiNodeAttribute.cxx deleted file mode 100644 index 7e94ec1482..0000000000 --- a/panda/src/graph/multiNodeAttribute.cxx +++ /dev/null @@ -1,21 +0,0 @@ -// Filename: multiNodeAttribute.cxx -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "multiNodeAttribute.h" - -TypeHandle MultiNodeAttribute::_type_handle; diff --git a/panda/src/graph/multiNodeAttribute.h b/panda/src/graph/multiNodeAttribute.h deleted file mode 100644 index cd823224d0..0000000000 --- a/panda/src/graph/multiNodeAttribute.h +++ /dev/null @@ -1,72 +0,0 @@ -// Filename: multiNodeAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 MULTINODEATTRIBUTE_H -#define MULTINODEATTRIBUTE_H - -#include - -#include "multiAttribute.h" -#include "pointerNameClass.h" -#include "node.h" -#include "pt_Node.h" -#include "vector_PT_Node.h" - -#include - -class MultiNodeTransition; - -// We need to define this temporary macro so we can pass a parameter -// containing a comma through the macro. -#define MULTIATTRIBUTE_NODE MultiAttribute -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTIATTRIBUTE_NODE); - -//////////////////////////////////////////////////////////////////// -// Class : MultiNodeAttribute -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA MultiNodeAttribute : - public MultiAttribute { -protected: - INLINE_GRAPH MultiNodeAttribute() {}; - INLINE_GRAPH MultiNodeAttribute(const MultiNodeAttribute ©) : - MultiAttribute(copy) {}; - - INLINE_GRAPH void operator = (const MultiNodeAttribute ©) - {MultiAttribute::operator = (copy);} - -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() { - MultiAttribute::init_type(); - register_type(_type_handle, "MultiNodeAttribute", - MultiAttribute:: - get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#endif diff --git a/panda/src/graph/multiNodeTransition.h b/panda/src/graph/multiNodeTransition.h index 3fc7b32aa8..8b996b6725 100644 --- a/panda/src/graph/multiNodeTransition.h +++ b/panda/src/graph/multiNodeTransition.h @@ -28,7 +28,6 @@ #include -class NodeAttribute; class NodeRelation; // We need to define this temporary macro so we can pass a parameter diff --git a/panda/src/graph/multiTransition.T b/panda/src/graph/multiTransition.T index 18b384f565..89c8f278d4 100644 --- a/panda/src/graph/multiTransition.T +++ b/panda/src/graph/multiTransition.T @@ -16,9 +16,6 @@ // //////////////////////////////////////////////////////////////////// -/* okcircular */ -#include "multiAttribute.h" - template TypeHandle MultiTransition::_type_handle; @@ -363,75 +360,6 @@ invert() const { return result; } -//////////////////////////////////////////////////////////////////// -// Function: MultiTransition::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 -NodeAttribute *MultiTransition:: -apply(const NodeAttribute *attrib) const { - - MultiAttribute *result; - if (attrib == (const NodeAttribute *)NULL) { - DCAST_INTO_R(result, make_attrib(), NULL); - } else { - DCAST_INTO_R(result, (NodeAttribute *)attrib, NULL); - } - - if (_priority < result->_priority || is_identity()) { - // The priority is too low to affect the attribute, or we're - // identity. - return result; - } - - if (result->get_ref_count() > 1) { - // Copy on write. - DCAST_INTO_R(result, result->make_copy(), NULL); - } - - result->_priority = _priority; - - MultiAttribute::Properties temp; - if (_default_dir == TD_identity) { - // In this case, the normal case, the transition does not specify - // completely what the attributes should be. - bmap_apply(result->_properties.begin(), result->_properties.end(), - _properties.begin(), _properties.end(), - false, TD_on, - inserter(temp, temp.begin())); - result->_properties_is_on = true; - - } else if (_default_dir == TD_off) { - // In this case, the transition completely specifies what the - // attributes should be; any property not explicitly mentioned by - // the transition should be turned off. - bmap_apply(result->_properties.begin(), result->_properties.end(), - _properties.begin(), _properties.end(), - true, TD_on, - inserter(temp, temp.begin())); - result->_properties_is_on = true; - - } else { // _default_dir == TD_on - // In this case, the transition completely specifies what the - // attributes should be; any property not explicitly mentioned by - // the transition should be turned on. - bmap_apply(result->_properties.begin(), result->_properties.end(), - _properties.begin(), _properties.end(), - true, TD_off, - inserter(temp, temp.begin())); - result->_properties_is_on = false; - } - - result->_properties.swap(temp); - - return result; -} - //////////////////////////////////////////////////////////////////// // Function: MultiTransition::output // Access: Public, Virtual diff --git a/panda/src/graph/multiTransition.h b/panda/src/graph/multiTransition.h index c8d6ffae6b..bb0d76449b 100644 --- a/panda/src/graph/multiTransition.h +++ b/panda/src/graph/multiTransition.h @@ -103,7 +103,6 @@ public: 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; diff --git a/panda/src/graph/node.h b/panda/src/graph/node.h index c9c907230d..c29f2624fc 100644 --- a/panda/src/graph/node.h +++ b/panda/src/graph/node.h @@ -29,9 +29,7 @@ #include #include -class NodeAttributes; class RenderTraverser; -class AllAttributesWrapper; class AllTransitionsWrapper; class BamWriter; class BamReader; diff --git a/panda/src/graph/nodeAttribute.I b/panda/src/graph/nodeAttribute.I deleted file mode 100644 index 3927c6110b..0000000000 --- a/panda/src/graph/nodeAttribute.I +++ /dev/null @@ -1,167 +0,0 @@ -// Filename: nodeAttribute.I -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: NodeAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttribute:: -NodeAttribute() { - _priority = 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttribute:: -NodeAttribute(const NodeAttribute ©) : - TypedReferenceCount(copy), - _priority(copy._priority) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttribute:: -operator = (const NodeAttribute ©) { - TypedReferenceCount::operator = (copy); - _priority = copy._priority; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Equality Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttribute:: -operator == (const NodeAttribute &other) const { - return compare_to(other) == 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Inequality Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttribute:: -operator != (const NodeAttribute &other) const { - return compare_to(other) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Inequality Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttribute:: -operator < (const NodeAttribute &other) const { - return compare_to(other) < 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Inequality Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttribute:: -operator <= (const NodeAttribute &other) const { - return compare_to(other) <= 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Inequality Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttribute:: -operator > (const NodeAttribute &other) const { - return compare_to(other) > 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::Inequality Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttribute:: -operator >= (const NodeAttribute &other) const { - return compare_to(other) >= 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::compare_to -// Access: Public -// Description: This function works like strcmp(): it compares the -// two attributes and returns a number less than zero -// if this attribute sorts before the other one, equal -// to zero if they are equivalent, or greater than zero -// if this attribute sorts after the other one. -// -// This imposes an arbitrary sorting order across all -// attributes, whose sole purpose is to allow grouping -// of equivalent attributes together in STL structures -// like maps and sets. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH int NodeAttribute:: -compare_to(const NodeAttribute &other) const { - TypeHandle my_handle = get_handle(); - TypeHandle other_handle = other.get_handle(); - - if (my_handle == other_handle) { - return internal_compare_to(&other); - - } else { - return - (my_handle < other_handle) ? -1 : 1; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::set_priority -// Access: Public -// Description: Changes the priority associated with this attribute. -// The attribute will not be affected by transitions -// with a lower priority. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttribute:: -set_priority(int priority) { - _priority = priority; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::get_priority -// Access: Public -// Description: Returns the priority associated with this attribute. -// Normally this is of limited value; the priority is -// meaningful primarily on the transitions. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH int NodeAttribute:: -get_priority() const { - return _priority; -} - -INLINE_GRAPH ostream &operator << (ostream &out, const NodeAttribute &nab) { - nab.output(out); - return out; -} diff --git a/panda/src/graph/nodeAttribute.N b/panda/src/graph/nodeAttribute.N deleted file mode 100644 index 4efaa99498..0000000000 --- a/panda/src/graph/nodeAttribute.N +++ /dev/null @@ -1 +0,0 @@ -ignoremember get_handle diff --git a/panda/src/graph/nodeAttribute.cxx b/panda/src/graph/nodeAttribute.cxx deleted file mode 100644 index 419d97d301..0000000000 --- a/panda/src/graph/nodeAttribute.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Filename: nodeAttribute.cxx -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "nodeAttribute.h" - -#include - -TypeHandle NodeAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::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 *NodeAttribute:: -merge(const NodeAttribute *other) const { - return (NodeAttribute *)other; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttribute:: -output(ostream &out) const { - out << get_handle(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttribute:: -write(ostream &out, int indent_level) const { - indent(out, indent_level) << *this << "\n"; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void NodeAttribute:: -issue(GraphicsStateGuardianBase *) { -} diff --git a/panda/src/graph/nodeAttribute.h b/panda/src/graph/nodeAttribute.h deleted file mode 100644 index d035427537..0000000000 --- a/panda/src/graph/nodeAttribute.h +++ /dev/null @@ -1,122 +0,0 @@ -// Filename: nodeAttribute.h -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 NODEATTRIBUTE_H -#define NODEATTRIBUTE_H - -#include - -#include - -class NodeTransition; -class GraphicsStateGuardianBase; - -//////////////////////////////////////////////////////////////////// -// Class : NodeAttribute -// Description : This is an abstract class defining a single -// Attribute, a state property such as color or texture -// that may be in effect when rendering nodes of the -// scene graph. -// -// In general, the scene graph represents state by -// encoding transitions between various states on the -// arcs of the graph. The attribute values themselves -// are not explicitly stored; they are computed by -// repeated application of the transitions. -// -// A NodeTransition (defined in nodeTransition.h) -// represents a potential change from any one state (for -// instance, the initial state) to any other. For -// example, it might represent the change from the -// untextured state to rendering with a particular -// texture. -// -// Any number of Transitions may be applied along the -// arcs leading from the top of the scene graph to a -// geometry node. The Attribute state that will be in -// effect when the geometry node is rendered will be -// that computed by the consecutive application of each -// Transition encountered to the initial state. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA NodeAttribute : public TypedReferenceCount { -protected: - INLINE_GRAPH NodeAttribute(); - INLINE_GRAPH NodeAttribute(const NodeAttribute ©); - INLINE_GRAPH void operator = (const NodeAttribute ©); - -public: - INLINE_GRAPH bool operator == (const NodeAttribute &other) const; - INLINE_GRAPH bool operator != (const NodeAttribute &other) const; - INLINE_GRAPH bool operator < (const NodeAttribute &other) const; - INLINE_GRAPH bool operator <= (const NodeAttribute &other) const; - INLINE_GRAPH bool operator > (const NodeAttribute &other) const; - INLINE_GRAPH bool operator >= (const NodeAttribute &other) const; - - INLINE_GRAPH int compare_to(const NodeAttribute &other) const; - -PUBLISHED: - INLINE_GRAPH void set_priority(int priority); - INLINE_GRAPH int get_priority() const; - -public: - virtual NodeAttribute *make_copy() const=0; - virtual NodeAttribute *make_initial() const=0; - - virtual TypeHandle get_handle() const=0; - - virtual NodeAttribute *merge(const NodeAttribute *other) const; - -PUBLISHED: - virtual void output(ostream &out) const; - virtual void write(ostream &out, int indent_level = 0) const; - -public: - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual int internal_compare_to(const NodeAttribute *other) const=0; - -protected: - int _priority; - -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() { - TypedReferenceCount::init_type(); - register_type(_type_handle, "NodeAttribute", - TypedReferenceCount::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -EXPCL_PANDA INLINE_GRAPH ostream & -operator << (ostream &out, const NodeAttribute &nab); - -#ifndef DONT_INLINE_GRAPH -#include "nodeAttribute.I" -#endif - -#endif diff --git a/panda/src/graph/nodeAttributeWrapper.I b/panda/src/graph/nodeAttributeWrapper.I deleted file mode 100644 index 3fa394e4d3..0000000000 --- a/panda/src/graph/nodeAttributeWrapper.I +++ /dev/null @@ -1,127 +0,0 @@ -// Filename: nodeAttributeWrapper.I -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: NodeAttributeWrapper::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributeWrapper:: -NodeAttributeWrapper(TypeHandle handle) : _handle(handle) { - nassertv(_handle != TypeHandle::none()); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributeWrapper:: -NodeAttributeWrapper(const NodeAttributeWrapper ©) : - _handle(copy._handle), - _attrib(copy._attrib) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttributeWrapper:: -operator = (const NodeAttributeWrapper ©) { - _handle = copy._handle; - _attrib = copy._attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::get_handle -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH TypeHandle NodeAttributeWrapper:: -get_handle() const { - return _handle; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::get_attrib -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttribute *NodeAttributeWrapper:: -get_attrib() const { - return _attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::set_attrib -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttributeWrapper:: -set_attrib(NodeAttribute *attrib) { - _attrib = attrib; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::is_initial -// Access: Public -// Description: Returns true if the wrapper represents an initial -// attribute. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NodeAttributeWrapper:: -is_initial() const { - return (_attrib == (NodeAttribute *)NULL); - // || _attrib->is_initial() -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::compare_to -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH int NodeAttributeWrapper:: -compare_to(const NodeAttributeWrapper &other) const { - nassertr(_handle == other._handle, false); - if (_attrib == other._attrib) { - return 0; - } - if (_attrib == (NodeAttribute *)NULL) { - return -1; - } - if (other._attrib == (NodeAttribute *)NULL) { - return 1; - } - return _attrib->compare_to(*other._attrib); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::make_initial -// Access: Public -// Description: Resets the wrapper to the initial attribute. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttributeWrapper:: -make_initial() { - _attrib.clear(); -} - -INLINE_GRAPH ostream &operator << (ostream &out, const NodeAttributeWrapper &naw) { - naw.output(out); - return out; -} diff --git a/panda/src/graph/nodeAttributeWrapper.T b/panda/src/graph/nodeAttributeWrapper.T deleted file mode 100644 index e388a44312..0000000000 --- a/panda/src/graph/nodeAttributeWrapper.T +++ /dev/null @@ -1,41 +0,0 @@ -// Filename: nodeAttributeWrapper.T -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: get_attribute_into -// Description: This external template function is handy for -// extracting the attribute (of a known type) from the -// wrapper. If the attribute exists, it is -// automatically downcasted to the correct type and -// stored in the pointer given in the first parameter, -// and the return value is true. If the attribute does -// not exist, the pointer is filled with NULL and the -// return value is false. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH bool -get_attribute_into(Attribute *&ptr, const NodeAttributeWrapper &attrib) { - NodeAttribute *nt = attrib.get_attrib(); - if (nt == (NodeAttribute *)NULL) { - ptr = (Attribute *)NULL; - return false; - } - DCAST_INTO_R(ptr, nt, false); - return true; -} diff --git a/panda/src/graph/nodeAttributeWrapper.cxx b/panda/src/graph/nodeAttributeWrapper.cxx deleted file mode 100644 index a803eedfef..0000000000 --- a/panda/src/graph/nodeAttributeWrapper.cxx +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: nodeAttributeWrapper.cxx -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "nodeAttributeWrapper.h" -#include "nodeTransitionWrapper.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::init_from -// Access: Public, Static -// Description: This is a named constructor that creates an empty -// NodeAttributeWrapper ready to access the same type -// of NodeAttribute as the other. -//////////////////////////////////////////////////////////////////// -NodeAttributeWrapper NodeAttributeWrapper:: -init_from(const NodeTransitionWrapper &trans) { - return NodeAttributeWrapper(trans.get_handle()); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::apply_in_place -// Access: Public -// Description: Modifies the attribute by applying the transition. -//////////////////////////////////////////////////////////////////// -void NodeAttributeWrapper:: -apply_in_place(const NodeTransitionWrapper &trans) { - nassertv(_handle == trans.get_handle()); - _attrib = NodeTransitionCacheEntry::apply(_attrib, trans._entry); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttributeWrapper:: -output(ostream &out) const { - if (_attrib == (NodeAttribute *)NULL) { - out << "no " << _handle; - } else { - out << *_attrib; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributeWrapper::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttributeWrapper:: -write(ostream &out, int indent_level) const { - if (_attrib == (NodeAttribute *)NULL) { - indent(out, indent_level) << "no " << _handle << "\n"; - } else { - _attrib->write(out, indent_level); - } -} diff --git a/panda/src/graph/nodeAttributeWrapper.h b/panda/src/graph/nodeAttributeWrapper.h deleted file mode 100644 index 5166795d01..0000000000 --- a/panda/src/graph/nodeAttributeWrapper.h +++ /dev/null @@ -1,71 +0,0 @@ -// Filename: nodeAttributeWrapper.h -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 NODEATTRIBUTEWRAPPER_H -#define NODEATTRIBUTEWRAPPER_H - -#include - -#include "nodeAttribute.h" - -#include -#include - -class NodeTransitionWrapper; - -//////////////////////////////////////////////////////////////////// -// Class : NodeAttributeWrapper -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA NodeAttributeWrapper { -public: - typedef NodeTransitionWrapper TransitionWrapper; - typedef NodeAttributeWrapper AttributeWrapper; - - INLINE_GRAPH NodeAttributeWrapper(TypeHandle handle); - INLINE_GRAPH NodeAttributeWrapper(const NodeAttributeWrapper ©); - INLINE_GRAPH void operator = (const NodeAttributeWrapper ©); - static NodeAttributeWrapper init_from(const NodeTransitionWrapper &trans); - - INLINE_GRAPH TypeHandle get_handle() const; - INLINE_GRAPH NodeAttribute *get_attrib() const; - INLINE_GRAPH void set_attrib(NodeAttribute *attrib); - - INLINE_GRAPH bool is_initial() const; - INLINE_GRAPH int compare_to(const NodeAttributeWrapper &other) const; - - INLINE_GRAPH void make_initial(); - void apply_in_place(const NodeTransitionWrapper &trans); - - void output(ostream &out) const; - void write(ostream &out, int indent_level = 0) const; - -private: - TypeHandle _handle; - PT(NodeAttribute) _attrib; -}; - -EXPCL_PANDA INLINE_GRAPH ostream &operator << (ostream &out, const NodeAttributeWrapper &naw); - -#include "nodeAttributeWrapper.T" - -#ifndef DONT_INLINE_GRAPH -#include "nodeAttributeWrapper.I" -#endif - -#endif diff --git a/panda/src/graph/nodeAttributes.I b/panda/src/graph/nodeAttributes.I deleted file mode 100644 index 16ba260ed8..0000000000 --- a/panda/src/graph/nodeAttributes.I +++ /dev/null @@ -1,130 +0,0 @@ -// Filename: nodeAttributes.I -// Created by: drose (21Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: NodeAttributes::size -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::size_type NodeAttributes:: -size() const { - return _attributes.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::begin -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::iterator NodeAttributes:: -begin() { - return _attributes.begin(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::end -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::iterator NodeAttributes:: -end() { - return _attributes.end(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::begin -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::const_iterator NodeAttributes:: -begin() const { - return _attributes.begin(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::end -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::const_iterator NodeAttributes:: -end() const { - return _attributes.end(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::insert -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::iterator NodeAttributes:: -insert(NodeAttributes::iterator position, - const NodeAttributes::value_type &x) { - return _attributes.insert(position, x); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::find -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes::iterator NodeAttributes:: -find(const key_type &k) { - return _attributes.find(k); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::erase -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttributes:: -erase(NodeAttributes::iterator position) { - _attributes.erase(position); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::apply_in_place -// Access: Public -// Description: Modifies the current NodeAttributes object to reflect -// the application of the indicated transitions. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NodeAttributes:: -apply_in_place(const NodeTransitionCache &trans) { - apply_from(*this, trans); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::apply -// Access: Public -// Description: Allocates and returns a new NodeAttributes object -// that represents the application of this -// NodeAttributes to the indicated transition cache. -// This NodeAttributes object is not changed. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttributes *NodeAttributes:: -apply(const NodeTransitionCache &trans) const { - NodeAttributes *na = new NodeAttributes; - na->apply_from(*this, trans); - return na; -} - -INLINE_GRAPH ostream &operator << (ostream &out, const NodeAttributes &nas) { - nas.output(out); - return out; -} - diff --git a/panda/src/graph/nodeAttributes.N b/panda/src/graph/nodeAttributes.N deleted file mode 100644 index 30b650b6cc..0000000000 --- a/panda/src/graph/nodeAttributes.N +++ /dev/null @@ -1,2 +0,0 @@ -ignoreinvolved iterator -ignoreinvolved const_iterator diff --git a/panda/src/graph/nodeAttributes.T b/panda/src/graph/nodeAttributes.T deleted file mode 100644 index c81b2f55cb..0000000000 --- a/panda/src/graph/nodeAttributes.T +++ /dev/null @@ -1,41 +0,0 @@ -// Filename: nodeAttributes.T -// Created by: drose (21Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: get_attribute_into -// Description: This external template function is handy for -// extracting a attribute of a particular type from the -// set. If the attribute exists, it is automatically -// downcasted to the correct type and stored in the -// pointer given in the first parameter, and the return -// value is true. If the attribute does not exist, the -// pointer is filled with NULL and the return value is -// false. -//////////////////////////////////////////////////////////////////// -template -INLINE_GRAPH bool -get_attribute_into(Attribute *&ptr, const NodeAttributes &attrib, - TypeHandle transition_type) { - NodeAttribute *nt = attrib.get_attribute(transition_type); - if (nt == (NodeAttribute *)NULL) { - ptr = (Attribute *)NULL; - return false; - } - DCAST_INTO_R(ptr, nt, false); - return true; -} diff --git a/panda/src/graph/nodeAttributes.cxx b/panda/src/graph/nodeAttributes.cxx deleted file mode 100644 index 113a81efc8..0000000000 --- a/panda/src/graph/nodeAttributes.cxx +++ /dev/null @@ -1,301 +0,0 @@ -// Filename: nodeAttributes.cxx -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "nodeAttributes.h" -#include "nodeTransitionCache.h" -#include "config_graph.h" -#include "setTransitionHelpers.h" - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -NodeAttributes:: -NodeAttributes() { -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -NodeAttributes:: -NodeAttributes(const NodeAttributes ©) : - _attributes(copy._attributes) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttributes:: -operator = (const NodeAttributes ©) { - _attributes = copy._attributes; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -NodeAttributes:: -~NodeAttributes() { -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::is_empty -// Access: Public -// Description: Returns true if there are no Attributes stored in -// the set, or false if there are any (even initial) -// Attributes. -//////////////////////////////////////////////////////////////////// -bool NodeAttributes:: -is_empty() const { - return _attributes.empty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::set_attribute -// Access: Public -// Description: Stores the indicated attribute pointer in the -// NodeAttributes set, according to the indicated -// TypeHandle. Node that attributes are stored -// according to the TypeHandle of the associated -// *transition*, not of the attributes' own TypeHandle. -// Thus, there cannot be a flavor of set_attribute() -// that automatically infers the correct TypeHandle -// based on the attribute type. -// -// The NodeAttribute may be NULL indicating that the -// attribute should be cleared. If the NodeAttribute is -// not NULL, it must match the type indicated by the -// TypeHandle. -// -// The return value is a pointer to the *previous* -// attribute in the set, if any, or NULL if there was -// none. -//////////////////////////////////////////////////////////////////// -PT(NodeAttribute) NodeAttributes:: -set_attribute(TypeHandle handle, NodeAttribute *attrib) { - if (attrib == (NodeAttribute *)NULL) { - return clear_attribute(handle); - - } else { - Attributes::iterator ti; - ti = _attributes.find(handle); - if (ti != _attributes.end()) { - PT(NodeAttribute) result = (*ti).second; - (*ti).second = attrib; - return result; - } - - _attributes.insert(Attributes::value_type(handle, attrib)); - return NULL; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::clear_attribute -// Access: Public -// Description: Removes any attribute associated with the indicated -// handle from the set. -// -// The return value is a pointer to the previous -// attribute in the set, if any, or NULL if there was -// none. -//////////////////////////////////////////////////////////////////// -PT(NodeAttribute) NodeAttributes:: -clear_attribute(TypeHandle handle) { - nassertr(handle != TypeHandle::none(), NULL); - - Attributes::iterator ti; - ti = _attributes.find(handle); - if (ti != _attributes.end()) { - PT(NodeAttribute) result = (*ti).second; - _attributes.erase(ti); - return result; - } - - return NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::has_attribute -// Access: Public -// Description: Returns true if ab attribute associated with the -// indicated handle has been stored in the set (even if -// it is the initial attribute), or false otherwise. -//////////////////////////////////////////////////////////////////// -bool NodeAttributes:: -has_attribute(TypeHandle handle) const { - nassertr(handle != TypeHandle::none(), false); - return _attributes.count(handle) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::get_attribute -// Access: Public -// Description: Returns the attribute associated with the indicated -// handle, or NULL if no such attribute has been stored -// in the set. -//////////////////////////////////////////////////////////////////// -NodeAttribute *NodeAttributes:: -get_attribute(TypeHandle handle) const { - nassertr(handle != TypeHandle::none(), NULL); - Attributes::const_iterator ai; - ai = _attributes.find(handle); - if (ai != _attributes.end()) { - return (*ai).second; - } - return NULL; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::clear -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttributes:: -clear() { - _attributes.clear(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::is_initial -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -bool NodeAttributes:: -is_initial() const { - Attributes::const_iterator ai; - for (ai = _attributes.begin(); ai != _attributes.end(); ++ai) { - if ((*ai).second != (NodeAttribute *)NULL) { - // && !(*ai).second->is_initial() - return false; - } - } - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::compare_to -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -int NodeAttributes:: -compare_to(const NodeAttributes &other) const { - return tmap_compare_attr(_attributes.begin(), _attributes.end(), - other._attributes.begin(), other._attributes.end()); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::apply_from -// Access: Public -// Description: Modifies the current NodeAttributes object to reflect -// the application of the indicated NodeAttributes and -// the indicated transitions. The "other" -// NodeAttributes object may be the same as this. -//////////////////////////////////////////////////////////////////// -void NodeAttributes:: -apply_from(const NodeAttributes &other, const NodeTransitionCache &trans) { - if (&other == this && trans._cache.empty()) { - // In this case, we don't need to do anything--we're not updating - // the attributes at all. - - } else { - // Otherwise, even if the cache is empty, we do need to at least - // copy the other attributes, so we go ahead and do this work. - Attributes temp; - - tmap_apply(other._attributes.begin(), other._attributes.end(), - trans._cache.begin(), trans._cache.end(), - inserter(temp, temp.begin())); - - _attributes.swap(temp); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::merge_from -// Access: Public -// Description: Computes the union of the two NodeAttributes sets and -// stores the result in this object (which may be the -// same object as either of the two sources). If a -// given attribute is set in both sources (and cannot be -// union sensibly), the one from the second source -// overrides. -//////////////////////////////////////////////////////////////////// -void NodeAttributes:: -merge_from(const NodeAttributes &a, const NodeAttributes &b) { - if (&a == this && b.is_empty()) { - // Trivial do-nothing case. - - } else if (&b == this && a.is_empty()) { - // Trivial do-nothing case. - - } else { - Attributes temp; - - tmap_merge_union(a._attributes.begin(), a._attributes.end(), - b._attributes.begin(), b._attributes.end(), - inserter(temp, temp.begin())); - - _attributes.swap(temp); - } -} - - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::output -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttributes:: -output(ostream &out) const { - bool written_any = false; - - Attributes::const_iterator ai; - for (ai = _attributes.begin(); ai != _attributes.end(); ++ai) { - if ((*ai).second != (NodeAttribute *)NULL) { - if (written_any) { - out << " "; - } - out << *(*ai).second; - written_any = true; - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeAttributes::write -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void NodeAttributes:: -write(ostream &out, int indent_level) const { - Attributes::const_iterator ai; - for (ai = _attributes.begin(); ai != _attributes.end(); ++ai) { - if ((*ai).second != (NodeAttribute *)NULL) { - (*ai).second->write(out, indent_level); - } - } -} diff --git a/panda/src/graph/nodeAttributes.h b/panda/src/graph/nodeAttributes.h deleted file mode 100644 index 8228addd24..0000000000 --- a/panda/src/graph/nodeAttributes.h +++ /dev/null @@ -1,106 +0,0 @@ -// Filename: nodeAttributes.h -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 NODEATTRIBUTES_H -#define NODEATTRIBUTES_H - -#include - -#include "nodeAttribute.h" - -#include - -#include "pmap.h" - -class NodeTransitionCache; - -//////////////////////////////////////////////////////////////////// -// Class : NodeAttributes -// Description : This represents a set of zero or more NodeAttribute -// pointers, organized by the attributes' get_handle() -// value. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA NodeAttributes { -PUBLISHED: - NodeAttributes(); - -public: - NodeAttributes(const NodeAttributes ©); - void operator = (const NodeAttributes ©); - ~NodeAttributes(); - -PUBLISHED: - bool is_empty() const; - PT(NodeAttribute) set_attribute(TypeHandle handle, NodeAttribute *attrib); - PT(NodeAttribute) clear_attribute(TypeHandle handle); - bool has_attribute(TypeHandle handle) const; - NodeAttribute *get_attribute(TypeHandle handle) const; - - void clear(); - - bool is_initial() const; - int compare_to(const NodeAttributes &other) const; - -private: - typedef pmap< TypeHandle, PT(NodeAttribute) > Attributes; -public: - // STL-like definitions to expose the map within NodeAttributes to - // external adjustment. Beware! These are not safe to use outside - // of PANDA.DLL. - typedef Attributes::iterator iterator; - typedef Attributes::const_iterator const_iterator; - typedef Attributes::key_type key_type; - typedef Attributes::value_type value_type; - typedef Attributes::size_type size_type; - - INLINE_GRAPH size_type size() const; - INLINE_GRAPH iterator begin(); - INLINE_GRAPH iterator end(); - INLINE_GRAPH const_iterator begin() const; - INLINE_GRAPH const_iterator end() const; - INLINE_GRAPH iterator insert(iterator position, const value_type &x); - INLINE_GRAPH iterator find(const key_type &k); - INLINE_GRAPH void erase(iterator position); - -public: - INLINE_GRAPH void apply_in_place(const NodeTransitionCache &trans); - INLINE_GRAPH NodeAttributes *apply(const NodeTransitionCache &trans) const; - void apply_from(const NodeAttributes &other, - const NodeTransitionCache &trans); - - void merge_from(const NodeAttributes &a, const NodeAttributes &b); - -PUBLISHED: - void output(ostream &out) const; - void write(ostream &out, int indent_level = 0) const; - -private: - Attributes _attributes; - friend class NodeAttributeCache; -}; - -INLINE_GRAPH ostream &operator << (ostream &out, const NodeAttributes &nas); - -#include "nodeAttributes.T" - -#ifndef DONT_INLINE_GRAPH -#include "nodeAttributes.I" -#endif - -#endif - diff --git a/panda/src/graph/nodeTransition.h b/panda/src/graph/nodeTransition.h index e4af4ee963..9bb3d693e8 100644 --- a/panda/src/graph/nodeTransition.h +++ b/panda/src/graph/nodeTransition.h @@ -26,12 +26,9 @@ #include class Node; -class NodeAttribute; -class NodeAttributes; class NodeTransitions; class NodeRelation; class RenderTraverser; -class AllAttributesWrapper; class AllTransitionsWrapper; class BamWriter; class BamReader; @@ -46,9 +43,18 @@ class GraphicsStateGuardianBase; // request that is stored on the arcs of the scene // graph. // -// See the comments at the beginning of NodeAttribute -// for a fuller description of the purpose of this -// class. +// In general, the scene graph represents state by +// encoding transitions between various states on the +// arcs of the graph. The state of a particular node is +// determined by the composition of all the transitions +// on arcs between that node and the root. +// +// A NodeTransition represents a particular state, or a +// change from any one state to another. For example, +// it might represent the change from the untextured +// state to rendering with a particular texture, which +// can also be thought of as representing the state of +// rendering with that texture. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA NodeTransition : public TypedWritableReferenceCount { protected: @@ -75,14 +81,12 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const=0; - virtual NodeAttribute *make_attrib() const=0; virtual NodeTransition *make_initial() const; virtual TypeHandle get_handle() const; virtual NodeTransition *compose(const NodeTransition *other) const=0; virtual NodeTransition *invert() const=0; - virtual NodeAttribute *apply(const NodeAttribute *attrib) const=0; virtual bool sub_render(NodeRelation *arc, const AllTransitionsWrapper &input_trans, diff --git a/panda/src/graph/nodeTransitionCache.cxx b/panda/src/graph/nodeTransitionCache.cxx index 03da7375e7..27b2f4a3ef 100644 --- a/panda/src/graph/nodeTransitionCache.cxx +++ b/panda/src/graph/nodeTransitionCache.cxx @@ -35,6 +35,28 @@ NodeTransitionCache() { MemoryUsage::update_type(this, get_class_type()); } +//////////////////////////////////////////////////////////////////// +// Function: NodeTransitionCache::Copy Constructor +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +NodeTransitionCache:: +NodeTransitionCache(const NodeTransitionCache ©) : + _cache(copy._cache) +{ + MemoryUsage::update_type(this, get_class_type()); +} + +//////////////////////////////////////////////////////////////////// +// Function: NodeTransitionCache::Copy Assignment Operator +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +void NodeTransitionCache:: +operator = (const NodeTransitionCache ©) { + _cache = copy._cache; +} + //////////////////////////////////////////////////////////////////// // Function: NodeTransitionCache::Constructor from NodeTransitions // Access: Public diff --git a/panda/src/graph/nodeTransitionCache.h b/panda/src/graph/nodeTransitionCache.h index e6bb21410e..b26ec32b74 100644 --- a/panda/src/graph/nodeTransitionCache.h +++ b/panda/src/graph/nodeTransitionCache.h @@ -39,6 +39,8 @@ public: typedef GraphHashGenerator HashGenerator; NodeTransitionCache(); + NodeTransitionCache(const NodeTransitionCache ©); + void operator = (const NodeTransitionCache ©); NodeTransitionCache(const NodeTransitions &nt); ~NodeTransitionCache(); @@ -127,8 +129,6 @@ public: private: static TypeHandle _type_handle; - - friend class NodeAttributes; }; INLINE_GRAPH ostream &operator << (ostream &out, const NodeTransitionCache &ntc); diff --git a/panda/src/graph/nodeTransitionCacheEntry.I b/panda/src/graph/nodeTransitionCacheEntry.I index 14cb648e4f..b42a9aabb4 100644 --- a/panda/src/graph/nodeTransitionCacheEntry.I +++ b/panda/src/graph/nodeTransitionCacheEntry.I @@ -354,35 +354,6 @@ cached_compose(const NodeTransitionCacheEntry &a, } } -//////////////////////////////////////////////////////////////////// -// Function: NodeTransitionCacheEntry::apply -// Access: Public, Static -// Description: Returns a new NodeAttribute (or possibly the same -// NodeAttribute) that represents the indicated -// transition applied to the attribute. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttribute *NodeTransitionCacheEntry:: -apply(const NodeAttribute *a, const NodeTransitionCacheEntry &b) { - if (b.is_identity()) { - return (NodeAttribute *)a; - } - - return b._trans->apply(a); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodeTransitionCacheEntry::make_attrib -// Access: Public, Static -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NodeAttribute *NodeTransitionCacheEntry:: -make_attrib() const { - if (_trans == (NodeTransition *)NULL) { - return NULL; - } - return _trans->make_attrib(); -} - INLINE_GRAPH ostream &operator << (ostream &out, const NodeTransitionCacheEntry &e) { e.output(out); return out; diff --git a/panda/src/graph/nodeTransitionCacheEntry.h b/panda/src/graph/nodeTransitionCacheEntry.h index be1c5d5b90..c12e63d8d8 100644 --- a/panda/src/graph/nodeTransitionCacheEntry.h +++ b/panda/src/graph/nodeTransitionCacheEntry.h @@ -85,11 +85,6 @@ public: const NodeTransitionCacheEntry &b, UpdateSeq now); - INLINE_GRAPH static NodeAttribute * - apply(const NodeAttribute *a, const NodeTransitionCacheEntry &b); - - INLINE_GRAPH NodeAttribute *make_attrib() const; - public: void output(ostream &out) const; void write(ostream &out, int indent_level = 0) const; diff --git a/panda/src/graph/nodeTransitionWrapper.cxx b/panda/src/graph/nodeTransitionWrapper.cxx index 28ef76c466..9b5c4d50cd 100644 --- a/panda/src/graph/nodeTransitionWrapper.cxx +++ b/panda/src/graph/nodeTransitionWrapper.cxx @@ -17,23 +17,10 @@ //////////////////////////////////////////////////////////////////// #include "nodeTransitionWrapper.h" -#include "nodeAttributeWrapper.h" #include "nodeRelation.h" #include -//////////////////////////////////////////////////////////////////// -// Function: NodeTransitionWrapper::init_from -// Access: Public, Static -// Description: This is a named constructor that creates an empty -// NodeTransitionWrapper ready to access the same type -// of NodeTransition as the other. -//////////////////////////////////////////////////////////////////// -NodeTransitionWrapper NodeTransitionWrapper:: -init_from(const NodeAttributeWrapper &attrib) { - return NodeTransitionWrapper(attrib.get_handle()); -} - //////////////////////////////////////////////////////////////////// // Function: NodeTransitionWrapper::output // Access: Public, Virtual diff --git a/panda/src/graph/nodeTransitionWrapper.h b/panda/src/graph/nodeTransitionWrapper.h index 37333bb4c5..f6b2fae922 100644 --- a/panda/src/graph/nodeTransitionWrapper.h +++ b/panda/src/graph/nodeTransitionWrapper.h @@ -20,9 +20,8 @@ #define NODETRANSITIONWRAPPER_H // -// There are several flavors of TransitionWrappers (and their -// corresponding AttributeWrappers). These are classes that represent -// one or a number of transitions (or attributes) simultaneously and +// There are several flavors of TransitionWrappers. These are classes +// that represent one or a number of transitions simultaneously and // are passed to template functions like df_traverse() and wrt() so // that the same functions can be used to operate on either one // transition type or a number of them. @@ -39,8 +38,6 @@ class Node; class NodeRelation; -class NodeAttribute; -class NodeAttributeWrapper; //////////////////////////////////////////////////////////////////// // Class : NodeTransitionWrapper @@ -52,7 +49,6 @@ class NodeAttributeWrapper; class EXPCL_PANDA NodeTransitionWrapper { public: typedef NodeTransitionWrapper TransitionWrapper; - typedef NodeAttributeWrapper AttributeWrapper; INLINE_GRAPH NodeTransitionWrapper(TypeHandle handle); INLINE_GRAPH NodeTransitionWrapper(const NodeTransitionWrapper ©); @@ -60,7 +56,6 @@ public: INLINE_GRAPH static NodeTransitionWrapper init_from(const NodeTransitionWrapper &other); - static NodeTransitionWrapper init_from(const NodeAttributeWrapper &attrib); INLINE_GRAPH TypeHandle get_handle() const; INLINE_GRAPH bool has_trans() const; @@ -93,7 +88,6 @@ public: private: TypeHandle _handle; NodeTransitionCacheEntry _entry; - friend class NodeAttributeWrapper; }; EXPCL_PANDA INLINE_GRAPH ostream &operator << (ostream &out, const NodeTransitionWrapper &ntw); diff --git a/panda/src/graph/nullAttributeWrapper.I b/panda/src/graph/nullAttributeWrapper.I deleted file mode 100644 index cfdf4fdaf8..0000000000 --- a/panda/src/graph/nullAttributeWrapper.I +++ /dev/null @@ -1,116 +0,0 @@ -// Filename: nullAttributeWrapper.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: NullAttributeWrapper::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NullAttributeWrapper:: -NullAttributeWrapper() { -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NullAttributeWrapper:: -NullAttributeWrapper(const NullAttributeWrapper &) { -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NullAttributeWrapper:: -operator = (const NullAttributeWrapper &) { -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::init_from -// Access: Public, Static -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NullAttributeWrapper NullAttributeWrapper:: -init_from(const NullTransitionWrapper &) { - return NullAttributeWrapper(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::is_initial -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool NullAttributeWrapper:: -is_initial() const { - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::compare_to -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH int NullAttributeWrapper:: -compare_to(const NullAttributeWrapper &) const { - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::make_initial -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NullAttributeWrapper:: -make_initial() { -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::apply_in_place -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NullAttributeWrapper:: -apply_in_place(const NullTransitionWrapper &) { -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NullAttributeWrapper:: -output(ostream &) const { -} - -//////////////////////////////////////////////////////////////////// -// Function: NullAttributeWrapper::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void NullAttributeWrapper:: -write(ostream &, int) const { -} - -INLINE_GRAPH ostream &operator << (ostream &out, const NullAttributeWrapper &naw) { - naw.output(out); - return out; -} - diff --git a/panda/src/graph/nullAttributeWrapper.cxx b/panda/src/graph/nullAttributeWrapper.cxx deleted file mode 100644 index 7eac7e5773..0000000000 --- a/panda/src/graph/nullAttributeWrapper.cxx +++ /dev/null @@ -1,19 +0,0 @@ -// Filename: nullAttributeWrapper.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "nullAttributeWrapper.h" diff --git a/panda/src/graph/nullAttributeWrapper.h b/panda/src/graph/nullAttributeWrapper.h deleted file mode 100644 index 219f06dcd5..0000000000 --- a/panda/src/graph/nullAttributeWrapper.h +++ /dev/null @@ -1,62 +0,0 @@ -// Filename: nullAttributeWrapper.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 NULLATTRIBUTEWRAPPER_H -#define NULLATTRIBUTEWRAPPER_H - -#include - -#include "nodeAttribute.h" - -#include -#include - -class NullTransitionWrapper; - -//////////////////////////////////////////////////////////////////// -// Class : NullAttributeWrapper -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA NullAttributeWrapper { -public: - typedef NullTransitionWrapper TransitionWrapper; - typedef NullAttributeWrapper AttributeWrapper; - - INLINE_GRAPH NullAttributeWrapper(); - INLINE_GRAPH NullAttributeWrapper(const NullAttributeWrapper ©); - INLINE_GRAPH void operator = (const NullAttributeWrapper ©); - INLINE_GRAPH static NullAttributeWrapper - init_from(const NullTransitionWrapper &trans); - - INLINE_GRAPH bool is_initial() const; - INLINE_GRAPH int compare_to(const NullAttributeWrapper &other) const; - - INLINE_GRAPH void make_initial(); - INLINE_GRAPH void apply_in_place(const NullTransitionWrapper &trans); - - INLINE_GRAPH void output(ostream &out) const; - INLINE_GRAPH void write(ostream &out, int indent_level = 0) const; -}; - -INLINE_GRAPH ostream &operator << (ostream &out, const NullAttributeWrapper &naw); - -#ifndef DONT_INLINE_GRAPH -#include "nullAttributeWrapper.I" -#endif - -#endif diff --git a/panda/src/graph/nullTransitionWrapper.I b/panda/src/graph/nullTransitionWrapper.I index a1ce5c95a8..8a80725437 100644 --- a/panda/src/graph/nullTransitionWrapper.I +++ b/panda/src/graph/nullTransitionWrapper.I @@ -56,16 +56,6 @@ init_from(const NullTransitionWrapper &) { return NullTransitionWrapper(); } -//////////////////////////////////////////////////////////////////// -// Function: NullTransitionWrapper::init_from -// Access: Public, Static -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH NullTransitionWrapper NullTransitionWrapper:: -init_from(const NullAttributeWrapper &) { - return NullTransitionWrapper(); -} - //////////////////////////////////////////////////////////////////// // Function: NullTransitionWrapper::is_identity // Access: Public diff --git a/panda/src/graph/nullTransitionWrapper.h b/panda/src/graph/nullTransitionWrapper.h index 848bf6d91f..9088e55895 100644 --- a/panda/src/graph/nullTransitionWrapper.h +++ b/panda/src/graph/nullTransitionWrapper.h @@ -20,9 +20,8 @@ #define NULLTRANSITIONWRAPPER_H // -// There are several flavors of TransitionWrappers (and their -// corresponding AttributeWrappers). These are classes that represent -// one or a number of transitions (or attributes) simultaneously and +// There are several flavors of TransitionWrappers. These are classes +// that represent one or a number of transitions simultaneously and // are passed to template functions like df_traverse() and wrt() so // that the same functions can be used to operate on either one // transition type or a number of them. @@ -39,8 +38,6 @@ class Node; class NodeRelation; -class NodeAttribute; -class NullAttributeWrapper; //////////////////////////////////////////////////////////////////// // Class : NullTransitionWrapper @@ -53,7 +50,6 @@ class NullAttributeWrapper; class EXPCL_PANDA NullTransitionWrapper { public: typedef NullTransitionWrapper TransitionWrapper; - typedef NullAttributeWrapper AttributeWrapper; INLINE_GRAPH NullTransitionWrapper(); INLINE_GRAPH NullTransitionWrapper(const NullTransitionWrapper ©); @@ -61,8 +57,6 @@ public: INLINE_GRAPH static NullTransitionWrapper init_from(const NullTransitionWrapper &other); - INLINE_GRAPH static NullTransitionWrapper - init_from(const NullAttributeWrapper &attrib); INLINE_GRAPH bool is_identity() const; INLINE_GRAPH int compare_to(const NullTransitionWrapper &other) const; diff --git a/panda/src/graph/onAttribute.cxx b/panda/src/graph/onAttribute.cxx deleted file mode 100644 index b057ca5dd2..0000000000 --- a/panda/src/graph/onAttribute.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Filename: onAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "onAttribute.h" -#include "onTransition.h" - -#include - -TypeHandle OnAttribute::_type_handle; - - -//////////////////////////////////////////////////////////////////// -// Function: OnAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void OnAttribute:: -output(ostream &out) const { - output_value(out); -} - -//////////////////////////////////////////////////////////////////// -// Function: OnAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void OnAttribute:: -write(ostream &out, int indent_level) const { - write_value(out, indent_level); -} - -//////////////////////////////////////////////////////////////////// -// Function: OnAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: Returns a number < 0 if this attribute sorts before -// the other attribute, > 0 if it sorts after, 0 if -// they are equivalent (except for priority). -//////////////////////////////////////////////////////////////////// -int OnAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const OnAttribute *ot; - DCAST_INTO_R(ot, other, false); - - return compare_values(ot); -} diff --git a/panda/src/graph/onAttribute.h b/panda/src/graph/onAttribute.h deleted file mode 100644 index 9ff8d91378..0000000000 --- a/panda/src/graph/onAttribute.h +++ /dev/null @@ -1,69 +0,0 @@ -// Filename: onAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 ONATTRIBUTE_H -#define ONATTRIBUTE_H - -#include - -#include "nodeAttribute.h" - -class OnTransition; - -//////////////////////////////////////////////////////////////////// -// Class : OnAttribute -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA OnAttribute : public NodeAttribute { -protected: - INLINE_GRAPH OnAttribute() {}; - INLINE_GRAPH OnAttribute(const OnAttribute ©) : NodeAttribute(copy) {}; - INLINE_GRAPH void operator = (const OnAttribute ©) {NodeAttribute::operator = (copy);}; - -public: - 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; - - virtual void set_value_from(const OnTransition *other)=0; - virtual int compare_values(const OnAttribute *other) const=0; - virtual void output_value(ostream &out) const=0; - virtual void write_value(ostream &out, int indent_level) const=0; - -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, "OnAttribute", - NodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; - friend class OnTransition; -}; - -#endif diff --git a/panda/src/graph/onOffAttribute.I b/panda/src/graph/onOffAttribute.I deleted file mode 100644 index bf11f10f79..0000000000 --- a/panda/src/graph/onOffAttribute.I +++ /dev/null @@ -1,102 +0,0 @@ -// Filename: onOffAttribute.I -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: OnOffAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH OnOffAttribute:: -OnOffAttribute(bool is_on) { - _is_on = is_on; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::Copy Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH OnOffAttribute:: -OnOffAttribute(const OnOffAttribute ©) : - NodeAttribute(copy), - _is_on(copy._is_on) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::Copy Assignment Operator -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void OnOffAttribute:: -operator = (const OnOffAttribute ©) { - NodeAttribute::operator = (copy); - _is_on = copy._is_on; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::set_on -// Access: Public -// Description: Changes the attribute to an 'on' attribute; -// this turns on the attribute for all nodes at this -// point and below. However, this particular function -// does not change the attribute value itself, and is -// thus only appropriate for derived attribute types -// that do not actually carry an attribute value. -// Derived types that *do* have an attribute value -// should override this function to accept a value -// parameter of the appropriate type. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void OnOffAttribute:: -set_on() { - _is_on = true; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::set_off -// Access: Public -// Description: Changes the attribute to an 'off' attribute; this -// turns off the attribute for all nodes at this point -// and below. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH void OnOffAttribute:: -set_off() { - _is_on = false; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::is_on -// Access: Public -// Description: Returns true if the attribute is on, false if it is -// not. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool OnOffAttribute:: -is_on() const { - return _is_on; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::is_off -// Access: Public -// Description: Returns true if the attribute is off, false if it is -// not. -//////////////////////////////////////////////////////////////////// -INLINE_GRAPH bool OnOffAttribute:: -is_off() const { - return !_is_on; -} diff --git a/panda/src/graph/onOffAttribute.cxx b/panda/src/graph/onOffAttribute.cxx deleted file mode 100644 index 7e5dccb100..0000000000 --- a/panda/src/graph/onOffAttribute.cxx +++ /dev/null @@ -1,118 +0,0 @@ -// Filename: onOffAttribute.cxx -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "onOffAttribute.h" -#include "onOffTransition.h" - -#include - -TypeHandle OnOffAttribute::_type_handle; - - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::output -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void OnOffAttribute:: -output(ostream &out) const { - if (_is_on) { - out << "on-" << get_handle() << ":"; - output_value(out); - } else { - out << "off-" << get_handle(); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::write -// Access: Public, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -void OnOffAttribute:: -write(ostream &out, int indent_level) const { - if (_is_on) { - indent(out, indent_level) << "on-" << get_handle() << ":\n"; - write_value(out, indent_level + 2); - } else { - indent(out, indent_level) << "off-" << get_handle() << "\n"; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::internal_compare_to -// Access: Protected, Virtual -// Description: Returns a number < 0 if this attribute sorts before -// the other attribute, > 0 if it sorts after, 0 if -// they are equivalent (except for priority). -//////////////////////////////////////////////////////////////////// -int OnOffAttribute:: -internal_compare_to(const NodeAttribute *other) const { - const OnOffAttribute *ot; - DCAST_INTO_R(ot, other, false); - - if (_is_on != ot->_is_on) { - return (_is_on < ot->_is_on) ? -1 : 1; - } - if (_is_on) { - return compare_values(ot); - } - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::set_value_from -// Access: Protected, Virtual -// Description: Assigns the value from the corresponding value of the -// other attribute, which is assumed to be of an -// equivalent type. -//////////////////////////////////////////////////////////////////// -void OnOffAttribute:: -set_value_from(const OnOffTransition *) { -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::is_value_equivalent -// Access: Protected, Virtual -// Description: Returns 0 if the two transitions share the same -// value, or < 0 or > 0 otherwise. It is given that -// they are of equivalent types and that they are both -// "on" transitions. -//////////////////////////////////////////////////////////////////// -int OnOffAttribute:: -compare_values(const OnOffAttribute *) const { - return 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::output_value -// Access: Protected, Virtual -// Description: Outputs the value on one line. -//////////////////////////////////////////////////////////////////// -void OnOffAttribute:: -output_value(ostream &) const { -} - -//////////////////////////////////////////////////////////////////// -// Function: OnOffAttribute::write_value -// Access: Protected, Virtual -// Description: Outputs the value on multiple lines. -//////////////////////////////////////////////////////////////////// -void OnOffAttribute:: -write_value(ostream &, int) const { -} diff --git a/panda/src/graph/onOffAttribute.h b/panda/src/graph/onOffAttribute.h deleted file mode 100644 index 08371ea3d7..0000000000 --- a/panda/src/graph/onOffAttribute.h +++ /dev/null @@ -1,83 +0,0 @@ -// Filename: onOffAttribute.h -// Created by: drose (20Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 ONOFFATTRIBUTE_H -#define ONOFFATTRIBUTE_H - -#include - -#include "nodeAttribute.h" - -class OnOffTransition; - -//////////////////////////////////////////////////////////////////// -// Class : OnOffAttribute -// Description : -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA OnOffAttribute : public NodeAttribute { -protected: - INLINE_GRAPH OnOffAttribute(bool is_on = false); - INLINE_GRAPH OnOffAttribute(const OnOffAttribute ©); - INLINE_GRAPH void operator = (const OnOffAttribute ©); - -PUBLISHED: - INLINE_GRAPH void set_on(); - INLINE_GRAPH void set_off(); - - INLINE_GRAPH bool is_on() const; - INLINE_GRAPH bool is_off() const; - -public: - 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; - - 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; - -private: - bool _is_on; - -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, "OnOffAttribute", - NodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -friend class OnOffTransition; -}; - -#ifndef DONT_INLINE_GRAPH -#include "onOffAttribute.I" -#endif - -#endif diff --git a/panda/src/graph/onOffTransition.cxx b/panda/src/graph/onOffTransition.cxx index 5612b7fcd1..9e87df01dd 100644 --- a/panda/src/graph/onOffTransition.cxx +++ b/panda/src/graph/onOffTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "onOffTransition.h" -#include "onOffAttribute.h" #include #include @@ -84,51 +83,6 @@ invert() const { return NULL; } -//////////////////////////////////////////////////////////////////// -// Function: OnOffTransition::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. -//////////////////////////////////////////////////////////////////// -NodeAttribute *OnOffTransition:: -apply(const NodeAttribute *attrib) const { - if (_direction == TD_identity) { - // The transition is identity; it has no effect. - return (NodeAttribute *)attrib; - } - - OnOffAttribute *result; - if (attrib == (const NodeAttribute *)NULL) { - DCAST_INTO_R(result, make_attrib(), NULL); - } else { - DCAST_INTO_R(result, (NodeAttribute *)attrib, NULL); - } - - if (_priority < result->_priority || _direction == TD_identity) { - // The priority is too low to affect the attribute, or the - // transition is identity. - return result; - } - - if (result->get_ref_count() > 1) { - // Copy on write. - DCAST_INTO_R(result, result->make_copy(), NULL); - } - - result->_priority = _priority; - - if (_direction == TD_on) { - result->_is_on = true; - result->set_value_from(this); - } else { - result->_is_on = false; - } - return result; -} - //////////////////////////////////////////////////////////////////// // Function: OnOffTransition::output // Access: Public, Virtual diff --git a/panda/src/graph/onOffTransition.h b/panda/src/graph/onOffTransition.h index e7dce32952..5a6278d98b 100644 --- a/panda/src/graph/onOffTransition.h +++ b/panda/src/graph/onOffTransition.h @@ -24,7 +24,6 @@ #include "nodeTransition.h" #include "transitionDirection.h" -class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// @@ -65,7 +64,6 @@ PUBLISHED: public: 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; @@ -105,7 +103,6 @@ public: private: static TypeHandle _type_handle; - friend class OnOffAttribute; }; #ifndef DONT_INLINE_GRAPH diff --git a/panda/src/graph/onTransition.cxx b/panda/src/graph/onTransition.cxx index 28604142cd..e11fc748e8 100644 --- a/panda/src/graph/onTransition.cxx +++ b/panda/src/graph/onTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "onTransition.h" -#include "onAttribute.h" #include @@ -64,39 +63,6 @@ invert() const { return NULL; } -//////////////////////////////////////////////////////////////////// -// Function: OnTransition::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. -//////////////////////////////////////////////////////////////////// -NodeAttribute *OnTransition:: -apply(const NodeAttribute *attrib) const { - OnAttribute *result; - if (attrib == (const NodeAttribute *)NULL) { - DCAST_INTO_R(result, make_attrib(), NULL); - } else { - DCAST_INTO_R(result, (NodeAttribute *)attrib, NULL); - } - - if (_priority < result->_priority) { - // The priority is too low to affect the attribute. - return result; - } - - if (result->get_ref_count() > 1) { - // Copy on write. - DCAST_INTO_R(result, result->make_copy(), NULL); - } - - result->_priority = _priority; - result->set_value_from(this); - return result; -} - //////////////////////////////////////////////////////////////////// // Function: OnTransition::output // Access: Public, Virtual diff --git a/panda/src/graph/onTransition.h b/panda/src/graph/onTransition.h index 1f623fe214..6b030b26df 100644 --- a/panda/src/graph/onTransition.h +++ b/panda/src/graph/onTransition.h @@ -23,7 +23,6 @@ #include "nodeTransition.h" -class NodeAttribute; class NodeRelation; //////////////////////////////////////////////////////////////////// @@ -49,7 +48,6 @@ protected: public: 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; @@ -85,7 +83,6 @@ public: private: static TypeHandle _type_handle; - friend class OnAttribute; }; #ifndef DONT_INLINE_GRAPH diff --git a/panda/src/graph/setTransitionHelpers.T b/panda/src/graph/setTransitionHelpers.T index ec3e9c59ca..e1111bbfc2 100644 --- a/panda/src/graph/setTransitionHelpers.T +++ b/panda/src/graph/setTransitionHelpers.T @@ -51,7 +51,7 @@ tmap_get_interest(InputIterator1 first1, InputIterator1 last1, //////////////////////////////////////////////////////////////////// // Function: tmap_override_union -// Description: Accepts two NodeTransition or NodeAttribute maps, and +// Description: Accepts two NodeTransition maps, and // builds a new map which is the union of the first two. // If an element appears in both maps, the entry from // the second is preferred. @@ -92,50 +92,6 @@ tmap_override_union(InputIterator1 first1, InputIterator1 last1, return result; } -//////////////////////////////////////////////////////////////////// -// Function: tmap_merge_union -// Description: Accepts two NodeAttribute maps, and builds a new map -// which is the union of the first two. If an element -// appears in both maps, the two are merged, preferring -// the second. -//////////////////////////////////////////////////////////////////// -template -OutputIterator -tmap_merge_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) { - if ((*first1).first < (*first2).first) { - *result = *first1; - ++first1; - ++result; - } else if ((*first2).first < (*first1).first) { - *result = *first2; - ++first2; - ++result; - } else { - PT(NodeAttribute) c = (*first1).second->merge((*first2).second); - *result = pair((*first1).first, c); - ++first1; - ++first2; - ++result; - } - } - - while (first1 != last1) { - *result = *first1; - ++first1; - ++result; - } - - while (first2 != last2) { - *result = *first2; - ++first2; - ++result; - } - return result; -} - //////////////////////////////////////////////////////////////////// // Function: tmap_arc_union // Description: As above, but updates the transitions on the way to @@ -716,55 +672,6 @@ tmap_cached_compose(InputIterator1 first1, InputIterator1 last1, } -//////////////////////////////////////////////////////////////////// -// Function: tmap_apply -// Description: Accepts a NodeAttribute map and a NodeTransition map, -// and builds a new list (a NodeAttribute map) which -// represents the memberwise application of the two -// input maps. -//////////////////////////////////////////////////////////////////// -template -OutputIterator -tmap_apply(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result) { - while (first1 != last1 && first2 != last2) { - if ((*first1).first < (*first2).first) { - *result = *first1; - ++first1; - ++result; - } else if ((*first2).first < (*first1).first) { - *result = pair - ((*first2).first, - NodeTransitionCacheEntry::apply(NULL, (*first2).second)); - ++first2; - ++result; - } else { - *result = pair - ((*first1).first, - NodeTransitionCacheEntry::apply((*first1).second, (*first2).second)); - ++first1; - ++first2; - ++result; - } - } - - while (first1 != last1) { - *result = *first1; - ++first1; - ++result; - } - - while (first2 != last2) { - *result = pair - ((*first2).first, - NodeTransitionCacheEntry::apply(NULL, (*first2).second)); - ++first2; - ++result; - } - return result; -} - //////////////////////////////////////////////////////////////////// // Function: tmap_invert @@ -836,58 +743,6 @@ tmap_equiv_trans(InputIterator1 first1, InputIterator1 last1, } -//////////////////////////////////////////////////////////////////// -// Function: tmap_equiv_attr -// Description: Accepts a pair of NodeAttribute maps, and returns -// true if they are equivalent, false otherwise. Two -// NodeAttributes maps are defined to be equivalent if -// all non-NULL members present in one set are present -// and equivalent in the other set, -//////////////////////////////////////////////////////////////////// -template -bool -tmap_equiv_attr(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { - while (first1 != last1 && first2 != last2) { - if ((*first1).first < (*first2).first) { - if ((*first1).second != (NodeAttribute *)NULL) { - return false; - } - ++first1; - } else if ((*first2).first < (*first1).first) { - if ((*first2).second != (NodeAttribute *)NULL) { - return false; - } - ++first2; - } else { - if ((*first1).second != (*first2).second) { - if ((*first1).second == (NodeAttribute *)NULL || - (*first2).second == (NodeAttribute *)NULL || - (*first1).second->compare_to((*first2).second) != 0) { - return false; - } - } - ++first1; - ++first2; - } - } - - while (first1 != last1) { - if ((*first1).second != (NodeAttribute *)NULL) { - return false; - } - ++first1; - } - - while (first2 != last2) { - if ((*first2).second != (NodeAttribute *)NULL) { - return false; - } - ++first2; - } - return true; -} - //////////////////////////////////////////////////////////////////// // Function: tmap_compare_cache // Description: Accepts a pair of NodeTransition maps, and returns @@ -998,65 +853,6 @@ tmap_compare_trans(InputIterator1 first1, InputIterator1 last1, return 0; } -//////////////////////////////////////////////////////////////////// -// Function: tmap_compare_attr -// Description: Accepts a pair of NodeAttribute maps, and returns -// -1 if the first one sorts before the second one, -// 1 if it sorts after, or 0 if they are equivalent. -//////////////////////////////////////////////////////////////////// -template -int -tmap_compare_attr(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2) { - while (first1 != last1 && first2 != last2) { - if ((*first1).first < (*first2).first) { - if ((*first1).second != (NodeAttribute *)NULL) { - return 1; - } - ++first1; - } else if ((*first2).first < (*first1).first) { - if ((*first2).second != (NodeAttribute *)NULL) { - return -1; - } - ++first2; - } else { - if ((*first1).second != (*first2).second) { - if ((*first1).second == (NodeAttribute *)NULL) { - return -1; - } else if ((*first2).second == (NodeAttribute *)NULL) { - return 1; - } else { - int result; - result = (*first1).second->compare_to(*(*first2).second); - if (result != 0) { - return result; - } - } - } - ++first1; - ++first2; - } - } - - while (first1 != last1) { - if ((*first1).second != (NodeAttribute *)NULL) { - // list1 is longer. - return -1; - } - ++first1; - } - - while (first2 != last2) { - if ((*first2).second != (NodeAttribute *)NULL) { - // list2 is longer. - return 1; - } - ++first2; - } - - return 0; -} - //////////////////////////////////////////////////////////////////// @@ -1077,28 +873,10 @@ tmap_is_identity(InputIterator first, InputIterator last) { return true; } -//////////////////////////////////////////////////////////////////// -// Function: tmap_is_initial -// Description: Accepts a NodeAttribute map, and returns true if all -// elements in the map correspond to the initial -// attribute, false otherwise. -//////////////////////////////////////////////////////////////////// -template -bool -tmap_is_initial(InputIterator first, InputIterator last) { - while (first != last) { - if (!(*first).second.is_initial()) { - return false; - } - ++first; - } - return true; -} - //////////////////////////////////////////////////////////////////// // Function: tmap_output -// Description: Accepts a NodeTransition or NodeAttribute map and +// Description: Accepts a NodeTransition map and // writes each element to the given output stream with a // single space separating them. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/graph/setTransitionHelpers.h b/panda/src/graph/setTransitionHelpers.h index 69e43d53fd..6b7e69bc41 100644 --- a/panda/src/graph/setTransitionHelpers.h +++ b/panda/src/graph/setTransitionHelpers.h @@ -28,17 +28,13 @@ // // tmap_* functions // -// The SetTransition and SetAttribute classes are implemented with the -// help of a handful of template functions that operate on -// NodeTransition and NodeAttribute maps. +// The SetTransition classes are implemented with the help of a +// handful of template functions that operate on NodeTransition maps. // // Each of these follows the standard STL calling conventions for // operating on one or two sequences, and/or storing the results into // an output sequence. // -// Some of the following functions can work on either a NodeTransition -// or a NodeAttribute map; most are specialized for one or the other. -// //////////////////////////////////////////////////////////////////// template diff --git a/panda/src/graph/test_graph.cxx b/panda/src/graph/test_graph.cxx index 048423775c..61a79cf425 100644 --- a/panda/src/graph/test_graph.cxx +++ b/panda/src/graph/test_graph.cxx @@ -18,18 +18,13 @@ #include "nodeRelation.h" #include "onOffTransition.h" -#include "onOffAttribute.h" #include "onTransition.h" -#include "onAttribute.h" #include "namedNode.h" #include "pt_NamedNode.h" #include "wrt.h" #include "nodeTransitionWrapper.h" -#include "nodeAttributeWrapper.h" #include "allTransitionsWrapper.h" -#include "allAttributesWrapper.h" #include "nullTransitionWrapper.h" -#include "nullAttributeWrapper.h" #include "traverserVisitor.h" #include "dftraverser.h" #include "multiTransition.h" @@ -43,10 +38,8 @@ typedef int TestType; #ifdef USE_ONOFF typedef OnOffTransition BaseTransition; -typedef OnOffAttribute BaseAttribute; #else typedef OnTransition BaseTransition; -typedef OnAttribute BaseAttribute; #endif class TestTransition : public BaseTransition { @@ -58,7 +51,6 @@ public: #endif virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; TestType get_value() const; @@ -88,39 +80,6 @@ private: static TypeHandle _type_handle; }; -class TestAttribute : public BaseAttribute { -public: - virtual TypeHandle get_handle() const; - - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - -protected: - virtual void set_value_from(const BaseTransition *other); - virtual int compare_values(const BaseAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - TestType _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() { - BaseAttribute::init_type(); - register_type(_type_handle, "TestAttribute", - BaseAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - class Test2Transition : public TestTransition { public: Test2Transition(); @@ -130,7 +89,6 @@ public: #endif virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; public: virtual TypeHandle get_type() const { @@ -150,31 +108,6 @@ private: static TypeHandle _type_handle; }; -class Test2Attribute : public TestAttribute { -public: - virtual TypeHandle get_handle() const; - - 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() { - TestAttribute::init_type(); - register_type(_type_handle, "Test2Attribute", - TestAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - class TestMName { public: static string get_class_name() { @@ -182,52 +115,12 @@ public: } }; -class TestMAttribute : public MultiAttribute { -protected: - virtual NodeAttribute *make_copy() const { - return new TestMAttribute(*this); - } - virtual NodeAttribute *make_initial() const { - return new TestMAttribute(); - } - - virtual TypeHandle get_handle() const; - - virtual void output_property(ostream &out, const TestType &prop) const { - out << prop; - } - virtual void write_property(ostream &out, const TestType &prop, - int indent_level) const { - indent(out, indent_level) << prop << "\n"; - } - -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() { - MultiAttribute::init_type(); - register_type(_type_handle, "TestMAttribute", - MultiAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - class TestMTransition : public MultiTransition { protected: virtual NodeTransition *make_copy() const { return new TestMTransition(*this); } - virtual NodeAttribute *make_attrib() const { - return new TestMAttribute; - } virtual NodeTransition *make_identity() const { return new TestMTransition; } @@ -257,9 +150,6 @@ private: static TypeHandle _type_handle; }; -TypeHandle TestMAttribute::get_handle() const { - return TestMTransition::get_class_type(); -} template class PrintNodes : public TraverserVisitor { @@ -267,13 +157,13 @@ 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) << "Reached " << *node << ", state is " << state << "\n"; return true; } bool forward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, + TransitionWrapper &pre, TransitionWrapper &post, NullLevelState &) { // indent(nout, _indent_level + 1) // << "Passing " << *arc << ", trans is " << trans << "\n"; @@ -281,7 +171,7 @@ public: return true; } void backward_arc(NodeRelation *arc, TransitionWrapper &trans, - AttributeWrapper &pre, AttributeWrapper &post, + TransitionWrapper &pre, TransitionWrapper &post, const NullLevelState &) { _indent_level -= 2; } @@ -315,11 +205,6 @@ make_copy() const { return new TestTransition(*this); } -NodeAttribute *TestTransition:: -make_attrib() const { - return new TestAttribute; -} - TestType TestTransition:: get_value() const { return _value; @@ -349,45 +234,6 @@ write_value(ostream &out, int indent_level) const { indent(out, indent_level) << _value << "\n"; } -TypeHandle TestAttribute:: -get_handle() const { - return TestTransition::get_class_type(); -} - -NodeAttribute *TestAttribute:: -make_copy() const { - return new TestAttribute(*this); -} - -NodeAttribute *TestAttribute:: -make_initial() const { - return new TestAttribute; -} - -void TestAttribute:: -set_value_from(const BaseTransition *other) { - const TestTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->get_value(); -} - -int TestAttribute:: -compare_values(const BaseAttribute *other) const { - const TestAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value - ot->_value; -} - -void TestAttribute:: -output_value(ostream &out) const { - out << _value; -} - -void TestAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} - Test2Transition:: Test2Transition() { } @@ -410,41 +256,15 @@ make_copy() const { return new Test2Transition(*this); } -NodeAttribute *Test2Transition:: -make_attrib() const { - return new Test2Attribute; -} - -TypeHandle Test2Attribute:: -get_handle() const { - return Test2Transition::get_class_type(); -} - -NodeAttribute *Test2Attribute:: -make_copy() const { - return new Test2Attribute(*this); -} - -NodeAttribute *Test2Attribute:: -make_initial() const { - return new Test2Attribute; -} - TypeHandle TestTransition::_type_handle; -TypeHandle TestAttribute::_type_handle; TypeHandle Test2Transition::_type_handle; -TypeHandle Test2Attribute::_type_handle; TypeHandle TestMTransition::_type_handle; -TypeHandle TestMAttribute::_type_handle; int main() { TestTransition::init_type(); - TestAttribute::init_type(); Test2Transition::init_type(); - Test2Attribute::init_type(); TestMTransition::init_type(); - TestMAttribute::init_type(); PT_NamedNode r = new NamedNode("r"); @@ -509,7 +329,7 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NullAttributeWrapper(), + NullTransitionWrapper(), NullLevelState(), NodeRelation::get_class_type()); nout << "\n"; @@ -557,7 +377,7 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NodeAttributeWrapper(TestTransition::get_class_type()), + NodeTransitionWrapper(TestTransition::get_class_type()), NullLevelState(), NodeRelation::get_class_type()); nout << "\n"; @@ -605,7 +425,7 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NodeAttributeWrapper(Test2Transition::get_class_type()), + NodeTransitionWrapper(Test2Transition::get_class_type()), NullLevelState(), NodeRelation::get_class_type()); nout << "\n"; @@ -653,7 +473,7 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - NodeAttributeWrapper(TestMTransition::get_class_type()), + NodeTransitionWrapper(TestMTransition::get_class_type()), NullLevelState(), NodeRelation::get_class_type()); nout << "\n"; @@ -701,7 +521,7 @@ int main() { nout << "\n"; PrintNodes pn; df_traverse(r, pn, - AllAttributesWrapper(), + AllTransitionsWrapper(), NullLevelState(), NodeRelation::get_class_type()); nout << "\n"; diff --git a/panda/src/gsgbase/graphicsStateGuardianBase.h b/panda/src/gsgbase/graphicsStateGuardianBase.h index 4cdd437220..d8c0ef008b 100644 --- a/panda/src/gsgbase/graphicsStateGuardianBase.h +++ b/panda/src/gsgbase/graphicsStateGuardianBase.h @@ -75,30 +75,6 @@ class LinesmoothTransition; class PointShapeTransition; class PolygonOffsetTransition; -class TransformAttribute; -class ColorMatrixAttribute; -class AlphaTransformAttribute; -class TexMatrixAttribute; -class ColorAttribute; -class TextureAttribute; -class LightAttribute; -class MaterialAttribute; -class RenderModeAttribute; -class ColorBlendAttribute; -class TextureApplyAttribute; -class ColorMaskAttribute; -class DepthTestAttribute; -class DepthWriteAttribute; -class TexGenAttribute; -class CullFaceAttribute; -class StencilAttribute; -class ClipPlaneAttribute; -class TransparencyAttribute; -class FogAttribute; -class LinesmoothAttribute; -class PointShapeAttribute; -class PolygonOffsetAttribute; - class Node; class GeomNode; class PointLight; @@ -212,30 +188,6 @@ public: virtual void issue_point_shape(const PointShapeTransition *) { } virtual void issue_polygon_offset(const PolygonOffsetTransition *) { } - virtual void issue_transform(const TransformAttribute *) { } - virtual void issue_color_transform(const ColorMatrixAttribute *) { } - virtual void issue_alpha_transform(const AlphaTransformAttribute *) { } - virtual void issue_tex_matrix(const TexMatrixAttribute *) { } - virtual void issue_color(const ColorAttribute *) { } - virtual void issue_texture(const TextureAttribute *) { } - virtual void issue_light(const LightAttribute *) { } - virtual void issue_material(const MaterialAttribute *) { } - virtual void issue_render_mode(const RenderModeAttribute *) { } - virtual void issue_color_blend(const ColorBlendAttribute *) { } - virtual void issue_texture_apply(const TextureApplyAttribute *) { } - virtual void issue_color_mask(const ColorMaskAttribute *) { } - virtual void issue_depth_test(const DepthTestAttribute *) { } - virtual void issue_depth_write(const DepthWriteAttribute *) { } - virtual void issue_tex_gen(const TexGenAttribute *) { } - virtual void issue_cull_face(const CullFaceAttribute *) { } - virtual void issue_stencil(const StencilAttribute *) { } - virtual void issue_clip_plane(const ClipPlaneAttribute *) { } - virtual void issue_transparency(const TransparencyAttribute *) { } - virtual void issue_fog(const FogAttribute *) { } - virtual void issue_linesmooth(const LinesmoothAttribute *) { } - virtual void issue_point_shape(const PointShapeAttribute *) { } - virtual void issue_polygon_offset(const PolygonOffsetAttribute *) { } - PUBLISHED: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/light/Sources.pp b/panda/src/light/Sources.pp index 90c46eac54..3ce7f101c5 100644 --- a/panda/src/light/Sources.pp +++ b/panda/src/light/Sources.pp @@ -11,19 +11,19 @@ #define SOURCES \ ambientLight.h config_light.h directionalLight.I \ - directionalLight.h light.h lightAttribute.I lightAttribute.h \ + directionalLight.h light.h \ lightTransition.I lightTransition.h pointLight.I \ pointLight.h pt_Light.h spotlight.I spotlight.h \ vector_PT_Light.h #define INCLUDED_SOURCES \ ambientLight.cxx config_light.cxx directionalLight.cxx light.cxx \ - lightAttribute.cxx lightTransition.cxx pointLight.cxx \ + lightTransition.cxx pointLight.cxx \ pt_Light.cxx spotlight.cxx vector_PT_Light.cxx #define INSTALL_HEADERS \ ambientLight.h directionalLight.I directionalLight.h light.h \ - lightAttribute.I lightAttribute.h lightNameClass.h \ + lightNameClass.h \ lightTransition.I lightTransition.h pointLight.I pointLight.h \ pt_Light.h spotlight.I spotlight.h vector_PT_Light.h diff --git a/panda/src/light/config_light.cxx b/panda/src/light/config_light.cxx index cb2c90605b..ddb801d406 100644 --- a/panda/src/light/config_light.cxx +++ b/panda/src/light/config_light.cxx @@ -21,7 +21,6 @@ #include "directionalLight.h" #include "light.h" #include "lightTransition.h" -#include "lightAttribute.h" #include "pointLight.h" #include "spotlight.h" @@ -35,7 +34,6 @@ ConfigureFn(config_light) { DirectionalLight::init_type(); Light::init_type(); LightTransition::init_type(); - LightAttribute::init_type(); PointLight::init_type(); Spotlight::init_type(); } diff --git a/panda/src/light/lightAttribute.I b/panda/src/light/lightAttribute.I deleted file mode 100644 index 3c728b93ba..0000000000 --- a/panda/src/light/lightAttribute.I +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: lightAttribute.I -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: LightAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE LightAttribute:: -LightAttribute() { -} diff --git a/panda/src/light/lightAttribute.cxx b/panda/src/light/lightAttribute.cxx deleted file mode 100644 index 864e978214..0000000000 --- a/panda/src/light/lightAttribute.cxx +++ /dev/null @@ -1,92 +0,0 @@ -// Filename: lightAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "lightAttribute.h" -#include "lightTransition.h" - -#include -#include - -TypeHandle LightAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: LightAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle LightAttribute:: -get_handle() const { - return LightTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: LightAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated LightAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *LightAttribute:: -make_copy() const { - return new LightAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: LightAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated LightAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *LightAttribute:: -make_initial() const { - return new LightAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: LightAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void LightAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_light(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: LightAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void LightAttribute:: -output_property(ostream &out, const PT_Light &prop) const { - out << *prop; -} - -//////////////////////////////////////////////////////////////////// -// Function: LightAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void LightAttribute:: -write_property(ostream &out, const PT_Light &prop, - int indent_level) const { - prop->write(out, indent_level); -} diff --git a/panda/src/light/lightAttribute.h b/panda/src/light/lightAttribute.h deleted file mode 100644 index 8f21c3db39..0000000000 --- a/panda/src/light/lightAttribute.h +++ /dev/null @@ -1,77 +0,0 @@ -// Filename: lightAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 LIGHTATTRIBUTE_H -#define LIGHTATTRIBUTE_H - -#include - -#include "light.h" -#include "pt_Light.h" -#include "vector_PT_Light.h" -#include "lightNameClass.h" - -#include -#include - -// We need to define this temporary macro so we can pass a parameter -// containing a comma through the macro. -#define MULTIATTRIBUTE_LIGHT MultiAttribute -EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, MULTIATTRIBUTE_LIGHT); - -//////////////////////////////////////////////////////////////////// -// Class : LightAttribute -// Description : See LightTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA LightAttribute : public MultiAttribute { -PUBLISHED: - INLINE LightAttribute(); - -public: - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void output_property(ostream &out, const PT_Light &prop) const; - virtual void write_property(ostream &out, const PT_Light &prop, - int indent_level) 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() { - MultiAttribute::init_type(); - register_type(_type_handle, "LightAttribute", - MultiAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "lightAttribute.I" - -#endif diff --git a/panda/src/light/lightTransition.cxx b/panda/src/light/lightTransition.cxx index d5b2a49ba4..f0fa5f77d1 100644 --- a/panda/src/light/lightTransition.cxx +++ b/panda/src/light/lightTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "lightTransition.h" -#include "lightAttribute.h" #include @@ -62,16 +61,6 @@ make_copy() const { return new LightTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: LightTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated LightAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *LightTransition:: -make_attrib() const { - return new LightAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: LightTransition::make_identity // Access: Public, Virtual diff --git a/panda/src/light/lightTransition.h b/panda/src/light/lightTransition.h index e63b7c50c3..d0d24a2e29 100644 --- a/panda/src/light/lightTransition.h +++ b/panda/src/light/lightTransition.h @@ -51,19 +51,9 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_identity() const; virtual NodeTransition *make_initial() const; -#ifdef CPPPARSER - // Interrogate seems to have difficulty figuring out that we do - // implement this pure virtual function properly in MultiTransition. - // For now, we'll pretend for interrogate's sake that it's also - // implemented here, just so interrogate doesn't believe the class - // is abstract. - virtual NodeAttribute *apply(const NodeAttribute *attrib) const; -#endif - virtual void issue(GraphicsStateGuardianBase *gsgbase); protected: @@ -87,7 +77,6 @@ public: private: static TypeHandle _type_handle; - friend class LightAttribute; }; #include "lightTransition.I" diff --git a/panda/src/light/light_composite1.cxx b/panda/src/light/light_composite1.cxx index d5388b53d9..464f33b470 100644 --- a/panda/src/light/light_composite1.cxx +++ b/panda/src/light/light_composite1.cxx @@ -1,6 +1,5 @@ #include "light.cxx" -#include "lightAttribute.cxx" #include "lightTransition.cxx" #include "pt_Light.cxx" #include "vector_PT_Light.cxx" diff --git a/panda/src/ribgsg/ribGraphicsStateGuardian.cxx b/panda/src/ribgsg/ribGraphicsStateGuardian.cxx index 51583452ca..18c995686d 100644 --- a/panda/src/ribgsg/ribGraphicsStateGuardian.cxx +++ b/panda/src/ribgsg/ribGraphicsStateGuardian.cxx @@ -27,13 +27,9 @@ #include #include #include -#include #include -#include #include -#include #include -#include #include #include #include @@ -92,7 +88,7 @@ static void issue_color_rib(const Geom *geom, Geom::ColorIterator &ci, const GraphicsStateGuardianBase *) { // RIB only cares about three-component color, so we have to convert - // the four-component color attribute to three-component color here. + // the four-component color transition to three-component color here. rib_colors.push_back((const RGBColorf &)geom->get_next_color(ci)); } @@ -205,7 +201,7 @@ prepare_display_region() { // pre- and post-processing. //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: -render_frame(const AllAttributesWrapper &initial_state) { +render_frame(const AllTransitionsWrapper &initial_state) { _win->begin_frame(); assert(_output != NULL); _indent_level += 2; @@ -256,7 +252,7 @@ render_frame(const AllAttributesWrapper &initial_state) { //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: render_scene(Node *root, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state) { + const AllTransitionsWrapper &initial_state) { _current_root_node = root; render_subgraph(_render_traverser, root, projnode, @@ -275,7 +271,7 @@ render_scene(Node *root, ProjectionNode *projnode, void RIBGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, Node *subgraph, ProjectionNode *projnode, - const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &initial_state, const AllTransitionsWrapper &net_trans) { ProjectionNode *old_projection_node = _current_projection_node; _current_projection_node = projnode; @@ -375,7 +371,7 @@ render_subgraph(RenderTraverser *traverser, void RIBGraphicsStateGuardian:: render_subgraph(RenderTraverser *traverser, Node *subgraph, - const AllAttributesWrapper &initial_state, + const AllTransitionsWrapper &initial_state, const AllTransitionsWrapper &net_trans) { nassertv(traverser != (RenderTraverser *)NULL); traverser->traverse(subgraph, initial_state, net_trans); @@ -412,8 +408,8 @@ wants_colors() const { // If we have scene graph color enabled, return false to indicate we // shouldn't bother issuing geometry color commands. - const ColorAttribute *catt; - if (!get_attribute_into(catt, _state, ColorTransition::get_class_type())) { + const ColorTransition *catt; + if (!get_transition_into(catt, _state, ColorTransition::get_class_type())) { // No scene graph color at all. return true; } @@ -641,7 +637,7 @@ copy_pixel_buffer(PixelBuffer *, const DisplayRegion *, const RenderBuffer &) { //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, - const NodeAttributes &) { + const NodeTransitions &) { } //////////////////////////////////////////////////////////////////// @@ -651,7 +647,7 @@ draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, const RenderBuffer &, - const NodeAttributes &) { + const NodeTransitions &) { } //////////////////////////////////////////////////////////////////// @@ -660,7 +656,7 @@ draw_pixel_buffer(PixelBuffer *, const DisplayRegion *, const RenderBuffer &, // Description: //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: -issue_transform(const TransformAttribute *attrib) { +issue_transform(const TransformTransition *attrib) { reset_transform(attrib->get_matrix()); } @@ -671,7 +667,7 @@ issue_transform(const TransformAttribute *attrib) { // Description: //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: -issue_color(const ColorAttribute *attrib) { +issue_color(const ColorTransition *attrib) { if (attrib->is_on() && attrib->is_real()) { const Colorf c = attrib->get_color(); set_color(RGBColorf(c[0], c[1], c[2])); @@ -684,7 +680,7 @@ issue_color(const ColorAttribute *attrib) { // Description: //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: -issue_texture(const TextureAttribute *attrib) { +issue_texture(const TextureTransition *attrib) { if (attrib->is_off()) { // If no textures are enabled, we can use the nontextured shader. new_line() @@ -715,7 +711,7 @@ issue_texture(const TextureAttribute *attrib) { // Description: //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: -issue_light(const LightAttribute *attrib) { +issue_light(const LightTransition *attrib) { nassertv(attrib->get_properties_is_on()); int num_enabled = attrib->size(); if (num_enabled == 0) { @@ -742,7 +738,7 @@ issue_light(const LightAttribute *attrib) { // If some lights are enabled, we'll turn off the ones that were // enabled from before, and turn on the ones we need. - LightAttribute::const_iterator li; + LightTransition::const_iterator li; for (li = attrib->begin(); li != attrib->end(); ++li) { Light *light = (*li); LightIDs::const_iterator ii = _light_ids.find(light); @@ -873,7 +869,7 @@ set_color(const RGBColorf &color) { // front in RIB. //////////////////////////////////////////////////////////////////// void RIBGraphicsStateGuardian:: -get_rib_stuff(Node *root, const AllAttributesWrapper &initial_state) { +get_rib_stuff(Node *root, const AllTransitionsWrapper &initial_state) { RibStuffTraverser trav(this); df_traverse(root, trav, initial_state, NullLevelState(), RenderRelation::get_class_type()); diff --git a/panda/src/ribgsg/ribStuffTraverser.cxx b/panda/src/ribgsg/ribStuffTraverser.cxx index 5adff0ee22..648b27f889 100644 --- a/panda/src/ribgsg/ribStuffTraverser.cxx +++ b/panda/src/ribgsg/ribStuffTraverser.cxx @@ -20,9 +20,7 @@ #include "ribGraphicsStateGuardian.h" #include -#include #include -#include #include //////////////////////////////////////////////////////////////////// @@ -33,20 +31,18 @@ // them in the RIB file. //////////////////////////////////////////////////////////////////// bool RibStuffTraverser:: -reached_node(Node *node, AllAttributesWrapper &state, NullLevelState &) { +reached_node(Node *node, AllTransitionsWrapper &state, NullLevelState &) { if (node->is_of_type(GeomNode::get_class_type())) { - const TextureAttribute *tex_attrib; - if (!get_attribute_into(tex_attrib, state, - TextureTransition::get_class_type())) { + const TextureTransition *tex_attrib; + if (!get_transition_into(tex_attrib, state)) { if (tex_attrib->is_on()) { _gsg->define_texture(tex_attrib->get_texture()); } } - const LightAttribute *light_attrib; - if (!get_attribute_into(light_attrib, state, - LightTransition::get_class_type())) { - LightAttribute::const_iterator li; + const LightTransition *light_attrib; + if (!get_transition_into(light_attrib, state)) { + LightTransition::const_iterator li; for (li = light_attrib->begin(); li != light_attrib->end(); ++li) { _gsg->define_light(*li); } diff --git a/panda/src/sgattrib/Sources.pp b/panda/src/sgattrib/Sources.pp index b24f9e4734..5c92103f47 100644 --- a/panda/src/sgattrib/Sources.pp +++ b/panda/src/sgattrib/Sources.pp @@ -9,137 +9,116 @@ #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx $[TARGET]_composite3.cxx #define SOURCES \ - alphaTransformAttribute.I alphaTransformAttribute.h \ alphaTransformProperty.I alphaTransformProperty.h \ alphaTransformTransition.I alphaTransformTransition.h \ attribTraverser.h billboardTransition.I \ - billboardTransition.h clipPlaneAttribute.I \ - clipPlaneAttribute.h clipPlaneTransition.I \ - clipPlaneTransition.h colorAttribute.I colorAttribute.h \ - colorBlendAttribute.I colorBlendAttribute.h \ + billboardTransition.h clipPlaneTransition.I \ + clipPlaneTransition.h \ colorBlendProperty.I colorBlendProperty.h \ colorBlendTransition.I colorBlendTransition.h \ - colorMaskAttribute.I colorMaskAttribute.h \ colorMaskProperty.I colorMaskProperty.h \ colorMaskTransition.I colorMaskTransition.h \ - colorMatrixAttribute.I colorMatrixAttribute.h \ colorMatrixTransition.I colorMatrixTransition.h \ colorProperty.I colorProperty.h colorTransition.I \ - colorTransition.h config_sgattrib.h cullFaceAttribute.I \ - cullFaceAttribute.h cullFaceProperty.I cullFaceProperty.h \ - cullFaceTransition.I cullFaceTransition.h decalAttribute.I \ - decalAttribute.h decalTransition.I decalTransition.h \ - depthTestAttribute.I depthTestAttribute.h \ + colorTransition.h config_sgattrib.h \ + cullFaceProperty.I cullFaceProperty.h \ + cullFaceTransition.I cullFaceTransition.h \ + decalTransition.I decalTransition.h \ depthTestProperty.I depthTestProperty.h \ depthTestTransition.I depthTestTransition.h \ - depthWriteAttribute.I depthWriteAttribute.h \ depthWriteTransition.I depthWriteTransition.h \ - drawBoundsTransition.I drawBoundsTransition.h fogAttribute.I \ - fogAttribute.h fogTransition.I fogTransition.h \ - linesmoothAttribute.I linesmoothAttribute.h \ + drawBoundsTransition.I drawBoundsTransition.h \ + fogTransition.I fogTransition.h \ linesmoothTransition.I linesmoothTransition.h \ - materialAttribute.I materialAttribute.h materialTransition.I \ - materialTransition.h pointShapeAttribute.I \ - pointShapeAttribute.h pointShapeProperty.I \ + materialTransition.I \ + materialTransition.h pointShapeProperty.I \ pointShapeProperty.h pointShapeTransition.I \ - pointShapeTransition.h polygonOffsetAttribute.I \ - polygonOffsetAttribute.h polygonOffsetProperty.I \ + pointShapeTransition.h polygonOffsetProperty.I \ polygonOffsetProperty.h polygonOffsetTransition.I \ polygonOffsetTransition.h pruneTransition.I \ - pruneTransition.h renderModeAttribute.I \ - renderModeAttribute.h renderModeProperty.I \ + pruneTransition.h renderModeProperty.I \ renderModeProperty.h renderModeTransition.I \ renderModeTransition.h renderRelation.I renderRelation.N \ - renderRelation.h stencilAttribute.I \ - stencilAttribute.h stencilProperty.I stencilProperty.h \ - stencilTransition.I stencilTransition.h texGenAttribute.I \ - texGenAttribute.h texGenProperty.I texGenProperty.h \ - texGenTransition.I texGenTransition.h texMatrixAttribute.I \ - texMatrixAttribute.h texMatrixTransition.I \ - texMatrixTransition.h textureApplyAttribute.I \ - textureApplyAttribute.h textureApplyProperty.I \ + renderRelation.h stencilProperty.I stencilProperty.h \ + stencilTransition.I stencilTransition.h \ + texGenProperty.I texGenProperty.h \ + texGenTransition.I texGenTransition.h texMatrixTransition.I \ + texMatrixTransition.h textureApplyProperty.I \ textureApplyProperty.h textureApplyTransition.I \ - textureApplyTransition.h textureAttribute.I \ - textureAttribute.h textureTransition.I textureTransition.h \ - transformAttribute.I transformAttribute.h \ + textureApplyTransition.h textureTransition.I textureTransition.h \ transformTransition.I transformTransition.h \ - transparencyAttribute.I transparencyAttribute.h \ transparencyProperty.I transparencyProperty.h \ transparencyTransition.I transparencyTransition.h #define INCLUDED_SOURCES \ - alphaTransformAttribute.cxx alphaTransformProperty.cxx \ + alphaTransformProperty.cxx \ alphaTransformTransition.cxx attribTraverser.cxx billboardTransition.cxx \ - clipPlaneAttribute.cxx clipPlaneTransition.cxx colorAttribute.cxx \ - colorBlendAttribute.cxx colorBlendProperty.cxx colorBlendTransition.cxx \ - colorMaskAttribute.cxx colorMaskProperty.cxx colorMaskTransition.cxx \ - colorMatrixAttribute.cxx colorMatrixTransition.cxx colorProperty.cxx \ - colorTransition.cxx config_sgattrib.cxx cullFaceAttribute.cxx \ - cullFaceProperty.cxx cullFaceTransition.cxx decalAttribute.cxx \ - decalTransition.cxx depthTestAttribute.cxx depthTestProperty.cxx \ - depthTestTransition.cxx depthWriteAttribute.cxx depthWriteTransition.cxx \ - drawBoundsTransition.cxx fogAttribute.cxx fogTransition.cxx \ - linesmoothAttribute.cxx linesmoothTransition.cxx materialAttribute.cxx \ - materialTransition.cxx pointShapeAttribute.cxx pointShapeProperty.cxx \ - pointShapeTransition.cxx polygonOffsetAttribute.cxx \ + clipPlaneTransition.cxx \ + colorBlendProperty.cxx colorBlendTransition.cxx \ + colorMaskProperty.cxx colorMaskTransition.cxx \ + colorMatrixTransition.cxx colorProperty.cxx \ + colorTransition.cxx config_sgattrib.cxx \ + cullFaceProperty.cxx cullFaceTransition.cxx \ + decalTransition.cxx depthTestProperty.cxx \ + depthTestTransition.cxx depthWriteTransition.cxx \ + drawBoundsTransition.cxx fogTransition.cxx \ + linesmoothTransition.cxx \ + materialTransition.cxx pointShapeProperty.cxx \ + pointShapeTransition.cxx \ polygonOffsetProperty.cxx polygonOffsetTransition.cxx pruneTransition.cxx \ - renderModeAttribute.cxx renderModeProperty.cxx renderModeTransition.cxx \ + renderModeProperty.cxx renderModeTransition.cxx \ renderRelation.cxx \ - stencilAttribute.cxx stencilProperty.cxx stencilTransition.cxx \ - texGenAttribute.cxx texGenProperty.cxx texGenTransition.cxx \ - texMatrixAttribute.cxx texMatrixTransition.cxx textureApplyAttribute.cxx \ - textureApplyProperty.cxx textureApplyTransition.cxx textureAttribute.cxx \ - textureTransition.cxx transformAttribute.cxx transformTransition.cxx \ - transparencyAttribute.cxx transparencyProperty.cxx \ + stencilProperty.cxx stencilTransition.cxx \ + texGenProperty.cxx texGenTransition.cxx \ + texMatrixTransition.cxx \ + textureApplyProperty.cxx textureApplyTransition.cxx \ + textureTransition.cxx transformTransition.cxx \ + transparencyProperty.cxx \ transparencyTransition.cxx #define INSTALL_HEADERS \ - alphaTransformAttribute.I alphaTransformAttribute.h \ alphaTransformProperty.I alphaTransformProperty.h \ alphaTransformTransition.I alphaTransformTransition.h \ attribTraverser.h billboardTransition.I billboardTransition.h \ - clipPlaneAttribute.I clipPlaneAttribute.h clipPlaneTransition.I \ - clipPlaneTransition.h colorAttribute.I colorAttribute.h \ - colorBlendAttribute.I colorBlendAttribute.h colorBlendProperty.I \ + clipPlaneTransition.I \ + clipPlaneTransition.h \ + colorBlendProperty.I \ colorBlendProperty.h colorBlendTransition.I colorBlendTransition.h \ - colorMaskAttribute.I colorMaskAttribute.h colorMaskProperty.I \ + colorMaskProperty.I \ colorMaskProperty.h colorMaskTransition.I colorMaskTransition.h \ - colorMatrixAttribute.I colorMatrixAttribute.h \ colorMatrixTransition.I colorMatrixTransition.h colorProperty.I \ colorProperty.h colorTransition.I colorTransition.h \ - config_sgattrib.h cullFaceAttribute.I cullFaceAttribute.h \ + config_sgattrib.h \ cullFaceProperty.I cullFaceProperty.h cullFaceTransition.I \ - cullFaceTransition.h decalAttribute.I decalAttribute.h \ - decalTransition.I decalTransition.h depthTestAttribute.I \ - depthTestAttribute.h depthTestProperty.I depthTestProperty.h \ - depthTestTransition.I depthTestTransition.h depthWriteAttribute.I \ - depthWriteAttribute.h depthWriteTransition.I depthWriteTransition.h \ - drawBoundsTransition.I drawBoundsTransition.h fogAttribute.I \ - fogAttribute.h fogTransition.I fogTransition.h \ - linesmoothAttribute.I linesmoothAttribute.h linesmoothTransition.I \ - linesmoothTransition.h materialAttribute.I materialAttribute.h \ - materialTransition.I materialTransition.h pointShapeAttribute.I \ - pointShapeAttribute.h pointShapeProperty.I pointShapeProperty.h \ + cullFaceTransition.h \ + decalTransition.I decalTransition.h \ + depthTestProperty.I depthTestProperty.h \ + depthTestTransition.I depthTestTransition.h \ + depthWriteTransition.I depthWriteTransition.h \ + drawBoundsTransition.I drawBoundsTransition.h \ + fogTransition.I fogTransition.h \ + linesmoothTransition.I \ + linesmoothTransition.h \ + materialTransition.I materialTransition.h \ + pointShapeProperty.I pointShapeProperty.h \ pointShapeTransition.I pointShapeTransition.h \ - polygonOffsetAttribute.I polygonOffsetAttribute.h \ polygonOffsetProperty.I polygonOffsetProperty.h \ polygonOffsetTransition.I polygonOffsetTransition.h \ - pruneTransition.I pruneTransition.h renderModeAttribute.I \ - renderModeAttribute.h renderModeProperty.I renderModeProperty.h \ + pruneTransition.I pruneTransition.h \ + renderModeProperty.I renderModeProperty.h \ renderModeTransition.I renderModeTransition.h renderRelation.I \ renderRelation.h \ - stencilAttribute.I stencilAttribute.h stencilProperty.I \ + stencilProperty.I \ stencilProperty.h stencilTransition.I stencilTransition.h \ - texGenAttribute.I texGenAttribute.h texGenProperty.I \ + texGenProperty.I \ texGenProperty.h texGenTransition.I texGenTransition.h \ - texMatrixAttribute.I texMatrixAttribute.h texMatrixTransition.I \ - texMatrixTransition.h textureApplyAttribute.I \ - textureApplyAttribute.h textureApplyProperty.I \ + texMatrixTransition.I \ + texMatrixTransition.h \ + textureApplyProperty.I \ textureApplyProperty.h textureApplyTransition.I \ - textureApplyTransition.h textureAttribute.I textureAttribute.h \ - textureTransition.I textureTransition.h transformAttribute.I \ - transformAttribute.h transformTransition.I transformTransition.h \ - transparencyAttribute.I transparencyAttribute.h \ + textureApplyTransition.h \ + textureTransition.I textureTransition.h \ + transformTransition.I transformTransition.h \ transparencyProperty.I transparencyProperty.h \ transparencyTransition.I transparencyTransition.h diff --git a/panda/src/sgattrib/alphaTransformAttribute.I b/panda/src/sgattrib/alphaTransformAttribute.I deleted file mode 100644 index b10d7f33c5..0000000000 --- a/panda/src/sgattrib/alphaTransformAttribute.I +++ /dev/null @@ -1,68 +0,0 @@ -// Filename: alphaTransformAttribute.I -// Created by: jason (01Aug00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: AlphaTransformAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE AlphaTransformAttribute:: -AlphaTransformAttribute() -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::set_offset -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void AlphaTransformAttribute:: -set_offset(float offset) { - _state.set_offset(offset); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::get_offset -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE float AlphaTransformAttribute:: -get_offset() const { - return _state.get_offset(); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::set_scale -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void AlphaTransformAttribute:: -set_scale(float scale) { - _state.set_scale(scale); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::get_scale -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE float AlphaTransformAttribute:: -get_scale() const { - return _state.get_scale(); -} diff --git a/panda/src/sgattrib/alphaTransformAttribute.cxx b/panda/src/sgattrib/alphaTransformAttribute.cxx deleted file mode 100644 index dd615482ce..0000000000 --- a/panda/src/sgattrib/alphaTransformAttribute.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// Filename: alphaTransformAttribute.cxx -// Created by: jason (01Aug00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "alphaTransformAttribute.h" -#include "alphaTransformTransition.h" - -#include -#include - -TypeHandle AlphaTransformAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle AlphaTransformAttribute:: -get_handle() const { - return AlphaTransformTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated AlphaTransformAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *AlphaTransformAttribute:: -make_copy() const { - return new AlphaTransformAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated AlphaTransformAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *AlphaTransformAttribute:: -make_initial() const { - return new AlphaTransformAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void AlphaTransformAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_alpha_transform(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// AlphaTransformTransition. -//////////////////////////////////////////////////////////////////// -void AlphaTransformAttribute:: -set_value_from(const OnTransition *other) { - const AlphaTransformTransition *ot; - DCAST_INTO_V(ot, other); - _state = ot->_state; -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int AlphaTransformAttribute:: -compare_values(const OnAttribute *other) const { - const AlphaTransformAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _state.compare_to(ot->_state); -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void AlphaTransformAttribute:: -output_value(ostream &out) const { - out << _state; -} - -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void AlphaTransformAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _state << "\n"; -} - - diff --git a/panda/src/sgattrib/alphaTransformAttribute.h b/panda/src/sgattrib/alphaTransformAttribute.h deleted file mode 100644 index 436bd66e68..0000000000 --- a/panda/src/sgattrib/alphaTransformAttribute.h +++ /dev/null @@ -1,75 +0,0 @@ -// Filename: alphaTransformAttribute.h -// Created by: jason (01Aug00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 ALPHA_TRANSFORM_TRANSITION_H -#define ALPHA_TRANSFORM_TRANSITION_H - -#include - -#include "alphaTransformProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : AlphaTransformAttribute -// Description : See AlphaTransformTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA AlphaTransformAttribute : public OnAttribute { -public: - INLINE AlphaTransformAttribute(); - - INLINE void set_offset(float offset); - INLINE float get_offset() const; - INLINE void set_scale(float scale); - INLINE float get_scale() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - AlphaTransformProperty _state; - -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() { - OnAttribute::init_type(); - register_type(_type_handle, "AlphaTransformAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "alphaTransformAttribute.I" - -#endif diff --git a/panda/src/sgattrib/alphaTransformTransition.cxx b/panda/src/sgattrib/alphaTransformTransition.cxx index 275dafc4d3..3a0ce602f9 100644 --- a/panda/src/sgattrib/alphaTransformTransition.cxx +++ b/panda/src/sgattrib/alphaTransformTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "alphaTransformTransition.h" -#include "alphaTransformAttribute.h" #include "graphicsStateGuardianBase.h" #include "indent.h" @@ -35,16 +34,6 @@ make_copy() const { return new AlphaTransformTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: AlphaTransformTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated AlphaTransformAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *AlphaTransformTransition:: -make_attrib() const { - return new AlphaTransformAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: AlphaTransformTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/alphaTransformTransition.h b/panda/src/sgattrib/alphaTransformTransition.h index 03749ad418..e789ce3a07 100644 --- a/panda/src/sgattrib/alphaTransformTransition.h +++ b/panda/src/sgattrib/alphaTransformTransition.h @@ -40,7 +40,6 @@ public: INLINE float get_scale() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -69,7 +68,6 @@ public: private: static TypeHandle _type_handle; - friend class AlphaTransformAttribute; }; diff --git a/panda/src/sgattrib/billboardTransition.cxx b/panda/src/sgattrib/billboardTransition.cxx index 836c073059..959e9d206b 100644 --- a/panda/src/sgattrib/billboardTransition.cxx +++ b/panda/src/sgattrib/billboardTransition.cxx @@ -18,7 +18,6 @@ #include "billboardTransition.h" #include "transformTransition.h" -#include "transformAttribute.h" #include "renderRelation.h" #include diff --git a/panda/src/sgattrib/clipPlaneAttribute.I b/panda/src/sgattrib/clipPlaneAttribute.I deleted file mode 100644 index c520695dda..0000000000 --- a/panda/src/sgattrib/clipPlaneAttribute.I +++ /dev/null @@ -1,66 +0,0 @@ -// Filename: clipPlaneAttribute.I -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: ClipPlaneAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE ClipPlaneAttribute:: -ClipPlaneAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::set_on -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void ClipPlaneAttribute:: -set_on(const PT(PlaneNode) &property) { - MultiNodeAttribute::set_on(property.p()); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::set_off -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void ClipPlaneAttribute:: -set_off(const PT(PlaneNode) &property) { - MultiNodeAttribute::set_off(property.p()); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::is_on -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool ClipPlaneAttribute:: -is_on(const PT(PlaneNode) &property) const { - return MultiNodeAttribute::is_on(property.p()); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::is_off -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE bool ClipPlaneAttribute:: -is_off(const PT(PlaneNode) &property) const { - return MultiNodeAttribute::is_off(property.p()); -} diff --git a/panda/src/sgattrib/clipPlaneAttribute.cxx b/panda/src/sgattrib/clipPlaneAttribute.cxx deleted file mode 100644 index 1b487e49b7..0000000000 --- a/panda/src/sgattrib/clipPlaneAttribute.cxx +++ /dev/null @@ -1,97 +0,0 @@ -// Filename: clipPlaneAttribute.cxx -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "clipPlaneAttribute.h" -#include "clipPlaneTransition.h" - -#include -#include - -TypeHandle ClipPlaneAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle ClipPlaneAttribute:: -get_handle() const { - return ClipPlaneTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated ClipPlaneAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ClipPlaneAttribute:: -make_copy() const { - return new ClipPlaneAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated ClipPlaneAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ClipPlaneAttribute:: -make_initial() const { - return new ClipPlaneAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void ClipPlaneAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_clip_plane(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void ClipPlaneAttribute:: -output_property(ostream &out, const PT_Node &prop) const { - const PlaneNode *node; - DCAST_INTO_V(node, prop); - out << node->get_name() << "=" << node->get_plane(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void ClipPlaneAttribute:: -write_property(ostream &out, const PT_Node &prop, - int indent_level) const { - const PlaneNode *node; - DCAST_INTO_V(node, prop); - indent(out, indent_level) - << node->get_name() << "=" << node->get_plane() << "\n"; -} diff --git a/panda/src/sgattrib/clipPlaneAttribute.h b/panda/src/sgattrib/clipPlaneAttribute.h deleted file mode 100644 index d2c2ae9c1d..0000000000 --- a/panda/src/sgattrib/clipPlaneAttribute.h +++ /dev/null @@ -1,74 +0,0 @@ -// Filename: clipPlaneAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 CLIPPLANEATTRIBUTE_H -#define CLIPPLANEATTRIBUTE_H - -#include - -#include - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : ClipPlaneAttribute -// Description : See ClipPlaneTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA ClipPlaneAttribute : public MultiNodeAttribute { -public: - INLINE ClipPlaneAttribute(); - - INLINE void set_on(const PT(PlaneNode) &prop); - INLINE void set_off(const PT(PlaneNode) &prop); - - INLINE bool is_on(const PT(PlaneNode) &prop) const; - INLINE bool is_off(const PT(PlaneNode) &prop) const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void output_property(ostream &out, const PT_Node &prop) const; - virtual void write_property(ostream &out, const PT_Node &prop, - int indent_level) 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() { - MultiNodeAttribute::init_type(); - register_type(_type_handle, "ClipPlaneAttribute", - MultiNodeAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "clipPlaneAttribute.I" - -#endif diff --git a/panda/src/sgattrib/clipPlaneTransition.cxx b/panda/src/sgattrib/clipPlaneTransition.cxx index e578477829..fee67d7f52 100644 --- a/panda/src/sgattrib/clipPlaneTransition.cxx +++ b/panda/src/sgattrib/clipPlaneTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "clipPlaneTransition.h" -#include "clipPlaneAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new ClipPlaneTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: ClipPlaneTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated ClipPlaneAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ClipPlaneTransition:: -make_attrib() const { - return new ClipPlaneAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: ClipPlaneTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/clipPlaneTransition.h b/panda/src/sgattrib/clipPlaneTransition.h index 5bfee2a1b7..df9f40945d 100644 --- a/panda/src/sgattrib/clipPlaneTransition.h +++ b/panda/src/sgattrib/clipPlaneTransition.h @@ -45,7 +45,6 @@ public: INLINE bool is_off(const PT(PlaneNode) &prop) const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual NodeTransition *make_identity() const; @@ -72,7 +71,6 @@ public: private: static TypeHandle _type_handle; - friend class ClipPlaneAttribute; }; #include "clipPlaneTransition.I" diff --git a/panda/src/sgattrib/colorAttribute.I b/panda/src/sgattrib/colorAttribute.I deleted file mode 100644 index 8a02b93faa..0000000000 --- a/panda/src/sgattrib/colorAttribute.I +++ /dev/null @@ -1,85 +0,0 @@ -// Filename: colorAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: ColorAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE ColorAttribute:: -ColorAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::set_on -// Access: Public -// Description: Changes the ColorAttribute to turn on the particular -// color. -//////////////////////////////////////////////////////////////////// -INLINE void ColorAttribute:: -set_on(const Colorf &color) { - _value = ColorProperty(color); - OnOffAttribute::set_on(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::set_on -// Access: Public -// Description: Changes the ColorAttribute to turn on the particular -// color. -//////////////////////////////////////////////////////////////////// -INLINE void ColorAttribute:: -set_on(float r, float g, float b, float a) { - set_on(Colorf(r, g, b, a)); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::set_uncolor -// Access: Public -// Description: Changes the ColorAttribute to turn on uncolor. -//////////////////////////////////////////////////////////////////// -INLINE void ColorAttribute:: -set_uncolor() { - _value = ColorProperty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::is_real -// Access: Public -// Description: Returns true if the ColorAttribute represents a real -// color, false if it represents the uncolor. It is -// only valid to call this if is_on() has returned true. -//////////////////////////////////////////////////////////////////// -INLINE bool ColorAttribute:: -is_real() const { - nassertr(is_on(), false); - return _value.is_real(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::get_color -// Access: Public -// Description: Returns the color that the ColorAttribute -// represents. It is only valid to call this if is_on() -// and is_real() have both returned true. -//////////////////////////////////////////////////////////////////// -INLINE Colorf ColorAttribute:: -get_color() const { - nassertr(is_on(), false); - return _value.get_color(); -} diff --git a/panda/src/sgattrib/colorAttribute.cxx b/panda/src/sgattrib/colorAttribute.cxx deleted file mode 100644 index 26a8ff22ee..0000000000 --- a/panda/src/sgattrib/colorAttribute.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// Filename: colorAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "colorAttribute.h" -#include "colorTransition.h" - -#include -#include - -TypeHandle ColorAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle ColorAttribute:: -get_handle() const { - return ColorTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated ColorAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorAttribute:: -make_copy() const { - return new ColorAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated ColorAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorAttribute:: -make_initial() const { - return new ColorAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void ColorAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_color(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// ColorTransition. -//////////////////////////////////////////////////////////////////// -void ColorAttribute:: -set_value_from(const OnOffTransition *other) { - const ColorTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::compare_values -// Access: Protected, Virtual -// Description: Returns true if the two attributes have the same -// value. It is guaranteed that the other attribute is -// another ColorAttribute, and that both are "on". -//////////////////////////////////////////////////////////////////// -int ColorAttribute:: -compare_values(const OnOffAttribute *other) const { - const ColorAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void ColorAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void ColorAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/colorAttribute.h b/panda/src/sgattrib/colorAttribute.h deleted file mode 100644 index c7c2cfe57e..0000000000 --- a/panda/src/sgattrib/colorAttribute.h +++ /dev/null @@ -1,78 +0,0 @@ -// Filename: colorAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 COLORATTRIBUTE_H -#define COLORATTRIBUTE_H - -#include - -#include "colorProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : ColorAttribute -// Description : See ColorTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA ColorAttribute : public OnOffAttribute { -PUBLISHED: - INLINE ColorAttribute(); - - INLINE void set_on(const Colorf &color); - INLINE void set_on(float r, float g, float b, float a); - INLINE void set_uncolor(); - - INLINE bool is_real() const; - INLINE Colorf get_color() const; - -public: - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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; - - ColorProperty _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() { - OnOffAttribute::init_type(); - register_type(_type_handle, "ColorAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "colorAttribute.I" - -#endif diff --git a/panda/src/sgattrib/colorBlendAttribute.I b/panda/src/sgattrib/colorBlendAttribute.I deleted file mode 100644 index f89979f893..0000000000 --- a/panda/src/sgattrib/colorBlendAttribute.I +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: colorBlendAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: ColorBlendAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE ColorBlendAttribute:: -ColorBlendAttribute() : - _value(ColorBlendProperty::M_none) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void ColorBlendAttribute:: -set_mode(ColorBlendProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE ColorBlendProperty::Mode ColorBlendAttribute:: -get_mode() const { - return _value.get_mode(); -} diff --git a/panda/src/sgattrib/colorBlendAttribute.cxx b/panda/src/sgattrib/colorBlendAttribute.cxx deleted file mode 100644 index 202d491ca6..0000000000 --- a/panda/src/sgattrib/colorBlendAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: colorBlendAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "colorBlendAttribute.h" -#include "colorBlendTransition.h" - -#include -#include - -TypeHandle ColorBlendAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle ColorBlendAttribute:: -get_handle() const { - return ColorBlendTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated ColorBlendAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorBlendAttribute:: -make_copy() const { - return new ColorBlendAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated ColorBlendAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorBlendAttribute:: -make_initial() const { - return new ColorBlendAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void ColorBlendAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_color_blend(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// ColorBlendTransition. -//////////////////////////////////////////////////////////////////// -void ColorBlendAttribute:: -set_value_from(const OnTransition *other) { - const ColorBlendTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int ColorBlendAttribute:: -compare_values(const OnAttribute *other) const { - const ColorBlendAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void ColorBlendAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void ColorBlendAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/colorBlendAttribute.h b/panda/src/sgattrib/colorBlendAttribute.h deleted file mode 100644 index 5ae7e59c76..0000000000 --- a/panda/src/sgattrib/colorBlendAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: colorBlendAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 COLORBLENDATTRIBUTE_H -#define COLORBLENDATTRIBUTE_H - -#include - -#include "colorBlendProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : ColorBlendAttribute -// Description : See ColorBlendTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA ColorBlendAttribute : public OnAttribute { -public: - INLINE ColorBlendAttribute(); - - INLINE void set_mode(ColorBlendProperty::Mode mode); - INLINE ColorBlendProperty::Mode get_mode() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - ColorBlendProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "ColorBlendAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "colorBlendAttribute.I" - -#endif diff --git a/panda/src/sgattrib/colorBlendTransition.cxx b/panda/src/sgattrib/colorBlendTransition.cxx index 142c93ad38..18286c953a 100644 --- a/panda/src/sgattrib/colorBlendTransition.cxx +++ b/panda/src/sgattrib/colorBlendTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "colorBlendTransition.h" -#include "colorBlendAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new ColorBlendTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: ColorBlendTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated ColorBlendAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorBlendTransition:: -make_attrib() const { - return new ColorBlendAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: ColorBlendTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/colorBlendTransition.h b/panda/src/sgattrib/colorBlendTransition.h index 726867e99f..93a6aefa4e 100644 --- a/panda/src/sgattrib/colorBlendTransition.h +++ b/panda/src/sgattrib/colorBlendTransition.h @@ -38,7 +38,6 @@ public: INLINE ColorBlendProperty::Mode get_mode() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -67,7 +66,6 @@ public: private: static TypeHandle _type_handle; - friend class ColorBlendAttribute; }; #include "colorBlendTransition.I" diff --git a/panda/src/sgattrib/colorMaskAttribute.I b/panda/src/sgattrib/colorMaskAttribute.I deleted file mode 100644 index 5d981891be..0000000000 --- a/panda/src/sgattrib/colorMaskAttribute.I +++ /dev/null @@ -1,92 +0,0 @@ -// Filename: colorMaskAttribute.I -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: ColorMaskAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE ColorMaskAttribute:: -ColorMaskAttribute() : - _value(ColorMaskProperty::all_on()) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::set_mask -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void ColorMaskAttribute:: -set_mask(int mask) { - _value.set_mask(mask); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::get_mask -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE int ColorMaskAttribute:: -get_mask() const { - return _value.get_mask(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::is_write_r -// Access: Public -// Description: Returns true if the red component is enabled for -// writing. -//////////////////////////////////////////////////////////////////// -INLINE bool ColorMaskAttribute:: -is_write_r() const { - return (_value.get_mask() & ColorMaskProperty::M_r) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::is_write_g -// Access: Public -// Description: Returns true if the green component is enabled for -// writing. -//////////////////////////////////////////////////////////////////// -INLINE bool ColorMaskAttribute:: -is_write_g() const { - return (_value.get_mask() & ColorMaskProperty::M_g) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::is_write_b -// Access: Public -// Description: Returns true if the blue component is enabled for -// writing. -//////////////////////////////////////////////////////////////////// -INLINE bool ColorMaskAttribute:: -is_write_b() const { - return (_value.get_mask() & ColorMaskProperty::M_b) != 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::is_write_a -// Access: Public -// Description: Returns true if the alpha component is enabled for -// writing. -//////////////////////////////////////////////////////////////////// -INLINE bool ColorMaskAttribute:: -is_write_a() const { - return (_value.get_mask() & ColorMaskProperty::M_a) != 0; -} diff --git a/panda/src/sgattrib/colorMaskAttribute.cxx b/panda/src/sgattrib/colorMaskAttribute.cxx deleted file mode 100644 index 6867757cc5..0000000000 --- a/panda/src/sgattrib/colorMaskAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: colorMaskAttribute.cxx -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "colorMaskAttribute.h" -#include "colorMaskTransition.h" - -#include -#include - -TypeHandle ColorMaskAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle ColorMaskAttribute:: -get_handle() const { - return ColorMaskTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated ColorMaskAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorMaskAttribute:: -make_copy() const { - return new ColorMaskAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated ColorMaskAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorMaskAttribute:: -make_initial() const { - return new ColorMaskAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void ColorMaskAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_color_mask(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// ColorMaskTransition. -//////////////////////////////////////////////////////////////////// -void ColorMaskAttribute:: -set_value_from(const OnTransition *other) { - const ColorMaskTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int ColorMaskAttribute:: -compare_values(const OnAttribute *other) const { - const ColorMaskAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void ColorMaskAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void ColorMaskAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/colorMaskAttribute.h b/panda/src/sgattrib/colorMaskAttribute.h deleted file mode 100644 index 838450ec85..0000000000 --- a/panda/src/sgattrib/colorMaskAttribute.h +++ /dev/null @@ -1,78 +0,0 @@ -// Filename: colorMaskAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 COLORMASKATTRIBUTE_H -#define COLORMASKATTRIBUTE_H - -#include - -#include "colorMaskProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : ColorMaskAttribute -// Description : See ColorMaskTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA ColorMaskAttribute : public OnAttribute { -public: - INLINE ColorMaskAttribute(); - - INLINE void set_mask(int mask); - INLINE int get_mask() const; - - INLINE bool is_write_r() const; - INLINE bool is_write_g() const; - INLINE bool is_write_b() const; - INLINE bool is_write_a() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - ColorMaskProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "ColorMaskAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "colorMaskAttribute.I" - -#endif diff --git a/panda/src/sgattrib/colorMaskTransition.cxx b/panda/src/sgattrib/colorMaskTransition.cxx index 29495f69f3..a57b4522e6 100644 --- a/panda/src/sgattrib/colorMaskTransition.cxx +++ b/panda/src/sgattrib/colorMaskTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "colorMaskTransition.h" -#include "colorMaskAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new ColorMaskTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: ColorMaskTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated ColorMaskAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorMaskTransition:: -make_attrib() const { - return new ColorMaskAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: ColorMaskTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/colorMaskTransition.h b/panda/src/sgattrib/colorMaskTransition.h index 51ad7b8206..21c0b4fc51 100644 --- a/panda/src/sgattrib/colorMaskTransition.h +++ b/panda/src/sgattrib/colorMaskTransition.h @@ -49,7 +49,6 @@ public: INLINE bool is_write_a() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -78,7 +77,6 @@ public: private: static TypeHandle _type_handle; - friend class ColorMaskAttribute; }; #include "colorMaskTransition.I" diff --git a/panda/src/sgattrib/colorMatrixAttribute.I b/panda/src/sgattrib/colorMatrixAttribute.I deleted file mode 100644 index ecd260f830..0000000000 --- a/panda/src/sgattrib/colorMatrixAttribute.I +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: colorMatrixAttribute.I -// Created by: jason (01Aug00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: ColorMatrixAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE ColorMatrixAttribute:: -ColorMatrixAttribute() { -} diff --git a/panda/src/sgattrib/colorMatrixAttribute.cxx b/panda/src/sgattrib/colorMatrixAttribute.cxx deleted file mode 100644 index 096ea6bdce..0000000000 --- a/panda/src/sgattrib/colorMatrixAttribute.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: colorMatrixAttribute.cxx -// Created by: jason (01Aug00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "colorMatrixAttribute.h" -#include "colorMatrixTransition.h" - -#include -#include - -TypeHandle ColorMatrixAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: ColorMatrixAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle ColorMatrixAttribute:: -get_handle() const { - return ColorMatrixTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMatrixAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated ColorMatrixAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorMatrixAttribute:: -make_copy() const { - return new ColorMatrixAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMatrixAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated ColorMatrixAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorMatrixAttribute:: -make_initial() const { - return new ColorMatrixAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: ColorMatrixAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void ColorMatrixAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_color_transform(this); -} diff --git a/panda/src/sgattrib/colorMatrixAttribute.h b/panda/src/sgattrib/colorMatrixAttribute.h deleted file mode 100644 index d1df68e418..0000000000 --- a/panda/src/sgattrib/colorMatrixAttribute.h +++ /dev/null @@ -1,61 +0,0 @@ -// Filename: colorMatrixAttribute.h -// Created by: jason (01Aug00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 COLOR_MATRIX_ATTRIBUTE_H -#define COLOR_MATRIX_ATTRIBUTE_H - -#include - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : ColorMatrixAttribute -// Description : See ColorMatrixTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA ColorMatrixAttribute : public LMatrix4fAttribute { -public: - INLINE ColorMatrixAttribute(); - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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() { - LMatrix4fAttribute::init_type(); - register_type(_type_handle, "ColorMatrixAttribute", - LMatrix4fAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "colorMatrixAttribute.I" - -#endif diff --git a/panda/src/sgattrib/colorMatrixTransition.cxx b/panda/src/sgattrib/colorMatrixTransition.cxx index 4882d0e167..b86d439adc 100644 --- a/panda/src/sgattrib/colorMatrixTransition.cxx +++ b/panda/src/sgattrib/colorMatrixTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "colorMatrixTransition.h" -#include "colorMatrixAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new ColorMatrixTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: ColorMatrixTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated ColorMatrixAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorMatrixTransition:: -make_attrib() const { - return new ColorMatrixAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: ColorMatrixTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/colorMatrixTransition.h b/panda/src/sgattrib/colorMatrixTransition.h index 2053e95f50..46be3bdbe6 100644 --- a/panda/src/sgattrib/colorMatrixTransition.h +++ b/panda/src/sgattrib/colorMatrixTransition.h @@ -35,7 +35,6 @@ public: INLINE ColorMatrixTransition(const LMatrix4f &matrix); virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -67,7 +66,6 @@ public: private: static TypeHandle _type_handle; - friend class TransformAttribute; }; #include "colorMatrixTransition.I" diff --git a/panda/src/sgattrib/colorTransition.cxx b/panda/src/sgattrib/colorTransition.cxx index 43295bc36c..cbec42632f 100644 --- a/panda/src/sgattrib/colorTransition.cxx +++ b/panda/src/sgattrib/colorTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "colorTransition.h" -#include "colorAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new ColorTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: ColorTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated ColorAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *ColorTransition:: -make_attrib() const { - return new ColorAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: ColorTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/colorTransition.h b/panda/src/sgattrib/colorTransition.h index ea6627bfbe..0138e64cde 100644 --- a/panda/src/sgattrib/colorTransition.h +++ b/panda/src/sgattrib/colorTransition.h @@ -52,7 +52,6 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -89,7 +88,6 @@ public: private: static TypeHandle _type_handle; - friend class ColorAttribute; }; #include "colorTransition.I" diff --git a/panda/src/sgattrib/config_sgattrib.cxx b/panda/src/sgattrib/config_sgattrib.cxx index b548ee69bf..4620492ad4 100644 --- a/panda/src/sgattrib/config_sgattrib.cxx +++ b/panda/src/sgattrib/config_sgattrib.cxx @@ -19,53 +19,30 @@ #include "config_sgattrib.h" #include "renderRelation.h" #include "colorTransition.h" -#include "colorAttribute.h" #include "textureTransition.h" -#include "textureAttribute.h" #include "decalTransition.h" -#include "decalAttribute.h" #include "depthTestTransition.h" -#include "depthTestAttribute.h" #include "depthWriteTransition.h" -#include "depthWriteAttribute.h" #include "colorBlendTransition.h" -#include "colorBlendAttribute.h" #include "renderModeTransition.h" -#include "renderModeAttribute.h" #include "materialTransition.h" -#include "materialAttribute.h" #include "texGenTransition.h" -#include "texGenAttribute.h" #include "cullFaceTransition.h" -#include "cullFaceAttribute.h" #include "colorMaskTransition.h" -#include "colorMaskAttribute.h" #include "stencilTransition.h" -#include "stencilAttribute.h" #include "textureApplyTransition.h" -#include "textureApplyAttribute.h" #include "clipPlaneTransition.h" -#include "clipPlaneAttribute.h" #include "transparencyTransition.h" -#include "transparencyAttribute.h" #include "fogTransition.h" -#include "fogAttribute.h" #include "linesmoothTransition.h" -#include "linesmoothAttribute.h" #include "transformTransition.h" -#include "transformAttribute.h" #include "texMatrixTransition.h" -#include "texMatrixAttribute.h" #include "billboardTransition.h" #include "polygonOffsetTransition.h" -#include "polygonOffsetAttribute.h" #include "pruneTransition.h" #include "drawBoundsTransition.h" #include "pointShapeTransition.h" -#include "pointShapeAttribute.h" -#include "colorMatrixAttribute.h" #include "colorMatrixTransition.h" -#include "alphaTransformAttribute.h" #include "alphaTransformTransition.h" @@ -140,54 +117,31 @@ ConfigureFn(config_sgattrib) { RenderRelation::init_type(); TextureTransition::init_type(); - TextureAttribute::init_type(); TransformTransition::init_type(); - TransformAttribute::init_type(); TexMatrixTransition::init_type(); - TexMatrixAttribute::init_type(); DecalTransition::init_type(); - DecalAttribute::init_type(); DepthTestTransition::init_type(); - DepthTestAttribute::init_type(); DepthWriteTransition::init_type(); - DepthWriteAttribute::init_type(); ColorBlendTransition::init_type(); - ColorBlendAttribute::init_type(); RenderModeTransition::init_type(); - RenderModeAttribute::init_type(); MaterialTransition::init_type(); - MaterialAttribute::init_type(); TexGenTransition::init_type(); - TexGenAttribute::init_type(); CullFaceTransition::init_type(); - CullFaceAttribute::init_type(); ColorMaskTransition::init_type(); - ColorMaskAttribute::init_type(); StencilTransition::init_type(); - StencilAttribute::init_type(); TextureApplyTransition::init_type(); - TextureApplyAttribute::init_type(); ClipPlaneTransition::init_type(); - ClipPlaneAttribute::init_type(); TransparencyTransition::init_type(); - TransparencyAttribute::init_type(); FogTransition::init_type(); - FogAttribute::init_type(); LinesmoothTransition::init_type(); - LinesmoothAttribute::init_type(); PruneTransition::init_type(); ColorTransition::init_type(); - ColorAttribute::init_type(); BillboardTransition::init_type(); DrawBoundsTransition::init_type(); PointShapeTransition::init_type(); - PointShapeAttribute::init_type(); PolygonOffsetTransition::init_type(); - PolygonOffsetAttribute::init_type(); ColorMatrixTransition::init_type(); - ColorMatrixAttribute::init_type(); AlphaTransformTransition::init_type(); - AlphaTransformAttribute::init_type(); // Register the RenderRelation class for the // NodeRelation::create_typed_arc() function. diff --git a/panda/src/sgattrib/cullFaceAttribute.I b/panda/src/sgattrib/cullFaceAttribute.I deleted file mode 100644 index d9e35f6f75..0000000000 --- a/panda/src/sgattrib/cullFaceAttribute.I +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: cullFaceAttribute.I -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: CullFaceAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE CullFaceAttribute:: -CullFaceAttribute() : - _value(CullFaceProperty::M_cull_none) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void CullFaceAttribute:: -set_mode(CullFaceProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE CullFaceProperty::Mode CullFaceAttribute:: -get_mode() const { - return _value.get_mode(); -} diff --git a/panda/src/sgattrib/cullFaceAttribute.cxx b/panda/src/sgattrib/cullFaceAttribute.cxx deleted file mode 100644 index 8b78732a94..0000000000 --- a/panda/src/sgattrib/cullFaceAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: cullFaceAttribute.cxx -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "cullFaceAttribute.h" -#include "cullFaceTransition.h" - -#include -#include - -TypeHandle CullFaceAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle CullFaceAttribute:: -get_handle() const { - return CullFaceTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated CullFaceAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *CullFaceAttribute:: -make_copy() const { - return new CullFaceAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated CullFaceAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *CullFaceAttribute:: -make_initial() const { - return new CullFaceAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void CullFaceAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_cull_face(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// CullFaceTransition. -//////////////////////////////////////////////////////////////////// -void CullFaceAttribute:: -set_value_from(const OnTransition *other) { - const CullFaceTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int CullFaceAttribute:: -compare_values(const OnAttribute *other) const { - const CullFaceAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void CullFaceAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: CullFaceAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void CullFaceAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/cullFaceAttribute.h b/panda/src/sgattrib/cullFaceAttribute.h deleted file mode 100644 index a71a41fad6..0000000000 --- a/panda/src/sgattrib/cullFaceAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: cullFaceAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 CULLFACEATTRIBUTE_H -#define CULLFACEATTRIBUTE_H - -#include - -#include "cullFaceProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : CullFaceAttribute -// Description : See CullFaceTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA CullFaceAttribute : public OnAttribute { -public: - INLINE CullFaceAttribute(); - - INLINE void set_mode(CullFaceProperty::Mode); - INLINE CullFaceProperty::Mode get_mode() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - CullFaceProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "CullFaceAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "cullFaceAttribute.I" - -#endif diff --git a/panda/src/sgattrib/cullFaceTransition.cxx b/panda/src/sgattrib/cullFaceTransition.cxx index 82fdf970fc..529c8d49ec 100644 --- a/panda/src/sgattrib/cullFaceTransition.cxx +++ b/panda/src/sgattrib/cullFaceTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "cullFaceTransition.h" -#include "cullFaceAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new CullFaceTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: CullFaceTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated CullFaceAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *CullFaceTransition:: -make_attrib() const { - return new CullFaceAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: CullFaceTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/cullFaceTransition.h b/panda/src/sgattrib/cullFaceTransition.h index 48bd4ccf41..c16ccda48b 100644 --- a/panda/src/sgattrib/cullFaceTransition.h +++ b/panda/src/sgattrib/cullFaceTransition.h @@ -40,7 +40,6 @@ public: INLINE CullFaceProperty::Mode get_mode() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -78,7 +77,6 @@ public: private: static TypeHandle _type_handle; - friend class CullFaceAttribute; }; #include "cullFaceTransition.I" diff --git a/panda/src/sgattrib/decalAttribute.I b/panda/src/sgattrib/decalAttribute.I deleted file mode 100644 index 4e3ec5db88..0000000000 --- a/panda/src/sgattrib/decalAttribute.I +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: decalAttribute.I -// Created by: drose (17Apr00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: DecalAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE DecalAttribute:: -DecalAttribute() { -} diff --git a/panda/src/sgattrib/decalAttribute.cxx b/panda/src/sgattrib/decalAttribute.cxx deleted file mode 100644 index 4665b2866d..0000000000 --- a/panda/src/sgattrib/decalAttribute.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Filename: decalAttribute.cxx -// Created by: drose (17Apr00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "decalAttribute.h" -#include "decalTransition.h" - -#include - -TypeHandle DecalAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: DecalAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle DecalAttribute:: -get_handle() const { - return DecalTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DecalAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated DecalAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DecalAttribute:: -make_copy() const { - return new DecalAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: DecalAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated DecalAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DecalAttribute:: -make_initial() const { - return new DecalAttribute; -} diff --git a/panda/src/sgattrib/decalAttribute.h b/panda/src/sgattrib/decalAttribute.h deleted file mode 100644 index 3aaa499c5f..0000000000 --- a/panda/src/sgattrib/decalAttribute.h +++ /dev/null @@ -1,58 +0,0 @@ -// Filename: decalAttribute.h -// Created by: drose (17Apr00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 DECALATTRIBUTE_H -#define DECALATTRIBUTE_H - -#include - -#include - -//////////////////////////////////////////////////////////////////// -// Class : DecalAttribute -// Description : See DecalTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA DecalAttribute : public OnOffAttribute { -public: - INLINE DecalAttribute(); - - virtual TypeHandle get_handle() const; - 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() { - OnOffAttribute::init_type(); - register_type(_type_handle, "DecalAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "decalAttribute.I" - -#endif diff --git a/panda/src/sgattrib/decalTransition.cxx b/panda/src/sgattrib/decalTransition.cxx index ab10107d82..781ebd5e2d 100644 --- a/panda/src/sgattrib/decalTransition.cxx +++ b/panda/src/sgattrib/decalTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "decalTransition.h" -#include "decalAttribute.h" #include #include #include @@ -36,16 +35,6 @@ make_copy() const { return new DecalTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: DecalTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated DecalAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DecalTransition:: -make_attrib() const { - return new DecalAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: DecalTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/decalTransition.h b/panda/src/sgattrib/decalTransition.h index e14b7d0e12..b0433f2c87 100644 --- a/panda/src/sgattrib/decalTransition.h +++ b/panda/src/sgattrib/decalTransition.h @@ -47,7 +47,6 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual bool has_sub_render() const; @@ -72,7 +71,6 @@ public: private: static TypeHandle _type_handle; - friend class DecalAttribute; }; #include "decalTransition.I" diff --git a/panda/src/sgattrib/depthTestAttribute.I b/panda/src/sgattrib/depthTestAttribute.I deleted file mode 100644 index fe096da711..0000000000 --- a/panda/src/sgattrib/depthTestAttribute.I +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: depthTestAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: DepthTestAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE DepthTestAttribute:: -DepthTestAttribute() : - _value(DepthTestProperty::M_less) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void DepthTestAttribute:: -set_mode(DepthTestProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE DepthTestProperty::Mode DepthTestAttribute:: -get_mode() const { - return _value.get_mode(); -} diff --git a/panda/src/sgattrib/depthTestAttribute.cxx b/panda/src/sgattrib/depthTestAttribute.cxx deleted file mode 100644 index fb4555f99b..0000000000 --- a/panda/src/sgattrib/depthTestAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: depthTestAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "depthTestAttribute.h" -#include "depthTestTransition.h" - -#include -#include - -TypeHandle DepthTestAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle DepthTestAttribute:: -get_handle() const { - return DepthTestTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated DepthTestAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DepthTestAttribute:: -make_copy() const { - return new DepthTestAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated DepthTestAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DepthTestAttribute:: -make_initial() const { - return new DepthTestAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void DepthTestAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_depth_test(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// DepthTestTransition. -//////////////////////////////////////////////////////////////////// -void DepthTestAttribute:: -set_value_from(const OnTransition *other) { - const DepthTestTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int DepthTestAttribute:: -compare_values(const OnAttribute *other) const { - const DepthTestAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void DepthTestAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthTestAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void DepthTestAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/depthTestAttribute.h b/panda/src/sgattrib/depthTestAttribute.h deleted file mode 100644 index 786b8ce86c..0000000000 --- a/panda/src/sgattrib/depthTestAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: depthTestAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 DEPTHTESTATTRIBUTE_H -#define DEPTHTESTATTRIBUTE_H - -#include - -#include "depthTestProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : DepthTestAttribute -// Description : See DepthTestTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA DepthTestAttribute : public OnAttribute { -public: - INLINE DepthTestAttribute(); - - INLINE void set_mode(DepthTestProperty::Mode); - INLINE DepthTestProperty::Mode get_mode() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - DepthTestProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "DepthTestAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "depthTestAttribute.I" - -#endif diff --git a/panda/src/sgattrib/depthTestTransition.cxx b/panda/src/sgattrib/depthTestTransition.cxx index 6b9f936e8d..c00fe7f656 100644 --- a/panda/src/sgattrib/depthTestTransition.cxx +++ b/panda/src/sgattrib/depthTestTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "depthTestTransition.h" -#include "depthTestAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new DepthTestTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: DepthTestTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated DepthTestAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DepthTestTransition:: -make_attrib() const { - return new DepthTestAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: DepthTestTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/depthTestTransition.h b/panda/src/sgattrib/depthTestTransition.h index f0f62f380d..46cedc80ce 100644 --- a/panda/src/sgattrib/depthTestTransition.h +++ b/panda/src/sgattrib/depthTestTransition.h @@ -42,7 +42,6 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -80,7 +79,6 @@ public: private: static TypeHandle _type_handle; - friend class DepthTestAttribute; }; #include "depthTestTransition.I" diff --git a/panda/src/sgattrib/depthWriteAttribute.I b/panda/src/sgattrib/depthWriteAttribute.I deleted file mode 100644 index 6afc1faaa9..0000000000 --- a/panda/src/sgattrib/depthWriteAttribute.I +++ /dev/null @@ -1,28 +0,0 @@ -// Filename: depthWriteAttribute.I -// Created by: drose (31Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: DepthWriteAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE DepthWriteAttribute:: -DepthWriteAttribute() : OnOffAttribute(true) { - // The default value for DepthWriteAttribute is true: write to the - // depth buffer. -} diff --git a/panda/src/sgattrib/depthWriteAttribute.cxx b/panda/src/sgattrib/depthWriteAttribute.cxx deleted file mode 100644 index 55a73ad0b6..0000000000 --- a/panda/src/sgattrib/depthWriteAttribute.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Filename: depthWriteAttribute.cxx -// Created by: drose (31Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "depthWriteAttribute.h" -#include "depthWriteTransition.h" - -#include - -TypeHandle DepthWriteAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: DepthWriteAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle DepthWriteAttribute:: -get_handle() const { - return DepthWriteTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthWriteAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated DepthWriteAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DepthWriteAttribute:: -make_copy() const { - return new DepthWriteAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthWriteAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated DepthWriteAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DepthWriteAttribute:: -make_initial() const { - return new DepthWriteAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: DepthWriteAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void DepthWriteAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_depth_write(this); -} diff --git a/panda/src/sgattrib/depthWriteAttribute.h b/panda/src/sgattrib/depthWriteAttribute.h deleted file mode 100644 index db86e11579..0000000000 --- a/panda/src/sgattrib/depthWriteAttribute.h +++ /dev/null @@ -1,60 +0,0 @@ -// Filename: depthWriteAttribute.h -// Created by: drose (31Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 DEPTHWRITEATTRIBUTE_H -#define DEPTHWRITEATTRIBUTE_H - -#include - -#include - -//////////////////////////////////////////////////////////////////// -// Class : DepthWriteAttribute -// Description : See DepthWriteTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA DepthWriteAttribute : public OnOffAttribute { -public: - INLINE DepthWriteAttribute(); - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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, "DepthWriteAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "depthWriteAttribute.I" - -#endif diff --git a/panda/src/sgattrib/depthWriteTransition.cxx b/panda/src/sgattrib/depthWriteTransition.cxx index 9a81a0caf8..c60cdbb60d 100644 --- a/panda/src/sgattrib/depthWriteTransition.cxx +++ b/panda/src/sgattrib/depthWriteTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "depthWriteTransition.h" -#include "depthWriteAttribute.h" #include #include @@ -37,16 +36,6 @@ make_copy() const { return new DepthWriteTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: DepthWriteTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated DepthWriteAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *DepthWriteTransition:: -make_attrib() const { - return new DepthWriteAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: DepthWriteTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/depthWriteTransition.h b/panda/src/sgattrib/depthWriteTransition.h index 48b7338098..24c2445adb 100644 --- a/panda/src/sgattrib/depthWriteTransition.h +++ b/panda/src/sgattrib/depthWriteTransition.h @@ -35,7 +35,6 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -65,7 +64,6 @@ public: private: static TypeHandle _type_handle; - friend class DepthWriteAttribute; }; #include "depthWriteTransition.I" diff --git a/panda/src/sgattrib/drawBoundsTransition.h b/panda/src/sgattrib/drawBoundsTransition.h index 995c0f1b60..55d9208bdc 100644 --- a/panda/src/sgattrib/drawBoundsTransition.h +++ b/panda/src/sgattrib/drawBoundsTransition.h @@ -65,7 +65,6 @@ public: private: static TypeHandle _type_handle; - friend class DrawBoundsAttribute; }; #include "drawBoundsTransition.I" diff --git a/panda/src/sgattrib/fogAttribute.I b/panda/src/sgattrib/fogAttribute.I deleted file mode 100644 index 39301c74bb..0000000000 --- a/panda/src/sgattrib/fogAttribute.I +++ /dev/null @@ -1,51 +0,0 @@ -// Filename: fogAttribute.I -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: FogAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE FogAttribute:: -FogAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::set_on -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void FogAttribute:: -set_on(Fog *fog) { - nassertv(fog != (Fog *)NULL); - _value = fog; - OnOffAttribute::set_on(); -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::get_fog -// Access: Public -// Description: Returns the fog that the FogAttribute represents. It -// is only valid to call this if is_on() has returned -// true. -//////////////////////////////////////////////////////////////////// -INLINE Fog *FogAttribute:: -get_fog() const { - nassertr(is_on(), NULL); - return _value; -} diff --git a/panda/src/sgattrib/fogAttribute.cxx b/panda/src/sgattrib/fogAttribute.cxx deleted file mode 100644 index 1d902dfe78..0000000000 --- a/panda/src/sgattrib/fogAttribute.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// Filename: fogAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "fogAttribute.h" -#include "fogTransition.h" - -#include -#include - -TypeHandle FogAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle FogAttribute:: -get_handle() const { - return FogTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated FogAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *FogAttribute:: -make_copy() const { - return new FogAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated FogAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *FogAttribute:: -make_initial() const { - return new FogAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void FogAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_fog(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// FogTransition. -//////////////////////////////////////////////////////////////////// -void FogAttribute:: -set_value_from(const OnOffTransition *other) { - const FogTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; - nassertv(_value != (Fog *)NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int FogAttribute:: -compare_values(const OnOffAttribute *other) const { - const FogAttribute *ot; - DCAST_INTO_R(ot, other, false); - return (int)(_value.p() - ot->_value.p()); -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void FogAttribute:: -output_value(ostream &out) const { - nassertv(_value != (Fog *)NULL); - out << *_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: FogAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void FogAttribute:: -write_value(ostream &out, int indent_level) const { - nassertv(_value != (Fog *)NULL); - indent(out, indent_level) << *_value << "\n"; -} diff --git a/panda/src/sgattrib/fogAttribute.h b/panda/src/sgattrib/fogAttribute.h deleted file mode 100644 index f96bd06e04..0000000000 --- a/panda/src/sgattrib/fogAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: fogAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 FOGATTRIBUTE_H -#define FOGATTRIBUTE_H - -#include - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : FogAttribute -// Description : See FogTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA FogAttribute : public OnOffAttribute { -public: - INLINE FogAttribute(); - - INLINE void set_on(Fog *fog); - INLINE Fog *get_fog() const; - -public: - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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; - - PT(Fog) _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() { - OnOffAttribute::init_type(); - register_type(_type_handle, "FogAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "fogAttribute.I" - -#endif diff --git a/panda/src/sgattrib/fogTransition.cxx b/panda/src/sgattrib/fogTransition.cxx index 61288e53f4..2814e1a672 100644 --- a/panda/src/sgattrib/fogTransition.cxx +++ b/panda/src/sgattrib/fogTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "fogTransition.h" -#include "fogAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new FogTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: FogTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated FogAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *FogTransition:: -make_attrib() const { - return new FogAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: FogTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/fogTransition.h b/panda/src/sgattrib/fogTransition.h index 3132b18d39..93afa4e5b4 100644 --- a/panda/src/sgattrib/fogTransition.h +++ b/panda/src/sgattrib/fogTransition.h @@ -41,7 +41,6 @@ public: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -70,7 +69,6 @@ public: private: static TypeHandle _type_handle; - friend class FogAttribute; }; #include "fogTransition.I" diff --git a/panda/src/sgattrib/linesmoothAttribute.I b/panda/src/sgattrib/linesmoothAttribute.I deleted file mode 100644 index d3ac126cde..0000000000 --- a/panda/src/sgattrib/linesmoothAttribute.I +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: linesmoothAttribute.I -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: LinesmoothAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE LinesmoothAttribute:: -LinesmoothAttribute() { -} diff --git a/panda/src/sgattrib/linesmoothAttribute.cxx b/panda/src/sgattrib/linesmoothAttribute.cxx deleted file mode 100644 index 228768b9ae..0000000000 --- a/panda/src/sgattrib/linesmoothAttribute.cxx +++ /dev/null @@ -1,69 +0,0 @@ -// Filename: linesmoothAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "linesmoothAttribute.h" -#include "linesmoothTransition.h" - -#include - -TypeHandle LinesmoothAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: LinesmoothAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle LinesmoothAttribute:: -get_handle() const { - return LinesmoothTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: LinesmoothAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated LinesmoothAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *LinesmoothAttribute:: -make_copy() const { - return new LinesmoothAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: LinesmoothAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated LinesmoothAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *LinesmoothAttribute:: -make_initial() const { - return new LinesmoothAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: LinesmoothAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void LinesmoothAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_linesmooth(this); -} diff --git a/panda/src/sgattrib/linesmoothAttribute.h b/panda/src/sgattrib/linesmoothAttribute.h deleted file mode 100644 index 03b572d4c3..0000000000 --- a/panda/src/sgattrib/linesmoothAttribute.h +++ /dev/null @@ -1,60 +0,0 @@ -// Filename: linesmoothAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 LINESMOOTHATTRIBUTE_H -#define LINESMOOTHATTRIBUTE_H - -#include - -#include - -//////////////////////////////////////////////////////////////////// -// Class : LinesmoothAttribute -// Description : See LinesmoothTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA LinesmoothAttribute : public OnOffAttribute { -public: - INLINE LinesmoothAttribute(); - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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, "LinesmoothAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "linesmoothAttribute.I" - -#endif diff --git a/panda/src/sgattrib/linesmoothTransition.cxx b/panda/src/sgattrib/linesmoothTransition.cxx index 73c10b28ce..ad87f53b88 100644 --- a/panda/src/sgattrib/linesmoothTransition.cxx +++ b/panda/src/sgattrib/linesmoothTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "linesmoothTransition.h" -#include "linesmoothAttribute.h" TypeHandle LinesmoothTransition::_type_handle; @@ -32,16 +31,6 @@ make_copy() const { return new LinesmoothTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: LinesmoothTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated LinesmoothAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *LinesmoothTransition:: -make_attrib() const { - return new LinesmoothAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: LinesmoothTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/linesmoothTransition.h b/panda/src/sgattrib/linesmoothTransition.h index 546b586820..860eade6db 100644 --- a/panda/src/sgattrib/linesmoothTransition.h +++ b/panda/src/sgattrib/linesmoothTransition.h @@ -35,7 +35,6 @@ public: INLINE static LinesmoothTransition off(); virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -56,7 +55,6 @@ public: private: static TypeHandle _type_handle; - friend class LinesmoothAttribute; }; #include "linesmoothTransition.I" diff --git a/panda/src/sgattrib/materialAttribute.I b/panda/src/sgattrib/materialAttribute.I deleted file mode 100644 index b2c31db47e..0000000000 --- a/panda/src/sgattrib/materialAttribute.I +++ /dev/null @@ -1,51 +0,0 @@ -// Filename: materialAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: MaterialAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE MaterialAttribute:: -MaterialAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::set_on -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void MaterialAttribute:: -set_on(const Material *material) { - nassertv(material != (const Material *)NULL); - _value = material; - OnOffAttribute::set_on(); -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::get_material -// Access: Public -// Description: Returns the material that the MaterialAttribute -// represents. It is only valid to call this if is_on() -// has returned true. -//////////////////////////////////////////////////////////////////// -INLINE const Material *MaterialAttribute:: -get_material() const { - nassertr(is_on(), NULL); - return _value; -} diff --git a/panda/src/sgattrib/materialAttribute.cxx b/panda/src/sgattrib/materialAttribute.cxx deleted file mode 100644 index 34d19cd31d..0000000000 --- a/panda/src/sgattrib/materialAttribute.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// Filename: materialAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "materialAttribute.h" -#include "materialTransition.h" - -#include -#include - -TypeHandle MaterialAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle MaterialAttribute:: -get_handle() const { - return MaterialTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated MaterialAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *MaterialAttribute:: -make_copy() const { - return new MaterialAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated MaterialAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *MaterialAttribute:: -make_initial() const { - return new MaterialAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void MaterialAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_material(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// MaterialTransition. -//////////////////////////////////////////////////////////////////// -void MaterialAttribute:: -set_value_from(const OnOffTransition *other) { - const MaterialTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; - nassertv(_value != (const Material *)NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int MaterialAttribute:: -compare_values(const OnOffAttribute *other) const { - const MaterialAttribute *ot; - DCAST_INTO_R(ot, other, false); - return (int)(_value.p() - ot->_value.p()); -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void MaterialAttribute:: -output_value(ostream &out) const { - nassertv(_value != (const Material *)NULL); - out << *_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: MaterialAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void MaterialAttribute:: -write_value(ostream &out, int indent_level) const { - nassertv(_value != (const Material *)NULL); - indent(out, indent_level) << *_value << "\n"; -} diff --git a/panda/src/sgattrib/materialAttribute.h b/panda/src/sgattrib/materialAttribute.h deleted file mode 100644 index 9371ed97dd..0000000000 --- a/panda/src/sgattrib/materialAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: materialAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 MATERIALATTRIBUTE_H -#define MATERIALATTRIBUTE_H - -#include - -#include -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : MaterialAttribute -// Description : See MaterialTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA MaterialAttribute : public OnOffAttribute { -public: - INLINE MaterialAttribute(); - - INLINE void set_on(const Material *material); - INLINE const Material *get_material() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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; - - CPT(Material) _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() { - OnOffAttribute::init_type(); - register_type(_type_handle, "MaterialAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "materialAttribute.I" - -#endif diff --git a/panda/src/sgattrib/materialTransition.cxx b/panda/src/sgattrib/materialTransition.cxx index 097164f963..bfd708a4b8 100644 --- a/panda/src/sgattrib/materialTransition.cxx +++ b/panda/src/sgattrib/materialTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "materialTransition.h" -#include "materialAttribute.h" #include "config_sgattrib.h" #include @@ -39,16 +38,6 @@ make_copy() const { return new MaterialTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: MaterialTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated MaterialAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *MaterialTransition:: -make_attrib() const { - return new MaterialAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: MaterialTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/materialTransition.h b/panda/src/sgattrib/materialTransition.h index d8c7af83f1..438e6683eb 100644 --- a/panda/src/sgattrib/materialTransition.h +++ b/panda/src/sgattrib/materialTransition.h @@ -41,7 +41,6 @@ public: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -80,7 +79,6 @@ public: private: static TypeHandle _type_handle; - friend class MaterialAttribute; }; #include "materialTransition.I" diff --git a/panda/src/sgattrib/pointShapeAttribute.I b/panda/src/sgattrib/pointShapeAttribute.I deleted file mode 100644 index b047c7da45..0000000000 --- a/panda/src/sgattrib/pointShapeAttribute.I +++ /dev/null @@ -1,47 +0,0 @@ -// Filename: pointShapeAttribute.I -// Created by: charles (11Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: PointShapeAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE PointShapeAttribute:: -PointShapeAttribute() : - _value(PointShapeProperty::M_square) { -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void PointShapeAttribute:: -set_mode(PointShapeProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE PointShapeProperty::Mode PointShapeAttribute:: -get_mode() const { - return _value.get_mode(); -} diff --git a/panda/src/sgattrib/pointShapeAttribute.cxx b/panda/src/sgattrib/pointShapeAttribute.cxx deleted file mode 100644 index 65c9432b61..0000000000 --- a/panda/src/sgattrib/pointShapeAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: pointShapeAttribute.cxx -// Created by: charles (11Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "pointShapeAttribute.h" -#include "pointShapeTransition.h" - -#include -#include - -TypeHandle PointShapeAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle PointShapeAttribute:: -get_handle() const { - return PointShapeTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated PointShapeAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *PointShapeAttribute:: -make_copy() const { - return new PointShapeAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated PointShapeAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *PointShapeAttribute:: -make_initial() const { - return new PointShapeAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void PointShapeAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_point_shape(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// PointShapeTransition. -//////////////////////////////////////////////////////////////////// -void PointShapeAttribute:: -set_value_from(const OnTransition *other) { - const PointShapeTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int PointShapeAttribute:: -compare_values(const OnAttribute *other) const { - const PointShapeAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void PointShapeAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: PointShapeAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void PointShapeAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/pointShapeAttribute.h b/panda/src/sgattrib/pointShapeAttribute.h deleted file mode 100644 index b40147167a..0000000000 --- a/panda/src/sgattrib/pointShapeAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: pointShapeAttribute.h -// Created by: charles (11Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 POINTSHAPEATTRIBUTE_H -#define POINTSHAPEATTRIBUTE_H - -#include - -#include "pointShapeProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : PointShapeAttribute -// Description : See PointShapeTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA PointShapeAttribute : public OnAttribute { -public: - INLINE PointShapeAttribute(); - - INLINE void set_mode(PointShapeProperty::Mode); - INLINE PointShapeProperty::Mode get_mode() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - PointShapeProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "PointShapeAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "pointShapeAttribute.I" - -#endif // POINTSHAPEATTRIBUTE_H diff --git a/panda/src/sgattrib/pointShapeTransition.cxx b/panda/src/sgattrib/pointShapeTransition.cxx index a75dd0f3fc..122bbb68c8 100644 --- a/panda/src/sgattrib/pointShapeTransition.cxx +++ b/panda/src/sgattrib/pointShapeTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "pointShapeTransition.h" -#include "pointShapeAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new PointShapeTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: Pointshapetransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated pointShapeattribute -//////////////////////////////////////////////////////////////////// -NodeAttribute *PointShapeTransition:: -make_attrib() const { - return new PointShapeAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: PointShapeTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/pointShapeTransition.h b/panda/src/sgattrib/pointShapeTransition.h index 212d5036fa..33be392fbf 100644 --- a/panda/src/sgattrib/pointShapeTransition.h +++ b/panda/src/sgattrib/pointShapeTransition.h @@ -38,7 +38,6 @@ public: INLINE PointShapeProperty::Mode get_mode() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -67,7 +66,6 @@ public: private: static TypeHandle _type_handle; - friend class PointShapeAttribute; }; #include "pointShapeTransition.I" diff --git a/panda/src/sgattrib/polygonOffsetAttribute.I b/panda/src/sgattrib/polygonOffsetAttribute.I deleted file mode 100644 index df08dc7d83..0000000000 --- a/panda/src/sgattrib/polygonOffsetAttribute.I +++ /dev/null @@ -1,67 +0,0 @@ -// Filename: polygonOffsetAttribute.I -// Created by: jason (12Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: PolygonOffsetAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE PolygonOffsetAttribute:: -PolygonOffsetAttribute() -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::set_units -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void PolygonOffsetAttribute:: -set_units(int units) { - _state.set_units(units); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::get_units -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE int PolygonOffsetAttribute:: -get_units() const { - return _state.get_units(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::set_factor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void PolygonOffsetAttribute:: -set_factor(int factor) { - _state.set_factor(factor); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::get_factor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE int PolygonOffsetAttribute:: -get_factor() const { - return _state.get_factor(); -} diff --git a/panda/src/sgattrib/polygonOffsetAttribute.cxx b/panda/src/sgattrib/polygonOffsetAttribute.cxx deleted file mode 100644 index e49faae94b..0000000000 --- a/panda/src/sgattrib/polygonOffsetAttribute.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// Filename: polygonOffsetAttribute.cxx -// Created by: jason (12Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "polygonOffsetAttribute.h" -#include "polygonOffsetTransition.h" - -#include -#include - -TypeHandle PolygonOffsetAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle PolygonOffsetAttribute:: -get_handle() const { - return PolygonOffsetTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated PolygonOffsetAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *PolygonOffsetAttribute:: -make_copy() const { - return new PolygonOffsetAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated PolygonOffsetAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *PolygonOffsetAttribute:: -make_initial() const { - return new PolygonOffsetAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void PolygonOffsetAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_polygon_offset(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// PolygonOffsetTransition. -//////////////////////////////////////////////////////////////////// -void PolygonOffsetAttribute:: -set_value_from(const OnTransition *other) { - const PolygonOffsetTransition *ot; - DCAST_INTO_V(ot, other); - _state = ot->_state; -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int PolygonOffsetAttribute:: -compare_values(const OnAttribute *other) const { - const PolygonOffsetAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _state.compare_to(ot->_state); -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void PolygonOffsetAttribute:: -output_value(ostream &out) const { - out << _state; -} - -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void PolygonOffsetAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _state << "\n"; -} - - diff --git a/panda/src/sgattrib/polygonOffsetAttribute.h b/panda/src/sgattrib/polygonOffsetAttribute.h deleted file mode 100644 index 6af106652e..0000000000 --- a/panda/src/sgattrib/polygonOffsetAttribute.h +++ /dev/null @@ -1,75 +0,0 @@ -// Filename: polygonOffsetAttribute.h -// Created by: jason (12Jul00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 POLYGONOFFSETATTRIBUTE_H -#define POLYGONOFFSETATTRIBUTE_H - -#include - -#include "polygonOffsetProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : PolygonOffsetAttribute -// Description : See PolygonOffsetTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA PolygonOffsetAttribute : public OnAttribute { -public: - INLINE PolygonOffsetAttribute(); - - INLINE void set_units(int units); - INLINE int get_units() const; - INLINE void set_factor(int factor); - INLINE int get_factor() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - PolygonOffsetProperty _state; - -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() { - OnAttribute::init_type(); - register_type(_type_handle, "PolygonOffsetAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "polygonOffsetAttribute.I" - -#endif diff --git a/panda/src/sgattrib/polygonOffsetTransition.cxx b/panda/src/sgattrib/polygonOffsetTransition.cxx index a626c5b6f4..cd549a9c0d 100644 --- a/panda/src/sgattrib/polygonOffsetTransition.cxx +++ b/panda/src/sgattrib/polygonOffsetTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "polygonOffsetTransition.h" -#include "polygonOffsetAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new PolygonOffsetTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: PolygonOffsetTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated PolygonOffsetAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *PolygonOffsetTransition:: -make_attrib() const { - return new PolygonOffsetAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: PolygonOffsetTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/polygonOffsetTransition.h b/panda/src/sgattrib/polygonOffsetTransition.h index b8504109fa..84684ad05f 100644 --- a/panda/src/sgattrib/polygonOffsetTransition.h +++ b/panda/src/sgattrib/polygonOffsetTransition.h @@ -43,7 +43,6 @@ public: INLINE int get_factor() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -72,7 +71,6 @@ public: private: static TypeHandle _type_handle; - friend class PolygonOffsetAttribute; }; diff --git a/panda/src/sgattrib/renderModeAttribute.I b/panda/src/sgattrib/renderModeAttribute.I deleted file mode 100644 index a874566d0d..0000000000 --- a/panda/src/sgattrib/renderModeAttribute.I +++ /dev/null @@ -1,68 +0,0 @@ -// Filename: renderModeAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: RenderModeAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE RenderModeAttribute:: -RenderModeAttribute() : - _value(RenderModeProperty::M_filled, 1.0) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void RenderModeAttribute:: -set_mode(RenderModeProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE RenderModeProperty::Mode RenderModeAttribute:: -get_mode() const { - return _value.get_mode(); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::set_line_width -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void RenderModeAttribute:: -set_line_width(double line_width) { - _value.set_line_width(line_width); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::get_line_width -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE double RenderModeAttribute:: -get_line_width() const { - return _value.get_line_width(); -} diff --git a/panda/src/sgattrib/renderModeAttribute.cxx b/panda/src/sgattrib/renderModeAttribute.cxx deleted file mode 100644 index b371a15ae7..0000000000 --- a/panda/src/sgattrib/renderModeAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: renderModeAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "renderModeAttribute.h" -#include "renderModeTransition.h" - -#include -#include - -TypeHandle RenderModeAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle RenderModeAttribute:: -get_handle() const { - return RenderModeTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated RenderModeAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *RenderModeAttribute:: -make_copy() const { - return new RenderModeAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated RenderModeAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *RenderModeAttribute:: -make_initial() const { - return new RenderModeAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void RenderModeAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_render_mode(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// RenderModeTransition. -//////////////////////////////////////////////////////////////////// -void RenderModeAttribute:: -set_value_from(const OnTransition *other) { - const RenderModeTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int RenderModeAttribute:: -compare_values(const OnAttribute *other) const { - const RenderModeAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void RenderModeAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: RenderModeAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void RenderModeAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/renderModeAttribute.h b/panda/src/sgattrib/renderModeAttribute.h deleted file mode 100644 index 9e24b6117f..0000000000 --- a/panda/src/sgattrib/renderModeAttribute.h +++ /dev/null @@ -1,76 +0,0 @@ -// Filename: renderModeAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 RENDERMODEATTRIBUTE_H -#define RENDERMODEATTRIBUTE_H - -#include - -#include "renderModeProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : RenderModeAttribute -// Description : See RenderModeTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA RenderModeAttribute : public OnAttribute { -public: - INLINE RenderModeAttribute(); - - INLINE void set_mode(RenderModeProperty::Mode); - INLINE RenderModeProperty::Mode get_mode() const; - - INLINE void set_line_width(double line_width); - INLINE double get_line_width() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - RenderModeProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "RenderModeAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "renderModeAttribute.I" - -#endif diff --git a/panda/src/sgattrib/renderModeTransition.cxx b/panda/src/sgattrib/renderModeTransition.cxx index 6d9e242f31..3e2eb6b3b0 100644 --- a/panda/src/sgattrib/renderModeTransition.cxx +++ b/panda/src/sgattrib/renderModeTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "renderModeTransition.h" -#include "renderModeAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new RenderModeTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: RenderModeTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated RenderModeAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *RenderModeTransition:: -make_attrib() const { - return new RenderModeAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: RenderModeTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/renderModeTransition.h b/panda/src/sgattrib/renderModeTransition.h index 42be6edf49..209ccb5e04 100644 --- a/panda/src/sgattrib/renderModeTransition.h +++ b/panda/src/sgattrib/renderModeTransition.h @@ -41,7 +41,6 @@ public: INLINE double get_line_width() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -70,7 +69,6 @@ public: private: static TypeHandle _type_handle; - friend class RenderModeAttribute; }; #include "renderModeTransition.I" diff --git a/panda/src/sgattrib/sgattrib_composite1.cxx b/panda/src/sgattrib/sgattrib_composite1.cxx index 6cfba2ba6f..a2340523cf 100644 --- a/panda/src/sgattrib/sgattrib_composite1.cxx +++ b/panda/src/sgattrib/sgattrib_composite1.cxx @@ -1,24 +1,13 @@ -#include "alphaTransformAttribute.cxx" -#include "clipPlaneAttribute.cxx" -#include "colorAttribute.cxx" -#include "colorBlendAttribute.cxx" -#include "colorMaskAttribute.cxx" -#include "colorMatrixAttribute.cxx" -#include "cullFaceAttribute.cxx" -#include "decalAttribute.cxx" -#include "depthTestAttribute.cxx" -#include "depthWriteAttribute.cxx" -#include "fogAttribute.cxx" -#include "linesmoothAttribute.cxx" -#include "materialAttribute.cxx" -#include "pointShapeAttribute.cxx" -#include "polygonOffsetAttribute.cxx" -#include "renderModeAttribute.cxx" -#include "stencilAttribute.cxx" -#include "texGenAttribute.cxx" -#include "texMatrixAttribute.cxx" -#include "textureApplyAttribute.cxx" -#include "textureAttribute.cxx" -#include "transformAttribute.cxx" -#include "transparencyAttribute.cxx" +#include "alphaTransformTransition.cxx" +#include "billboardTransition.cxx" +#include "clipPlaneTransition.cxx" +#include "colorBlendTransition.cxx" +#include "colorMaskTransition.cxx" +#include "colorMatrixTransition.cxx" +#include "colorTransition.cxx" +#include "cullFaceTransition.cxx" +#include "decalTransition.cxx" +#include "depthTestTransition.cxx" +#include "depthWriteTransition.cxx" +#include "drawBoundsTransition.cxx" diff --git a/panda/src/sgattrib/sgattrib_composite2.cxx b/panda/src/sgattrib/sgattrib_composite2.cxx index 4c1d239f5e..cd3ebe45af 100644 --- a/panda/src/sgattrib/sgattrib_composite2.cxx +++ b/panda/src/sgattrib/sgattrib_composite2.cxx @@ -1,16 +1,4 @@ -#include "alphaTransformTransition.cxx" -#include "billboardTransition.cxx" -#include "clipPlaneTransition.cxx" -#include "colorBlendTransition.cxx" -#include "colorMaskTransition.cxx" -#include "colorMatrixTransition.cxx" -#include "colorTransition.cxx" -#include "cullFaceTransition.cxx" -#include "decalTransition.cxx" -#include "depthTestTransition.cxx" -#include "depthWriteTransition.cxx" -#include "drawBoundsTransition.cxx" #include "fogTransition.cxx" #include "linesmoothTransition.cxx" #include "materialTransition.cxx" diff --git a/panda/src/sgattrib/stencilAttribute.I b/panda/src/sgattrib/stencilAttribute.I deleted file mode 100644 index 0f7dfc3a8a..0000000000 --- a/panda/src/sgattrib/stencilAttribute.I +++ /dev/null @@ -1,68 +0,0 @@ -// Filename: stencilAttribute.I -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: StencilAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE StencilAttribute:: -StencilAttribute() : - _value(StencilProperty::M_none, StencilProperty::A_keep) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void StencilAttribute:: -set_mode(StencilProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE StencilProperty::Mode StencilAttribute:: -get_mode() const { - return _value.get_mode(); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::set_action -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void StencilAttribute:: -set_action(StencilProperty::Action action) { - _value.set_action(action); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::get_action -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE StencilProperty::Action StencilAttribute:: -get_action() const { - return _value.get_action(); -} diff --git a/panda/src/sgattrib/stencilAttribute.cxx b/panda/src/sgattrib/stencilAttribute.cxx deleted file mode 100644 index 7c7be863a0..0000000000 --- a/panda/src/sgattrib/stencilAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: stencilAttribute.cxx -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "stencilAttribute.h" -#include "stencilTransition.h" - -#include -#include - -TypeHandle StencilAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle StencilAttribute:: -get_handle() const { - return StencilTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated StencilAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *StencilAttribute:: -make_copy() const { - return new StencilAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated StencilAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *StencilAttribute:: -make_initial() const { - return new StencilAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void StencilAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_stencil(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// StencilTransition. -//////////////////////////////////////////////////////////////////// -void StencilAttribute:: -set_value_from(const OnTransition *other) { - const StencilTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int StencilAttribute:: -compare_values(const OnAttribute *other) const { - const StencilAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void StencilAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: StencilAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void StencilAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/stencilAttribute.h b/panda/src/sgattrib/stencilAttribute.h deleted file mode 100644 index a677612774..0000000000 --- a/panda/src/sgattrib/stencilAttribute.h +++ /dev/null @@ -1,77 +0,0 @@ -// Filename: stencilAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 STENCILATTRIBUTE_H -#define STENCILATTRIBUTE_H - -#include - -#include "stencilProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : StencilAttribute -// Description : See StencilTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA StencilAttribute : public OnAttribute { -public: - INLINE StencilAttribute(); - - INLINE void set_mode(StencilProperty::Mode mode); - INLINE StencilProperty::Mode get_mode() const; - - INLINE void set_action(StencilProperty::Action action); - INLINE StencilProperty::Action get_action() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - StencilProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "StencilAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "stencilAttribute.I" - -#endif - diff --git a/panda/src/sgattrib/stencilTransition.cxx b/panda/src/sgattrib/stencilTransition.cxx index 55acacfb89..1ffea33582 100644 --- a/panda/src/sgattrib/stencilTransition.cxx +++ b/panda/src/sgattrib/stencilTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "stencilTransition.h" -#include "stencilAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new StencilTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: StencilTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated StencilAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *StencilTransition:: -make_attrib() const { - return new StencilAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: StencilTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/stencilTransition.h b/panda/src/sgattrib/stencilTransition.h index 01e9a27291..65d94c27f3 100644 --- a/panda/src/sgattrib/stencilTransition.h +++ b/panda/src/sgattrib/stencilTransition.h @@ -47,7 +47,6 @@ public: INLINE StencilProperty::Action get_action() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -76,7 +75,6 @@ public: private: static TypeHandle _type_handle; - friend class StencilAttribute; }; #include "stencilTransition.I" diff --git a/panda/src/sgattrib/test_attrib.cxx b/panda/src/sgattrib/test_attrib.cxx index 8109ba8323..72d094b881 100644 --- a/panda/src/sgattrib/test_attrib.cxx +++ b/panda/src/sgattrib/test_attrib.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include @@ -35,7 +34,7 @@ public: PrintNodes() { _indent_level = 0; } - bool reached_node(Node *node, AttributeWrapper &state, + bool reached_node(Node *node, TransitionWrapper &state, NullLevelState &) { indent(cerr, _indent_level) << "\nReached " << *node << ", state is:\n"; @@ -43,13 +42,13 @@ public: 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; } @@ -106,7 +105,7 @@ main(int argc, char *argv[]) { cerr << "\n"; PrintNodes pn; df_traverse(r, pn, - AllAttributesWrapper(), + AllTransitionsWrapper(), NullLevelState(), NodeRelation::get_class_type()); cerr << "\n"; diff --git a/panda/src/sgattrib/texGenAttribute.I b/panda/src/sgattrib/texGenAttribute.I deleted file mode 100644 index d479ccd5eb..0000000000 --- a/panda/src/sgattrib/texGenAttribute.I +++ /dev/null @@ -1,79 +0,0 @@ -// Filename: texGenAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: TexGenAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TexGenAttribute:: -TexGenAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::set_none -// Access: Public -// Description: Sets the attribute to disable texture coordinate -// generation. -//////////////////////////////////////////////////////////////////// -INLINE void TexGenAttribute:: -set_none() { - _value = TexGenProperty(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::set_texture_projector -// Access: Public -// Description: Sets the attribute to project textures through a -// perpective frustum. -//////////////////////////////////////////////////////////////////// -INLINE void TexGenAttribute:: -set_texture_projector() { - _value = TexGenProperty::texture_projector(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::set_sphere_map -// Access: Public -// Description: Sets the attribute to project textures as sphere -// maps. -//////////////////////////////////////////////////////////////////// -INLINE void TexGenAttribute:: -set_sphere_map() { - _value = TexGenProperty::sphere_map(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TexGenProperty::Mode TexGenAttribute:: -get_mode() const { - return _value.get_mode(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::get_plane -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE LMatrix4f TexGenAttribute:: -get_plane() const { - return _value.get_plane(); -} diff --git a/panda/src/sgattrib/texGenAttribute.cxx b/panda/src/sgattrib/texGenAttribute.cxx deleted file mode 100644 index 919a368b80..0000000000 --- a/panda/src/sgattrib/texGenAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: texGenAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "texGenAttribute.h" -#include "texGenTransition.h" - -#include -#include - -TypeHandle TexGenAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle TexGenAttribute:: -get_handle() const { - return TexGenTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated TexGenAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TexGenAttribute:: -make_copy() const { - return new TexGenAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated TexGenAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TexGenAttribute:: -make_initial() const { - return new TexGenAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void TexGenAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_tex_gen(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// TexGenTransition. -//////////////////////////////////////////////////////////////////// -void TexGenAttribute:: -set_value_from(const OnTransition *other) { - const TexGenTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int TexGenAttribute:: -compare_values(const OnAttribute *other) const { - const TexGenAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void TexGenAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TexGenAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void TexGenAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/texGenAttribute.h b/panda/src/sgattrib/texGenAttribute.h deleted file mode 100644 index 12a4849d07..0000000000 --- a/panda/src/sgattrib/texGenAttribute.h +++ /dev/null @@ -1,77 +0,0 @@ -// Filename: texGenAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 TEXGENATTRIBUTE_H -#define TEXGENATTRIBUTE_H - -#include - -#include "texGenProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : TexGenAttribute -// Description : See TexGenTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA TexGenAttribute : public OnAttribute { -public: - INLINE TexGenAttribute(); - - INLINE void set_none(); - INLINE void set_texture_projector(); - INLINE void set_sphere_map(); - - INLINE TexGenProperty::Mode get_mode() const; - INLINE LMatrix4f get_plane() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - TexGenProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "TexGenAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "texGenAttribute.I" - -#endif diff --git a/panda/src/sgattrib/texGenTransition.cxx b/panda/src/sgattrib/texGenTransition.cxx index b898d7695a..1b96626400 100644 --- a/panda/src/sgattrib/texGenTransition.cxx +++ b/panda/src/sgattrib/texGenTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "texGenTransition.h" -#include "texGenAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new TexGenTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: TexGenTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated TexGenAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TexGenTransition:: -make_attrib() const { - return new TexGenAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: TexGenTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/texGenTransition.h b/panda/src/sgattrib/texGenTransition.h index 0e753a3011..052ad291fa 100644 --- a/panda/src/sgattrib/texGenTransition.h +++ b/panda/src/sgattrib/texGenTransition.h @@ -45,7 +45,6 @@ public: INLINE LMatrix4f get_plane() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -74,7 +73,6 @@ public: private: static TypeHandle _type_handle; - friend class TexGenAttribute; }; #include "texGenTransition.I" diff --git a/panda/src/sgattrib/texMatrixAttribute.I b/panda/src/sgattrib/texMatrixAttribute.I deleted file mode 100644 index fda038993f..0000000000 --- a/panda/src/sgattrib/texMatrixAttribute.I +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: texMatrixAttribute.I -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: TexMatrixAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TexMatrixAttribute:: -TexMatrixAttribute() { -} diff --git a/panda/src/sgattrib/texMatrixAttribute.cxx b/panda/src/sgattrib/texMatrixAttribute.cxx deleted file mode 100644 index e4b6c3f91d..0000000000 --- a/panda/src/sgattrib/texMatrixAttribute.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: texMatrixAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "texMatrixAttribute.h" -#include "texMatrixTransition.h" - -#include -#include - -TypeHandle TexMatrixAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: TexMatrixAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle TexMatrixAttribute:: -get_handle() const { - return TexMatrixTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexMatrixAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated TexMatrixAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TexMatrixAttribute:: -make_copy() const { - return new TexMatrixAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TexMatrixAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated TexMatrixAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TexMatrixAttribute:: -make_initial() const { - return new TexMatrixAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: TexMatrixAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void TexMatrixAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_tex_matrix(this); -} diff --git a/panda/src/sgattrib/texMatrixAttribute.h b/panda/src/sgattrib/texMatrixAttribute.h deleted file mode 100644 index f4c2b63f68..0000000000 --- a/panda/src/sgattrib/texMatrixAttribute.h +++ /dev/null @@ -1,61 +0,0 @@ -// Filename: texMatrixAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 TEXMATRIXATTRIBUTE_H -#define TEXMATRIXATTRIBUTE_H - -#include - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : TexMatrixAttribute -// Description : See TexMatrixTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA TexMatrixAttribute : public LMatrix4fAttribute { -public: - INLINE TexMatrixAttribute(); - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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() { - LMatrix4fAttribute::init_type(); - register_type(_type_handle, "TexMatrixAttribute", - LMatrix4fAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "texMatrixAttribute.I" - -#endif diff --git a/panda/src/sgattrib/texMatrixTransition.cxx b/panda/src/sgattrib/texMatrixTransition.cxx index 775764f144..1a01c6ed8b 100644 --- a/panda/src/sgattrib/texMatrixTransition.cxx +++ b/panda/src/sgattrib/texMatrixTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "texMatrixTransition.h" -#include "texMatrixAttribute.h" #include @@ -34,16 +33,6 @@ make_copy() const { return new TexMatrixTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: TexMatrixTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated TexMatrixAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TexMatrixTransition:: -make_attrib() const { - return new TexMatrixAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: TexMatrixTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/texMatrixTransition.h b/panda/src/sgattrib/texMatrixTransition.h index c83bfefb6f..f6f81bf724 100644 --- a/panda/src/sgattrib/texMatrixTransition.h +++ b/panda/src/sgattrib/texMatrixTransition.h @@ -35,7 +35,6 @@ public: INLINE TexMatrixTransition(const LMatrix4f &matrix); virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -60,7 +59,6 @@ public: private: static TypeHandle _type_handle; - friend class TexMatrixAttribute; }; #include "texMatrixTransition.I" diff --git a/panda/src/sgattrib/textureApplyAttribute.I b/panda/src/sgattrib/textureApplyAttribute.I deleted file mode 100644 index d533405f0f..0000000000 --- a/panda/src/sgattrib/textureApplyAttribute.I +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: textureApplyAttribute.I -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: TextureApplyAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TextureApplyAttribute:: -TextureApplyAttribute() : - _value(TextureApplyProperty::M_modulate) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::set_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void TextureApplyAttribute:: -set_mode(TextureApplyProperty::Mode mode) { - _value.set_mode(mode); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TextureApplyProperty::Mode TextureApplyAttribute:: -get_mode() const { - return _value.get_mode(); -} diff --git a/panda/src/sgattrib/textureApplyAttribute.cxx b/panda/src/sgattrib/textureApplyAttribute.cxx deleted file mode 100644 index 4c2be26cdc..0000000000 --- a/panda/src/sgattrib/textureApplyAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: textureApplyAttribute.cxx -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "textureApplyAttribute.h" -#include "textureApplyTransition.h" - -#include -#include - -TypeHandle TextureApplyAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle TextureApplyAttribute:: -get_handle() const { - return TextureApplyTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated TextureApplyAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TextureApplyAttribute:: -make_copy() const { - return new TextureApplyAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated TextureApplyAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TextureApplyAttribute:: -make_initial() const { - return new TextureApplyAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void TextureApplyAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_texture_apply(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// TextureApplyTransition. -//////////////////////////////////////////////////////////////////// -void TextureApplyAttribute:: -set_value_from(const OnTransition *other) { - const TextureApplyTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int TextureApplyAttribute:: -compare_values(const OnAttribute *other) const { - const TextureApplyAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void TextureApplyAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void TextureApplyAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/textureApplyAttribute.h b/panda/src/sgattrib/textureApplyAttribute.h deleted file mode 100644 index 7521861fb3..0000000000 --- a/panda/src/sgattrib/textureApplyAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: textureApplyAttribute.h -// Created by: drose (23Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 TEXTUREAPPLYATTRIBUTE_H -#define TEXTUREAPPLYATTRIBUTE_H - -#include - -#include "textureApplyProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : TextureApplyAttribute -// Description : See TextureApplyTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA TextureApplyAttribute : public OnAttribute { -public: - INLINE TextureApplyAttribute(); - - INLINE void set_mode(TextureApplyProperty::Mode mode); - INLINE TextureApplyProperty::Mode get_mode() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - TextureApplyProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "TextureApplyAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "textureApplyAttribute.I" - -#endif diff --git a/panda/src/sgattrib/textureApplyTransition.cxx b/panda/src/sgattrib/textureApplyTransition.cxx index eaaf9226e4..3f7dbc334b 100644 --- a/panda/src/sgattrib/textureApplyTransition.cxx +++ b/panda/src/sgattrib/textureApplyTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "textureApplyTransition.h" -#include "textureApplyAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new TextureApplyTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: TextureApplyTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated TextureApplyAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TextureApplyTransition:: -make_attrib() const { - return new TextureApplyAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: TextureApplyTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/textureApplyTransition.h b/panda/src/sgattrib/textureApplyTransition.h index c8cc33e4cc..ff6bab51e2 100644 --- a/panda/src/sgattrib/textureApplyTransition.h +++ b/panda/src/sgattrib/textureApplyTransition.h @@ -38,7 +38,6 @@ public: INLINE TextureApplyProperty::Mode get_mode() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -76,7 +75,6 @@ public: private: static TypeHandle _type_handle; - friend class TextureApplyAttribute; }; #include "textureApplyTransition.I" diff --git a/panda/src/sgattrib/textureAttribute.I b/panda/src/sgattrib/textureAttribute.I deleted file mode 100644 index ec6dc145b8..0000000000 --- a/panda/src/sgattrib/textureAttribute.I +++ /dev/null @@ -1,52 +0,0 @@ -// Filename: textureAttribute.I -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: TextureAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TextureAttribute:: -TextureAttribute() { -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::set_on -// Access: Public -// Description: Changes the TextureAttribute to render the particular -// texture. -//////////////////////////////////////////////////////////////////// -INLINE void TextureAttribute:: -set_on(Texture *texture) { - nassertv(texture != (Texture *)NULL); - _value = texture; - OnOffAttribute::set_on(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::get_texture -// Access: Public -// Description: Returns the texture that the TextureAttribute -// represents. It is only valid to call this if is_on() -// has returned true. -//////////////////////////////////////////////////////////////////// -INLINE PT(Texture) TextureAttribute:: -get_texture() const { - nassertr(is_on(), NULL); - return _value; -} diff --git a/panda/src/sgattrib/textureAttribute.cxx b/panda/src/sgattrib/textureAttribute.cxx deleted file mode 100644 index d5b2710947..0000000000 --- a/panda/src/sgattrib/textureAttribute.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// Filename: textureAttribute.cxx -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "textureAttribute.h" -#include "textureTransition.h" - -#include -#include - -TypeHandle TextureAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle TextureAttribute:: -get_handle() const { - return TextureTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated TextureAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TextureAttribute:: -make_copy() const { - return new TextureAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated TextureAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TextureAttribute:: -make_initial() const { - return new TextureAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void TextureAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_texture(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// TextureTransition. -//////////////////////////////////////////////////////////////////// -void TextureAttribute:: -set_value_from(const OnOffTransition *other) { - const TextureTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; - nassertv(_value != (Texture *)NULL); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int TextureAttribute:: -compare_values(const OnOffAttribute *other) const { - const TextureAttribute *ot; - DCAST_INTO_R(ot, other, false); - return (int)(_value - ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void TextureAttribute:: -output_value(ostream &out) const { - nassertv(_value != (Texture *)NULL); - out << *_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TextureAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void TextureAttribute:: -write_value(ostream &out, int indent_level) const { - nassertv(_value != (Texture *)NULL); - indent(out, indent_level) << *_value << "\n"; -} diff --git a/panda/src/sgattrib/textureAttribute.h b/panda/src/sgattrib/textureAttribute.h deleted file mode 100644 index 51643d4107..0000000000 --- a/panda/src/sgattrib/textureAttribute.h +++ /dev/null @@ -1,72 +0,0 @@ -// Filename: textureAttribute.h -// Created by: drose (22Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 TEXTUREATTRIBUTE_H -#define TEXTUREATTRIBUTE_H - -#include - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : TextureAttribute -// Description : See TextureTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA TextureAttribute : public OnOffAttribute { -public: - INLINE TextureAttribute(); - - INLINE void set_on(Texture *texture); - INLINE PT(Texture) get_texture() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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; - - PT(Texture) _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() { - OnOffAttribute::init_type(); - register_type(_type_handle, "TextureAttribute", - OnOffAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "textureAttribute.I" - -#endif diff --git a/panda/src/sgattrib/textureTransition.cxx b/panda/src/sgattrib/textureTransition.cxx index 6669826da2..5fa5afe2ec 100644 --- a/panda/src/sgattrib/textureTransition.cxx +++ b/panda/src/sgattrib/textureTransition.cxx @@ -19,7 +19,6 @@ #include "config_sgattrib.h" #include "textureTransition.h" -#include "textureAttribute.h" #include #include @@ -40,16 +39,6 @@ make_copy() const { return new TextureTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: TextureTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated TextureAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TextureTransition:: -make_attrib() const { - return new TextureAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: TextureTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/textureTransition.h b/panda/src/sgattrib/textureTransition.h index 1467d470e9..1bf076b300 100644 --- a/panda/src/sgattrib/textureTransition.h +++ b/panda/src/sgattrib/textureTransition.h @@ -53,7 +53,6 @@ public: INLINE PT(Texture) get_texture() const; virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -92,7 +91,6 @@ public: private: static TypeHandle _type_handle; - friend class TextureAttribute; }; #include "textureTransition.I" diff --git a/panda/src/sgattrib/transformAttribute.I b/panda/src/sgattrib/transformAttribute.I deleted file mode 100644 index 920ce51021..0000000000 --- a/panda/src/sgattrib/transformAttribute.I +++ /dev/null @@ -1,26 +0,0 @@ -// Filename: transformAttribute.I -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: TransformAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TransformAttribute:: -TransformAttribute() { -} diff --git a/panda/src/sgattrib/transformAttribute.cxx b/panda/src/sgattrib/transformAttribute.cxx deleted file mode 100644 index 6b3d29545a..0000000000 --- a/panda/src/sgattrib/transformAttribute.cxx +++ /dev/null @@ -1,70 +0,0 @@ -// Filename: transformAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "transformAttribute.h" -#include "transformTransition.h" - -#include -#include - -TypeHandle TransformAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: TransformAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle TransformAttribute:: -get_handle() const { - return TransformTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransformAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated TransformAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TransformAttribute:: -make_copy() const { - return new TransformAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransformAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated TransformAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TransformAttribute:: -make_initial() const { - return new TransformAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: TransformAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void TransformAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_transform(this); -} diff --git a/panda/src/sgattrib/transformAttribute.h b/panda/src/sgattrib/transformAttribute.h deleted file mode 100644 index 7f02aeb780..0000000000 --- a/panda/src/sgattrib/transformAttribute.h +++ /dev/null @@ -1,61 +0,0 @@ -// Filename: transformAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 TRANSFORMATTRIBUTE_H -#define TRANSFORMATTRIBUTE_H - -#include - -#include -#include - -//////////////////////////////////////////////////////////////////// -// Class : TransformAttribute -// Description : See TransformTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA TransformAttribute : public LMatrix4fAttribute { -public: - INLINE TransformAttribute(); - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -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() { - LMatrix4fAttribute::init_type(); - register_type(_type_handle, "TransformAttribute", - LMatrix4fAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "transformAttribute.I" - -#endif diff --git a/panda/src/sgattrib/transformTransition.cxx b/panda/src/sgattrib/transformTransition.cxx index 0388fe64be..3dca607970 100644 --- a/panda/src/sgattrib/transformTransition.cxx +++ b/panda/src/sgattrib/transformTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "transformTransition.h" -#include "transformAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new TransformTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: TransformTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated TransformAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TransformTransition:: -make_attrib() const { - return new TransformAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: TransformTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/transformTransition.h b/panda/src/sgattrib/transformTransition.h index 86cad874cb..bb908f1459 100644 --- a/panda/src/sgattrib/transformTransition.h +++ b/panda/src/sgattrib/transformTransition.h @@ -34,7 +34,6 @@ public: INLINE TransformTransition(const LMatrix4f &matrix); virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -66,7 +65,6 @@ public: private: static TypeHandle _type_handle; - friend class TransformAttribute; }; #include "transformTransition.I" diff --git a/panda/src/sgattrib/transparencyAttribute.I b/panda/src/sgattrib/transparencyAttribute.I deleted file mode 100644 index 5dcb0e2d32..0000000000 --- a/panda/src/sgattrib/transparencyAttribute.I +++ /dev/null @@ -1,48 +0,0 @@ -// Filename: transparencyAttribute.I -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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: TransparencyAttribute::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TransparencyAttribute:: -TransparencyAttribute() : - _value(TransparencyProperty::M_none) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE TransparencyProperty::Mode TransparencyAttribute:: -get_mode() const { - return _value.get_mode(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::get_mode -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE void TransparencyAttribute:: -set_mode(TransparencyProperty::Mode mode) { - _value.set_mode(mode); -} diff --git a/panda/src/sgattrib/transparencyAttribute.cxx b/panda/src/sgattrib/transparencyAttribute.cxx deleted file mode 100644 index b3f155436f..0000000000 --- a/panda/src/sgattrib/transparencyAttribute.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Filename: transparencyAttribute.cxx -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 "transparencyAttribute.h" -#include "transparencyTransition.h" - -#include -#include - -TypeHandle TransparencyAttribute::_type_handle; - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::get_handle -// Access: Public, Virtual -// Description: Returns the handle of the associated transition. -//////////////////////////////////////////////////////////////////// -TypeHandle TransparencyAttribute:: -get_handle() const { - return TransparencyTransition::get_class_type(); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::make_copy -// Access: Public, Virtual -// Description: Returns a newly allocated TransparencyAttribute just like -// this one. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TransparencyAttribute:: -make_copy() const { - return new TransparencyAttribute(*this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::make_initial -// Access: Public, Virtual -// Description: Returns a newly allocated TransparencyAttribute -// corresponding to the default initial state. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TransparencyAttribute:: -make_initial() const { - return new TransparencyAttribute; -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::issue -// Access: Public, Virtual -// Description: This is called on scene graph rendering attributes -// when it is time to issue the particular attribute to -// the graphics engine. It should call the appropriate -// method on GraphicsStateGuardianBase. -//////////////////////////////////////////////////////////////////// -void TransparencyAttribute:: -issue(GraphicsStateGuardianBase *gsgbase) { - gsgbase->issue_transparency(this); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::set_value_from -// Access: Protected, Virtual -// Description: Copies the value from the indicated transition -// pointer, which is guaranteed to be of type -// TransparencyTransition. -//////////////////////////////////////////////////////////////////// -void TransparencyAttribute:: -set_value_from(const OnTransition *other) { - const TransparencyTransition *ot; - DCAST_INTO_V(ot, other); - _value = ot->_value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::compare_values -// Access: Protected, Virtual -// Description: -//////////////////////////////////////////////////////////////////// -int TransparencyAttribute:: -compare_values(const OnAttribute *other) const { - const TransparencyAttribute *ot; - DCAST_INTO_R(ot, other, false); - return _value.compare_to(ot->_value); -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::output_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on one line. -//////////////////////////////////////////////////////////////////// -void TransparencyAttribute:: -output_value(ostream &out) const { - out << _value; -} - -//////////////////////////////////////////////////////////////////// -// Function: TransparencyAttribute::write_value -// Access: Protected, Virtual -// Description: Formats the value for human consumption on multiple -// lines if necessary. -//////////////////////////////////////////////////////////////////// -void TransparencyAttribute:: -write_value(ostream &out, int indent_level) const { - indent(out, indent_level) << _value << "\n"; -} diff --git a/panda/src/sgattrib/transparencyAttribute.h b/panda/src/sgattrib/transparencyAttribute.h deleted file mode 100644 index d6cfba42cc..0000000000 --- a/panda/src/sgattrib/transparencyAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -// Filename: transparencyAttribute.h -// Created by: drose (24Mar00) -// -//////////////////////////////////////////////////////////////////// -// -// 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 TRANSPARENCYATTRIBUTE_H -#define TRANSPARENCYATTRIBUTE_H - -#include - -#include "transparencyProperty.h" - -#include - -//////////////////////////////////////////////////////////////////// -// Class : TransparencyAttribute -// Description : See TransparencyTransition. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA TransparencyAttribute : public OnAttribute { -public: - INLINE TransparencyAttribute(); - - INLINE void set_mode(TransparencyProperty::Mode mode); - INLINE TransparencyProperty::Mode get_mode() const; - - virtual TypeHandle get_handle() const; - virtual NodeAttribute *make_copy() const; - virtual NodeAttribute *make_initial() const; - - virtual void issue(GraphicsStateGuardianBase *gsgbase); - -protected: - virtual void set_value_from(const OnTransition *other); - virtual int compare_values(const OnAttribute *other) const; - virtual void output_value(ostream &out) const; - virtual void write_value(ostream &out, int indent_level) const; - - TransparencyProperty _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() { - OnAttribute::init_type(); - register_type(_type_handle, "TransparencyAttribute", - OnAttribute::get_class_type()); - } - -private: - static TypeHandle _type_handle; -}; - -#include "transparencyAttribute.I" - -#endif diff --git a/panda/src/sgattrib/transparencyTransition.cxx b/panda/src/sgattrib/transparencyTransition.cxx index c7aa9e95e0..462a2e04e3 100644 --- a/panda/src/sgattrib/transparencyTransition.cxx +++ b/panda/src/sgattrib/transparencyTransition.cxx @@ -17,7 +17,6 @@ //////////////////////////////////////////////////////////////////// #include "transparencyTransition.h" -#include "transparencyAttribute.h" #include #include @@ -38,16 +37,6 @@ make_copy() const { return new TransparencyTransition(*this); } -//////////////////////////////////////////////////////////////////// -// Function: TransparencyTransition::make_attrib -// Access: Public, Virtual -// Description: Returns a newly allocated TransparencyAttribute. -//////////////////////////////////////////////////////////////////// -NodeAttribute *TransparencyTransition:: -make_attrib() const { - return new TransparencyAttribute; -} - //////////////////////////////////////////////////////////////////// // Function: TransparencyTransition::make_initial // Access: Public, Virtual diff --git a/panda/src/sgattrib/transparencyTransition.h b/panda/src/sgattrib/transparencyTransition.h index 477251f8f9..88d4564f04 100644 --- a/panda/src/sgattrib/transparencyTransition.h +++ b/panda/src/sgattrib/transparencyTransition.h @@ -46,7 +46,6 @@ PUBLISHED: public: virtual NodeTransition *make_copy() const; - virtual NodeAttribute *make_attrib() const; virtual NodeTransition *make_initial() const; virtual void issue(GraphicsStateGuardianBase *gsgbase); @@ -84,7 +83,6 @@ public: private: static TypeHandle _type_handle; - friend class TransparencyAttribute; }; #include "transparencyTransition.I" diff --git a/panda/src/sgraph/geomNode.h b/panda/src/sgraph/geomNode.h index c129deaf72..5d7f6972c6 100644 --- a/panda/src/sgraph/geomNode.h +++ b/panda/src/sgraph/geomNode.h @@ -29,7 +29,6 @@ #include class GraphicsStateGuardianBase; -class AllAttributesWrapper; class GeomNodeContext; //////////////////////////////////////////////////////////////////// diff --git a/panda/src/sgraphutil/appTraverser.h b/panda/src/sgraphutil/appTraverser.h index 77e8aa4499..f0a1ee6fbd 100644 --- a/panda/src/sgraphutil/appTraverser.h +++ b/panda/src/sgraphutil/appTraverser.h @@ -25,7 +25,6 @@ #include #include #include -#include #include class Node; diff --git a/panda/src/sgraphutil/directRenderTraverser.cxx b/panda/src/sgraphutil/directRenderTraverser.cxx index ba324c54ba..9cc751232d 100644 --- a/panda/src/sgraphutil/directRenderTraverser.cxx +++ b/panda/src/sgraphutil/directRenderTraverser.cxx @@ -37,7 +37,6 @@ #include #include #include -#include #include // for support_decals #include diff --git a/panda/src/sgraphutil/directRenderTraverser.h b/panda/src/sgraphutil/directRenderTraverser.h index a1f9fc7c32..fcfe9fc6e0 100644 --- a/panda/src/sgraphutil/directRenderTraverser.h +++ b/panda/src/sgraphutil/directRenderTraverser.h @@ -35,7 +35,6 @@ class Node; class GraphicsStateGuardian; class GeometricBoundingVolume; -class NodeAttributes; //////////////////////////////////////////////////////////////////// // Class : DirectRenderTraverser diff --git a/panda/src/switchnode/LODNode.cxx b/panda/src/switchnode/LODNode.cxx index 30ed3c8283..a3ec840f0a 100644 --- a/panda/src/switchnode/LODNode.cxx +++ b/panda/src/switchnode/LODNode.cxx @@ -25,7 +25,6 @@ #include "luse.h" #include "renderRelation.h" #include "transformTransition.h" -#include "allAttributesWrapper.h" #include "allTransitionsWrapper.h" #include "nodeTransitionWrapper.h" #include "renderTraverser.h" diff --git a/panda/src/switchnode/sequenceNode.cxx b/panda/src/switchnode/sequenceNode.cxx index 57647c1929..62e6895f66 100644 --- a/panda/src/switchnode/sequenceNode.cxx +++ b/panda/src/switchnode/sequenceNode.cxx @@ -26,7 +26,6 @@ #include "config_switchnode.h" #include -#include #include #include #include diff --git a/panda/src/switchnode/test_sequences.cxx b/panda/src/switchnode/test_sequences.cxx index 82164e17e1..cde542cdc6 100644 --- a/panda/src/switchnode/test_sequences.cxx +++ b/panda/src/switchnode/test_sequences.cxx @@ -38,7 +38,6 @@ ConfigureFn(sequences) { //Framework extern variables and functions extern PT_NamedNode render; -extern NodeAttributes initial_state; extern RenderRelation* first_arc; extern PT_NamedNode lights; extern PT_NamedNode root; diff --git a/panda/src/tform/buttonThrower.cxx b/panda/src/tform/buttonThrower.cxx index 27bc638b7e..7dea448b96 100644 --- a/panda/src/tform/buttonThrower.cxx +++ b/panda/src/tform/buttonThrower.cxx @@ -19,9 +19,9 @@ #include "buttonThrower.h" #include -#include +#include #include -#include +#include #include TypeHandle ButtonThrower::_type_handle; @@ -121,10 +121,10 @@ set_modifier_buttons(const ModifierButtons &mods) { // element. //////////////////////////////////////////////////////////////////// void ButtonThrower:: -transmit_data(NodeAttributes &data) { - const ButtonEventDataAttribute *b; - if (get_attribute_into(b, data, _button_events_type)) { - ButtonEventDataAttribute::const_iterator bi; +transmit_data(AllTransitionsWrapper &data) { + 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); string event_name = _prefix + be._button.get_name(); diff --git a/panda/src/tform/buttonThrower.h b/panda/src/tform/buttonThrower.h index 03ebf81a9c..e54b676f91 100644 --- a/panda/src/tform/buttonThrower.h +++ b/panda/src/tform/buttonThrower.h @@ -32,7 +32,7 @@ // This is a DataNode which is intended to be parented // to the data graph below a device which is generating // a sequence of button events as stored in an -// ButtonEventDataAttributes data member. It simply +// ButtonEventDataTransitions data member. It simply // takes each button it finds and throws a corresponding // event based on the button name via the throw_event() // call. @@ -58,7 +58,7 @@ protected: public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); // inputs static TypeHandle _button_events_type; diff --git a/panda/src/tform/dataValve.cxx b/panda/src/tform/dataValve.cxx index 643ab98781..a65755d221 100644 --- a/panda/src/tform/dataValve.cxx +++ b/panda/src/tform/dataValve.cxx @@ -18,10 +18,9 @@ #include "dataValve.h" -#include -#include -#include -#include +#include "dataRelation.h" +#include "buttonEventDataTransition.h" +#include "allTransitionsWrapper.h" TypeHandle DataValve::_type_handle; @@ -299,10 +298,10 @@ ensure_child_index(int child_index) { // to process its inputs. //////////////////////////////////////////////////////////////////// void DataValve:: -transmit_data(NodeAttributes &data) { +transmit_data(AllTransitionsWrapper &data) { // Update our modifier buttons during the overall pass. - const ButtonEventDataAttribute *b; - if (get_attribute_into(b, data, _button_events_type)) { + const ButtonEventDataTransition *b; + if (get_transition_into(b, data, _button_events_type)) { b->update_mods(_mods); } } @@ -313,15 +312,15 @@ transmit_data(NodeAttributes &data) { // 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 DataValve:: -transmit_data_per_child(NodeAttributes &data, int child_index) { +transmit_data_per_child(AllTransitionsWrapper &data, int child_index) { // Consider which data this child wants to see. static const FineControls empty_controls; @@ -350,7 +349,7 @@ transmit_data_per_child(NodeAttributes &data, int child_index) { Control *fcontrol = (*fci).second; if (!fcontrol->is_on(*this)) { - data.clear_attribute(data_type); + data.clear_transition(data_type); } } } @@ -364,7 +363,7 @@ transmit_data_per_child(NodeAttributes &data, int child_index) { } else { // The control is off, and we have some fine-tuning. Any data // type explicitly "on" should be preserved. - NodeAttributes temp; + AllTransitionsWrapper temp; FineControls::const_iterator fci; for (fci = fine_controls->begin(); fci != fine_controls->end(); ++fci) { @@ -372,9 +371,9 @@ transmit_data_per_child(NodeAttributes &data, int child_index) { Control *fcontrol = (*fci).second; if (fcontrol->is_on(*this)) { - NodeAttribute *attrib = data.get_attribute(data_type); - if (attrib != (NodeAttribute *)NULL) { - temp.set_attribute(data_type, attrib); + NodeTransition *attrib = data.get_transition(data_type); + if (attrib != (NodeTransition *)NULL) { + temp.set_transition(data_type, attrib); } } } diff --git a/panda/src/tform/dataValve.h b/panda/src/tform/dataValve.h index eee3659d80..81ce51318d 100644 --- a/panda/src/tform/dataValve.h +++ b/panda/src/tform/dataValve.h @@ -19,12 +19,12 @@ #ifndef DATAVALVE_H #define DATAVALVE_H -#include +#include "pandabase.h" -#include -#include -#include -#include +#include "dataNode.h" +#include "modifierButtons.h" +#include "referenceCount.h" +#include "pointerTo.h" //////////////////////////////////////////////////////////////////// // Class : DataValve @@ -111,10 +111,10 @@ private: //////////////////////////////////////////////////////////////////// public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); virtual void - transmit_data_per_child(NodeAttributes &data, int child_index); + transmit_data_per_child(AllTransitionsWrapper &data, int child_index); // inputs static TypeHandle _button_events_type; diff --git a/panda/src/tform/driveInterface.cxx b/panda/src/tform/driveInterface.cxx index c405fc617a..863e708b1e 100644 --- a/panda/src/tform/driveInterface.cxx +++ b/panda/src/tform/driveInterface.cxx @@ -25,11 +25,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include TypeHandle DriveInterface::_type_handle; @@ -142,9 +142,9 @@ DriveInterface(const string &name) : DataNode(name) { _mods.add_button(MouseButton::two()); _mods.add_button(MouseButton::three()); - _transform = new MatrixDataAttribute; + _transform = new MatrixDataTransition; _transform->set_value(_mat); - _attrib.set_attribute(_transform_type, _transform); + _attrib.set_transition(_transform_type, _transform); } @@ -410,7 +410,7 @@ recompute() { // Description: Convert mouse data into a driveInterface matrix //////////////////////////////////////////////////////////////////// void DriveInterface:: -transmit_data(NodeAttributes &data) { +transmit_data(AllTransitionsWrapper &data) { // Look for mouse activity. double x = 0.0; @@ -418,8 +418,8 @@ transmit_data(NodeAttributes &data) { bool got_mouse = false; - const Vec3DataAttribute *xyz; - if (get_attribute_into(xyz, data, _xyz_type)) { + const Vec3DataTransition *xyz; + if (get_transition_into(xyz, data, _xyz_type)) { LVecBase3f p = xyz->get_value(); x = p[0]; y = p[1]; @@ -428,9 +428,9 @@ transmit_data(NodeAttributes &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); if (be._down) { diff --git a/panda/src/tform/driveInterface.h b/panda/src/tform/driveInterface.h index 124883a7b2..f7a5603c55 100644 --- a/panda/src/tform/driveInterface.h +++ b/panda/src/tform/driveInterface.h @@ -23,10 +23,10 @@ #include #include -#include +#include #include -#include -#include +#include +#include #include #include #include @@ -167,10 +167,10 @@ private: public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); - NodeAttributes _attrib; - PT(MatrixDataAttribute) _transform; + AllTransitionsWrapper _attrib; + PT(MatrixDataTransition) _transform; // inputs static TypeHandle _xyz_type; diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 6229d8380d..d115543ede 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -23,7 +23,6 @@ #include "mouse.h" #include "mouseData.h" #include "buttonEventDataTransition.h" -#include "buttonEventDataAttribute.h" #include "mouseButton.h" #include "throw_event.h" #include "eventParameter.h" @@ -461,10 +460,10 @@ global_keyboard_release(const MouseWatcherParameter ¶m) { // Description: Convert mouse data into a mouseWatcher matrix //////////////////////////////////////////////////////////////////// void MouseWatcher:: -transmit_data(NodeAttributes &data) { +transmit_data(AllTransitionsWrapper &data) { // Get the current mouse position. - const Vec3DataAttribute *xyz; - if (!get_attribute_into(xyz, data, _xyz_type)) { + const Vec3DataTransition *xyz; + if (!get_transition_into(xyz, data, _xyz_type)) { if (_has_mouse) { // Hide the mouse pointer. if (!_geometry.is_null()) { @@ -512,9 +511,9 @@ transmit_data(NodeAttributes &data) { } // Look for button 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); _mods.add_event(be); @@ -537,8 +536,8 @@ transmit_data(NodeAttributes &data) { // really only want to suppress the mouse position information. // Button events must still get through. - data.clear_attribute(_xyz_type); - data.clear_attribute(_pixel_xyz_type); + data.clear_transition(_xyz_type); + data.clear_transition(_pixel_xyz_type); } } diff --git a/panda/src/tform/mouseWatcher.h b/panda/src/tform/mouseWatcher.h index 7df4c75049..6c192eee65 100644 --- a/panda/src/tform/mouseWatcher.h +++ b/panda/src/tform/mouseWatcher.h @@ -26,7 +26,6 @@ #include "dataNode.h" #include "vec3DataTransition.h" -#include "vec3DataAttribute.h" #include "luse.h" #include "nodeRelation.h" #include "pointerTo.h" @@ -147,7 +146,7 @@ private: public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); // inputs & outputs static TypeHandle _xyz_type; diff --git a/panda/src/tform/planarSlider.cxx b/panda/src/tform/planarSlider.cxx index 7b00f7f9f2..7f2046d65e 100644 --- a/panda/src/tform/planarSlider.cxx +++ b/panda/src/tform/planarSlider.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -46,8 +46,8 @@ PlanarSlider(const string &name) : DataNode(name) { _mouse_pos.set(0.0, 0.0); _transform_mat = LMatrix4f::ident_mat(); - _transform = new MatrixDataAttribute; - _attrib.set_attribute(_transform_type, _transform); + _transform = new MatrixDataTransition; + _attrib.set_transition(_transform_type, _transform); _mods.add_button(MouseButton::one()); } @@ -161,19 +161,19 @@ get_mouse_pos() const { // Description: Convert mouse data into a planarSlider matrix //////////////////////////////////////////////////////////////////// void PlanarSlider:: -transmit_data(NodeAttributes &data) { +transmit_data(AllTransitionsWrapper &data) { // First, update our modifier buttons. - const ButtonEventDataAttribute *b; - if (get_attribute_into(b, data, _button_events_type)) { + const ButtonEventDataTransition *b; + if (get_transition_into(b, data, _button_events_type)) { b->update_mods(_mods); } // Now look for a mouse position. - const NodeAttribute *xyz = data.get_attribute(_xyz_type); + const NodeTransition *xyz = data.get_transition(_xyz_type); - if (xyz != (NodeAttribute *)NULL) { + if (xyz != (NodeTransition *)NULL) { if (_mods.is_any_down()) { - LVecBase3f p = DCAST(Vec3DataAttribute, xyz)->get_value(); + LVecBase3f p = DCAST(Vec3DataTransition, xyz)->get_value(); set_mouse_pos(LPoint2f(p[0], p[1])); } } diff --git a/panda/src/tform/planarSlider.h b/panda/src/tform/planarSlider.h index 664d834a72..b702c23c68 100644 --- a/panda/src/tform/planarSlider.h +++ b/panda/src/tform/planarSlider.h @@ -23,10 +23,8 @@ #include #include -#include #include -#include -#include +#include #include #include #include @@ -68,10 +66,10 @@ private: public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); - NodeAttributes _attrib; - PT(MatrixDataAttribute) _transform; + AllTransitionsWrapper _attrib; + PT(MatrixDataTransition) _transform; // inputs static TypeHandle _xyz_type; diff --git a/panda/src/tform/trackball.cxx b/panda/src/tform/trackball.cxx index 0f2e8d8081..739d075f3f 100644 --- a/panda/src/tform/trackball.cxx +++ b/panda/src/tform/trackball.cxx @@ -18,14 +18,13 @@ #include "trackball.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include "compose_matrix.h" +#include "mouse.h" +#include "mouseData.h" +#include "modifierButtons.h" +#include "buttonEventDataTransition.h" +#include "mouseButton.h" +#include "get_rel_pos.h" TypeHandle Trackball::_type_handle; @@ -62,9 +61,9 @@ Trackball(const string &name) : DataNode(name) { _mods.add_button(MouseButton::two()); _mods.add_button(MouseButton::three()); - _transform = new MatrixDataAttribute; + _transform = new MatrixDataTransition; _transform->set_value(LMatrix4f::ident_mat()); - _attrib.set_attribute(_transform_type, _transform); + _attrib.set_transition(_transform_type, _transform); } //////////////////////////////////////////////////////////////////// @@ -482,18 +481,18 @@ recompute() { // Description: Convert mouse data into a trackball matrix //////////////////////////////////////////////////////////////////// void Trackball:: -transmit_data(NodeAttributes &data) { +transmit_data(AllTransitionsWrapper &data) { // First, update our modifier buttons. - const ButtonEventDataAttribute *b; - if (get_attribute_into(b, data, _button_events_type)) { + const ButtonEventDataTransition *b; + if (get_transition_into(b, data, _button_events_type)) { b->update_mods(_mods); } // Now, check for mouse motion. - const NodeAttribute *pixel_xyz = data.get_attribute(_pixel_xyz_type); + const NodeTransition *pixel_xyz = data.get_transition(_pixel_xyz_type); - if (pixel_xyz != (NodeAttribute *)NULL) { - LVecBase3f p = DCAST(Vec3DataAttribute, pixel_xyz)->get_value(); + if (pixel_xyz != (NodeTransition *)NULL) { + LVecBase3f p = DCAST(Vec3DataTransition, pixel_xyz)->get_value(); float this_x = p[0]; float this_y = p[1]; int this_button = 0; diff --git a/panda/src/tform/trackball.h b/panda/src/tform/trackball.h index 4c7264d364..0da056ec64 100644 --- a/panda/src/tform/trackball.h +++ b/panda/src/tform/trackball.h @@ -19,17 +19,15 @@ #ifndef TRACKBALL_H #define TRACKBALL_H -#include +#include "pandabase.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "dataNode.h" +#include "vec3DataTransition.h" +#include "matrixDataTransition.h" +#include "allTransitionsWrapper.h" +#include "modifierButtons.h" +#include "luse.h" +#include "lmatrix.h" //////////////////////////////////////////////////////////////////// @@ -127,10 +125,10 @@ private: public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); - NodeAttributes _attrib; - PT(MatrixDataAttribute) _transform; + AllTransitionsWrapper _attrib; + PT(MatrixDataTransition) _transform; // inputs static TypeHandle _pixel_xyz_type; diff --git a/panda/src/tform/transform2sg.cxx b/panda/src/tform/transform2sg.cxx index 842a9a3393..daa0b0ec68 100644 --- a/panda/src/tform/transform2sg.cxx +++ b/panda/src/tform/transform2sg.cxx @@ -18,11 +18,10 @@ #include "transform2sg.h" -#include -#include -#include -#include -#include +#include "nodeRelation.h" +#include "transformTransition.h" +#include "matrixDataTransition.h" +#include "allTransitionsWrapper.h" TypeHandle Transform2SG::_type_handle; @@ -68,11 +67,11 @@ get_arc() const { // Description: //////////////////////////////////////////////////////////////////// void Transform2SG:: -transmit_data(NodeAttributes &data) { - const NodeAttribute *transform = data.get_attribute(_transform_type); +transmit_data(AllTransitionsWrapper &data) { + const NodeTransition *transform = data.get_transition(_transform_type); - if (transform != (NodeAttribute *)NULL && _arc != (NodeRelation *)NULL) { - const LMatrix4f &mat = DCAST(MatrixDataAttribute, transform)->get_value(); + if (transform != (NodeTransition *)NULL && _arc != (NodeRelation *)NULL) { + const LMatrix4f &mat = DCAST(MatrixDataTransition, transform)->get_value(); _arc->set_transition(new TransformTransition(mat)); } diff --git a/panda/src/tform/transform2sg.h b/panda/src/tform/transform2sg.h index 0a769f4d1b..c37ecd4bf3 100644 --- a/panda/src/tform/transform2sg.h +++ b/panda/src/tform/transform2sg.h @@ -19,9 +19,9 @@ #ifndef TRANSFORM2SG_H #define TRANSFORM2SG_H -#include +#include "pandabase.h" -#include +#include "dataNode.h" class NodeRelation; @@ -30,7 +30,7 @@ class NodeRelation; // Description : input: Transform (matrix) // // output: none, but applies the matrix as the transform -// attribute for a given arc of the scene graph. +// transition for a given arc of the scene graph. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA Transform2SG : public DataNode { PUBLISHED: @@ -48,7 +48,7 @@ private: public: virtual void - transmit_data(NodeAttributes &data); + transmit_data(AllTransitionsWrapper &data); // inputs static TypeHandle _transform_type; diff --git a/panda/src/wgldisplay/test_wgl.cxx b/panda/src/wgldisplay/test_wgl.cxx index a9dcfab11a..a14a693405 100644 --- a/panda/src/wgldisplay/test_wgl.cxx +++ b/panda/src/wgldisplay/test_wgl.cxx @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -27,14 +26,13 @@ PT(GraphicsPipe) main_pipe; PT(GraphicsWindow) main_win; PT_NamedNode render; -NodeAttributes initial_state; void render_frame(GraphicsPipe *pipe) { GraphicsPipe::wins_iterator wi; for (wi = pipe->get_win_begin(); wi != pipe->get_win_end(); ++wi) { - (*wi)->get_gsg()->render_frame(initial_state); + (*wi)->get_gsg()->render_frame(); } }