// 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