00001
00008
00009
00010
00011
00012
00013 #ifndef ENG_NODE_HH
00014 #define ENG_NODE_HH 1
00015
00016 namespace eng {
00017
00018
00019
00020 #ifndef NODE_PRIVATE
00021 #define NODE_PRIVATE private
00022 #endif
00023 #ifndef NODE_PROTECTED
00024 #define NODE_PROTECTED protected
00025 #endif
00026
00027
00028 #ifndef MORE_NODE_FRIENDS
00029 #define MORE_NODE_FRIENDS
00030 #endif
00031 #define NODE_FRIENDS \
00032 friend class Value; friend class NodeClones; \
00033 friend class Graph; friend class GraphMaker; friend class GraphImporter; \
00034 MORE_NODE_FRIENDS
00035
00036 class Node;
00037 class Visitor;
00038 class Graph;
00039 class NodeClones;
00040
00041 #if DEBUG
00042 void CheckNode( const Node* node, bool nullOk );
00043 void CHECK_PATERNITY( const Node& parent, const Node& child );
00044 template<typename NODE> void CHECK_NODE( SharedPtrNull<NODE> node ) { CheckNode( node.CONST_PTR(), false ); }
00045 template<typename NODE> void CHECK_NODE_NULL_OK( SharedPtrNull<NODE> node ) { CheckNode( node.CONST_PTR(), true ); }
00046 INLINE void CHECK_NODE( const Node* node ) { CheckNode( node, false ); }
00047 #else
00048 #define CHECK_NODE(NODE)
00049 #define CHECK_NODE_NULL_OK(NODE)
00050 #define CHECK_PATERNITY(parent,child)
00051 #endif
00052
00066 class Node : public Shared
00067 {
00068
00069
00071 #define NULL_NODE (NULL)
00072 #define IF_NODE(NODE) ((NODE) != (NULL))
00073
00074
00075
00076 public: typedef SharedPtrNull<Node> Ptr;
00077 protected: typedef uint Idx;
00078 protected: CLASS_CONST Idx INVALID_IDX = 0xb00bb00b;
00079
00080
00081
00082
00083
00084 NODE_PROTECTED:
00085 enum TypeId
00086 {
00087 ID_LOD_NODE,
00088 ID_PARTITION_NODE,
00089 ID_TRANSFORM_NODE,
00090 ID_VERTEXS_NODE,
00091 ID_NORMALS_NODE,
00092 ID_MODES_NODE,
00093 ID_MATERIAL_NODE,
00094 ID_TEXTURE_NODE,
00095 ID_COLORS_NODE,
00096 ID_POLYGON_NODE,
00097 ID_SPECIAL_NODE
00098 };
00099
00100 NODE_PROTECTED: virtual TypeId GetTypeId( void ) const = 0;
00101
00102
00103
00104
00105
00106 public:
00122 class Value
00123 {
00124
00125 friend bool operator<( const Node& node1, const Node& node2 );
00126 NODE_PROTECTED:
00128
00129 enum ePriority1
00130 {
00131 ePriority1_LodNode = 10,
00132 ePriority1_PartitionNode = 9,
00133 ePriority1_TransformNode = 8,
00134 ePriority1_VertexsNode = 7,
00135 ePriority1_NormalsNode = 6,
00136 ePriority1_ModesNode = 5,
00137 ePriority1_MaterialNode = 4,
00138 ePriority1_TextureNode = 3,
00139 ePriority1_ColorsNode = 2,
00140 ePriority1_PolygonNode = 1,
00141 ePriority1_SpecialNode = 0
00142 };
00143 public:
00144 Value( void ) { }
00145 virtual ~Value() { }
00146 NODE_PROTECTED:
00147 virtual ePriority1 GetPriority1( void ) const = 0;
00148 virtual bool LessThan( const Value& otherValue ) const
00149 {
00150
00151
00152 return GetPriority1() < otherValue.GetPriority1();
00153 }
00154 };
00155
00156 public:
00158 friend inline bool
00159 operator<( const Node& node1, const Node& node2 )
00160 {
00161 CHECK_TYPESIG(&node1,TYPESIG_NODE);
00162 CHECK_TYPESIG(&node2,TYPESIG_NODE);
00163
00164 return node1.GetValue().LessThan( node2.GetValue() );
00165 }
00166
00168 friend inline bool
00169 operator==( const Node& node1, const Node& node2 )
00170 {
00171 return (not (node1 < node2))
00172 && (not (node2 < node1));
00173 }
00174
00176 friend inline bool
00177 operator!=( const Node& node1, const Node& node2 )
00178 {
00179 return not (node1 == node2);
00180 }
00181
00182 NODE_PROTECTED:
00189 class SortableNode
00190 {
00191
00192 public:
00193 SortableNode( void ) : mNode(NULL_NODE) { }
00194 SortableNode( Node::Ptr node ) : mNode(node) { CHECK_TYPESIG(node,TYPESIG_NODE); }
00195 Node::Ptr GetNode( void ) const { CHECK_TYPESIG_NULL_OK(mNode,TYPESIG_NODE); return mNode; }
00196 operator Node::Ptr() const { return GetNode(); }
00197
00198 friend inline bool operator==( const SortableNode& node1, const SortableNode& node2 )
00199 { return *node1.mNode == *node2.mNode; }
00200 friend inline bool operator<( const SortableNode& node1, const SortableNode& node2 )
00201 { return *node1.mNode < *node2.mNode; }
00202
00203 private:
00204 Node::Ptr mNode;
00205 };
00206
00207 NODE_PROTECTED:
00216 class SortedNodes
00217 {
00218
00219 public:
00220 SortedNodes( void );
00221 SortedNodes( const SortedNodes& src );
00222 SortedNodes& operator=( const SortedNodes& src );
00223 ~SortedNodes();
00224
00225 const SortableNode& operator[]( uint i ) const { return (*mSortedNodes)[i]; }
00226 const SortableNode& front( void ) const;
00227 const SortableNode& back( void ) const;
00228 uint size( void ) const { return (mSortedNodes != NULL) ? mSortedNodes->size() : 0; }
00229 bool empty( void ) const { return size() == 0; }
00230 void clear( void );
00231 pair<bool,uint> find_last( const SortableNode& sortableNode ) const;
00232 uint insert( const SortableNode& sortableNode );
00233 bool remove_first( const SortableNode& sortableNode );
00234 void remove_idx( const uint idx );
00235 private:
00236 SortedArray<SortableNode>* mSortedNodes;
00237 };
00238
00239
00240
00241 public: Node( void );
00242 public: Node( const Node& src );
00243 public: virtual ~Node();
00244 protected: virtual Node::Ptr Clone( void ) const = 0;
00245
00246
00247
00248 protected: bool IfDetached( void ) const;
00249 protected: bool IfChildren( void ) const;
00250
00251
00252
00253
00254
00255
00256
00257 public: virtual const Node::Value& GetValue( void ) const = 0;
00258
00259
00260
00261
00262
00263
00264 public:
00265 Node::Ptr GetParent( void ) const;
00266 NODE_PROTECTED:
00267 SortedNodes& GetChildren( void );
00268 Node::Ptr GetFirstChild( void ) const
00269 {
00270 CHECK_TYPESIG(this,TYPESIG_NODE);
00271 if ( not mChildren.empty() )
00272 {
00273 CHECK_TYPESIG(mChildren.front().GetNode(),TYPESIG_NODE);
00274 CHECK_PATERNITY(*this,*mChildren.front().GetNode());
00275 return mChildren.front();
00276 }
00277 else
00278 return NULL_NODE;
00279 }
00280 Node::Ptr GetLastChild( void ) const;
00281 Node::Ptr GetPrevSibling( void ) const;
00282 Node::Ptr GetNextSibling( void ) const
00283 {
00284 CHECK_TYPESIG(this,TYPESIG_NODE);
00285 if ( (mParent != NULL_NODE) && (mSiblingIdx+1 < mParent->mChildren.size()) )
00286 {
00287 CHECK_TYPESIG(mParent->mChildren[mSiblingIdx+1].GetNode(),TYPESIG_NODE);
00288 return mParent->mChildren[mSiblingIdx+1];
00289 }
00290 else
00291 return NULL_NODE;
00292 }
00293
00294
00295
00296
00297 NODE_PROTECTED: void SetParent( Node::Ptr parent );
00298 public: void AttachSibling( Node::Ptr sibling );
00299 public: virtual void AttachChild( Node::Ptr child );
00300 public: void Detach( const bool keepChildren = false );
00301 public: virtual void DetachChild( Node::Ptr child );
00302
00303
00304
00305 protected: virtual void Accept( Visitor& visitor ) = 0;
00306
00307
00308
00309 protected: virtual void Departure( void ) { }
00310 protected: virtual bool IfDeparture( void ) const { return false; }
00311
00312
00313
00314 NODE_PROTECTED: CLASS_CONST uint VCNT = 4;
00315 NODE_PROTECTED: Node::Ptr mParent;
00316 NODE_PROTECTED: SortedNodes mChildren;
00317 NODE_PROTECTED: Node::Idx mSiblingIdx;
00318 NODE_PRIVATE: Node::Idx mCloneIdx;
00319
00320
00321
00322 NODE_FRIENDS
00323
00324
00325
00326 #if DEBUG
00327 NODE_PRIVATE: CLASS_VAR long msInstanceCnt;
00328 friend void CheckNode( const Node* node, bool nullOk );
00329 #endif
00330
00331 };
00332
00333
00334 }
00335 #include "eng_node_visitor.hh"
00336 namespace eng {
00337
00338
00345 class LodNode : public Node
00346 {
00347 NODE_FRIENDS
00348 public:
00349 typedef SharedPtrNull<LodNode> Ptr;
00350
00351 public:
00355 class Value : public Node::Value
00356 {
00357
00358 friend class LodNode;
00359 public:
00360 Value( void ) { }
00361 ePriority1 GetPriority1( void ) const { return ePriority1_LodNode; }
00362
00363 private:
00365 struct ChildNode
00366 {
00367 ChildNode( Node::Ptr node, ObjectLod objectLod )
00368 : mNode(node), mObjectLod(objectLod) { CHECK_NODE(node); }
00369 const Node::Ptr mNode;
00370 const ObjectLod mObjectLod;
00371 };
00372
00373 private:
00374 ObjectLod mObjectLod;
00375 list<ChildNode> mAllChildren;
00376 };
00377
00378 public: LodNode( const Value& value );
00379 public: LodNode( const LodNode& src );
00380 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00381 public: const LodNode::Value& GetValue( void ) const { return mValue; }
00382 protected: Node::Ptr Clone( void ) const;
00383 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00384
00385
00386 public:
00387
00388 void SetLod( const ObjectLod objectLod );
00389 void AttachChild( Node::Ptr child );
00390 void AttachChild( Node::Ptr child, const ObjectLod objectLod );
00391 void DetachChild( Node::Ptr child );
00392
00393 private:
00394 Value mValue;
00395 };
00396
00400 class PartitionNode : public Node
00401 {
00402 NODE_FRIENDS
00403 public:
00404 typedef SharedPtrNull<PartitionNode> Ptr;
00405
00407 class Value : public Node::Value
00408 {
00409
00410 friend class PartitionNode;
00411 public:
00412 Value( const string& name );
00413 ePriority1 GetPriority1( void ) const { return ePriority1_PartitionNode; }
00414 bool LessThan( const Node::Value& otherValue ) const;
00415 private:
00416 string mName;
00417 bool mPivotValid;
00418 LocalVertex mPivotVertex;
00419 };
00420
00421 public: PartitionNode( const Value& value );
00422 public: PartitionNode( const PartitionNode& src );
00423 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00424 public: const PartitionNode::Value& GetValue( void ) const { return mValue; }
00425 protected: Node::Ptr Clone( void ) const;
00426 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00427
00428
00429 public:
00430 void Enable( const bool enable = true );
00431 const string GetName( void ) const { return mValue.mName; }
00432 void SetPivotVertex( const LocalVertex& pivotVertex );
00433
00434 private:
00435 Value mValue;
00436 bool mEnabled;
00437 SortedNodes mChildrenSwapped;
00438 };
00439
00443 class TransformNode : public Node
00444 {
00445 NODE_FRIENDS
00446 public:
00447 typedef SharedPtrNull<TransformNode> Ptr;
00448
00450 class Value : public Node::Value
00451 {
00452
00453 friend class TransformNode;
00454 public:
00455 Value( SharedPtr<Matrix> matrix ) : mMatrix(matrix) { }
00456 ePriority1 GetPriority1( void ) const { return ePriority1_TransformNode; }
00457 bool LessThan( const Node::Value& otherValue ) const;
00458 private:
00459 SharedPtr<Matrix> mMatrix;
00460 };
00461
00462 public: TransformNode( const Value& value );
00463 public: TransformNode( const TransformNode& src );
00464 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00465 public: const TransformNode::Value& GetValue( void ) const { return mValue; }
00466 protected: Node::Ptr Clone( void ) const;
00467 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00468
00469
00470
00471
00472
00473 public:
00474
00475
00476 SharedPtr<const Matrix> GetMatrix( void ) { return mValue.mMatrix.CONST_PTR(); }
00477 void SetMatrix( const Matrix& matrix ) { *mValue.mMatrix = matrix; }
00478 void SetPosition( const WorldVertex& position ) { mValue.mMatrix->SetOrigin( position ); }
00479 WorldVertex GetPosition( void ) { return WorldVertex(mValue.mMatrix->GetOrigin()); }
00480
00481 private:
00482 Value mValue;
00483 };
00484
00488 class VertexsNode : public Node
00489 {
00490 NODE_FRIENDS
00491 public:
00492 typedef SharedPtrNull<VertexsNode> Ptr;
00493
00495 class Value : public Node::Value
00496 {
00497
00498 friend class VertexsNode;
00499 public:
00500 Value( SharedPtr<LocalVertexs> localVertexs ) : mLocalVertexs(localVertexs) { }
00501 ePriority1 GetPriority1( void ) const { return ePriority1_VertexsNode; }
00502
00503 private:
00504 SharedPtr<LocalVertexs> mLocalVertexs;
00505 };
00506
00507 public: VertexsNode( const Value& value );
00508 public: VertexsNode( const VertexsNode& src );
00509 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00510 public: const VertexsNode::Value& GetValue( void ) const { return mValue; }
00511 protected: Node::Ptr Clone( void ) const;
00512 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00513
00514
00515 public:
00516 SharedPtr<LocalVertexs> GetLocalVertexs( void ) const { return mValue.mLocalVertexs; }
00517 void SetLocalVertexs( SharedPtr<LocalVertexs> localVertexs ) { mValue.mLocalVertexs = localVertexs; }
00518 uint GetVertexCnt( void ) const { return mValue.mLocalVertexs->size(); }
00519
00520 private:
00521 Value mValue;
00522 };
00523
00538 class NormalsNode : public Node
00539 {
00540 NODE_FRIENDS
00541 public:
00542 typedef SharedPtrNull<NormalsNode> Ptr;
00543
00545 class Value : public Node::Value
00546 {
00547
00548 friend class NormalsNode; friend class GraphMaker;
00549 public:
00550 Value( SharedPtr<NormalVertexs> polygonNormals, SharedPtr<NormalVertexs> vertexNormals, bool normalsAreConstant = false );
00551 ePriority1 GetPriority1( void ) const { return ePriority1_NormalsNode; }
00552
00553 private:
00554 SharedPtr<NormalVertexs> mPolygonNormals;
00555 SharedPtr<NormalVertexs> mVertexNormals;
00556 bool mRecomputeNormals;
00557 bool mRetransformNormals;
00558 bool mNormalsAreConstant;
00559 };
00560
00561 public: NormalsNode( const Value& value );
00562 public: NormalsNode( const NormalsNode& src );
00563 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00564 public: const NormalsNode::Value& GetValue( void ) const { return mValue; }
00565 protected: Node::Ptr Clone( void ) const;
00566 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00567
00568
00569 public:
00570 SharedPtr<NormalVertexs> GetPolygonNormals( void ) const { return mValue.mPolygonNormals; }
00571 SharedPtr<NormalVertexs> GetVertexNormals( void ) const { return mValue.mVertexNormals; }
00572 void SetRecomputeNormals( bool f = true ) { mValue.mRecomputeNormals = f; }
00573 void SetRetransformNormals( bool f = true ) { mValue.mRetransformNormals = f; }
00574 bool IfRecomputeNormals( void ) const { return mValue.mRecomputeNormals; }
00575 bool IfRetransformNormals( void ) const { return mValue.mRetransformNormals; }
00576 bool IfNormalsAreConstant( void ) const { return mValue.mNormalsAreConstant; }
00577
00578 private:
00579 Value mValue;
00580 };
00581
00585 class ModesNode : public Node
00586 {
00587 NODE_FRIENDS
00588 public:
00589 typedef SharedPtrNull<ModesNode> Ptr;
00590
00591 public:
00593 class Modes
00594 {
00595
00596 public:
00597
00598
00599
00600
00601
00602 CLASS_CONST uint64 MODE_NONE = 0;
00603 CLASS_CONST uint64 MODE_DEFAULT = MODE_NONE;
00604 CLASS_CONST uint64 MODE_NO_CULL = (uint64(1) << uint64(0));
00605 CLASS_CONST uint64 MODE_TRANSLUCENT = (uint64(1) << uint64(63));
00606
00607 Modes( void ) : mModes(MODE_DEFAULT) { }
00608
00609
00610 Modes& operator|=( const uint64 mode ) { mModes |= mode; return *this; }
00611 Modes& operator=( const uint64 modes ) { mModes = modes; return *this; }
00612
00613 friend inline bool operator<( Modes a, Modes b ) { return a.mModes < b.mModes; }
00614 friend inline bool operator==( Modes a, Modes b ) { return a.mModes == b.mModes; }
00615 friend inline bool operator!=( Modes a, Modes b ) { return a.mModes != b.mModes; }
00616
00617 bool IfMode( const uint64 mode ) const { return mModes & mode; }
00618
00619 private:
00620 uint64 mModes;
00621 };
00622
00623 public:
00625 class Value : public Node::Value
00626 {
00627
00628 friend class ModesNode;
00629 public:
00630 Value( void ) : mModes() { }
00631 Value( const ModesNode::Modes modes ) : mModes(modes) { }
00632 ePriority1 GetPriority1( void ) const { return ePriority1_ModesNode; }
00633 bool LessThan( const Node::Value& otherValue ) const;
00634 private:
00635 ModesNode::Modes mModes;
00636 };
00637
00638 public: ModesNode( const Value& value );
00639 public: ModesNode( const ModesNode& src );
00640 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00641 public: const ModesNode::Value& GetValue( void ) const { return mValue; }
00642 protected: Node::Ptr Clone( void ) const;
00643 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00644
00645
00646 public: const Modes GetModes( void ) const { return mValue.mModes; }
00647 public: void SetModes( const Modes modes );
00648
00649 private:
00650 Value mValue;
00651 };
00652
00656 class MaterialNode : public Node
00657 {
00658 NODE_FRIENDS
00659 public:
00660 typedef SharedPtrNull<MaterialNode> Ptr;
00661
00663 class Value : public Node::Value
00664 {
00665
00666 friend class MaterialNode;
00667 public:
00668 Value( void );
00669 Value( const GFX::Material& material );
00670 ePriority1 GetPriority1( void ) const { return ePriority1_MaterialNode; }
00671 bool LessThan( const Node::Value& otherValue ) const;
00672 private:
00673 GFX::Material mMaterial;
00674 bool mEnabled;
00675 };
00676
00677 public: MaterialNode( const Value& value );
00678 public: MaterialNode( const MaterialNode& src );
00679 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00680 public: const MaterialNode::Value& GetValue( void ) const { return mValue; }
00681 protected: Node::Ptr Clone( void ) const;
00682 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00683
00684
00685 public:
00686
00687 bool IfEnabled( void ) const { return mValue.mEnabled; }
00688
00689 private:
00690 Value mValue;
00691 };
00692
00698 class TextureNode : public Node
00699 {
00700 NODE_FRIENDS
00701 public:
00702 typedef SharedPtrNull<TextureNode> Ptr;
00703
00705 class Value : public Node::Value
00706 {
00707
00708 friend class TextureNode;
00709 public:
00710 Value( void );
00711 Value( SharedPtr<Texture> texture );
00712 ePriority1 GetPriority1( void ) const { return ePriority1_TextureNode; }
00713 bool LessThan( const Node::Value& otherValue ) const;
00714 public:
00715 SharedPtr<Texture> mTexture;
00716 private:
00717 bool mIdentityTextureMatrix;
00718 SharedPtr<Matrix> mTextureMatrix;
00719 };
00720
00721 public: TextureNode( const Value& value );
00722 public: TextureNode( const TextureNode& src );
00723 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00724 public: const TextureNode::Value& GetValue( void ) const { return mValue; }
00725 protected: Node::Ptr Clone( void ) const;
00726 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00727
00728
00729 public:
00730 bool IfEnabled( void ) const { return GetTexture()->IfValid(); }
00731 SharedPtr<Texture> GetTexture( void ) const { return mValue.mTexture; }
00732 bool IfIdentityTextureMatrix( void ) const { return mValue.mIdentityTextureMatrix; }
00733 SharedPtr<const Matrix> GetTextureMatrix( void ) const { return mValue.mTextureMatrix; }
00734 void SetTextureMatrix( const Matrix& textureMatrix );
00735
00736 private:
00737 Value mValue;
00738 };
00739
00743 class ColorsNode : public Node
00744 {
00745 NODE_FRIENDS
00746 public:
00747 typedef SharedPtrNull<ColorsNode> Ptr;
00748 typedef SmallArray<Node::VCNT,RGBA> Colors;
00749
00751 class Value : public Node::Value
00752 {
00753
00754 friend class ColorsNode; friend class GraphMaker;
00755 public:
00756 Value( const ColorsNode::Colors& colors );
00757 Value( const RGBA color );
00758 ePriority1 GetPriority1( void ) const { return ePriority1_ColorsNode; }
00759 bool LessThan( const Node::Value& otherValue ) const;
00760 private:
00761 ColorsNode::Colors mColors;
00762 };
00763
00764 public: ColorsNode( const Value& value );
00765 public: ColorsNode( const ColorsNode& src );
00766 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00767 public: const ColorsNode::Value& GetValue( void ) const { return mValue; }
00768 protected: Node::Ptr Clone( void ) const;
00769 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00770
00771
00772 public: const Colors& GetColors( void ) const { return mValue.mColors; }
00773 public: void SetColors( const Colors& colors );
00774 public: void SetColors( const RGBA color );
00775
00776 private:
00777 Value mValue;
00778 };
00779
00783 class PolygonNode : public Node
00784 {
00785 NODE_FRIENDS
00786 public:
00787 typedef SharedPtrNull<PolygonNode> Ptr;
00788 typedef SmallArray<Node::VCNT,Vix> Vixs;
00789
00791 class Value : public Node::Value
00792 {
00793
00794 friend class PolygonNode; friend class GraphMaker;
00795 public:
00796
00797 template<typename VIXS>
00798 Value( const VIXS& vixs, const Nix nix )
00799 {
00800 ASSERT( vixs.size() == 3 || vixs.size() == 4 );
00801 for ( uint i = 0; i < vixs.size(); ++i )
00802 mVixs.push_back( vixs[i] );
00803 mNix = nix;
00804 }
00805 ePriority1 GetPriority1( void ) const { return ePriority1_PolygonNode; }
00806
00807
00808
00809 private:
00810 PolygonNode::Vixs mVixs;
00811 Nix mNix;
00812 };
00813
00814 public: PolygonNode( const Value& value );
00815 public: PolygonNode( const PolygonNode& src );
00816 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00817 public: const PolygonNode::Value& GetValue( void ) const { return mValue; }
00818 protected: Node::Ptr Clone( void ) const;
00819 NODE_PROTECTED: TypeId GetTypeId( void ) const;
00820
00821
00822 public:
00823 void SetVixs( const PolygonNode::Vixs& vixs ) { mValue.mVixs = vixs; }
00824 const PolygonNode::Vixs& GetVixs( void ) const { return mValue.mVixs; }
00825 void SetNix( const Nix nix ) { mValue.mNix = nix; }
00826 Nix GetNix( void ) const { return mValue.mNix; }
00827
00828 public:
00829 Value mValue;
00830 };
00831
00835 class PolygonNode_TriColor1: public PolygonNode
00836 {
00837 NODE_FRIENDS
00838 public: PolygonNode_TriColor1( const Value& value );
00839 public: PolygonNode_TriColor1( const PolygonNode_TriColor1& src );
00840 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00841 protected: Node::Ptr Clone( void ) const;
00842 };
00843
00847 class PolygonNode_TriColor3: public PolygonNode
00848 {
00849 NODE_FRIENDS
00850 public: PolygonNode_TriColor3( const Value& value );
00851 public: PolygonNode_TriColor3( const PolygonNode_TriColor3& src );
00852 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00853 protected: Node::Ptr Clone( void ) const;
00854 };
00855
00859 class PolygonNode_QuadColor1: public PolygonNode
00860 {
00861 NODE_FRIENDS
00862 public: PolygonNode_QuadColor1( const Value& value );
00863 public: PolygonNode_QuadColor1( const PolygonNode_QuadColor1& src );
00864 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00865 protected: Node::Ptr Clone( void ) const;
00866 };
00867
00871 class PolygonNode_QuadColor4: public PolygonNode
00872 {
00873 NODE_FRIENDS
00874 public: PolygonNode_QuadColor4( const Value& value );
00875 public: PolygonNode_QuadColor4( const PolygonNode_QuadColor4& src );
00876 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00877 protected: Node::Ptr Clone( void ) const;
00878 };
00879
00883 class PolygonNode_Tex : public PolygonNode
00884 {
00885 NODE_FRIENDS
00886 public:
00887 typedef SmallArray<Node::VCNT,TexCoord> TexCoords;
00888
00890 class Value : public PolygonNode::Value
00891 {
00892
00893 friend class PolygonNode_Tex;
00894 public:
00895
00896 template<typename VIXS,typename TEXCOORDS>
00897 Value( const VIXS& vixs, const Nix nix, const TEXCOORDS& texCoords )
00898 : PolygonNode::Value(vixs,nix)
00899 {
00900 ASSERT( vixs.size() == texCoords.size() );
00901 for ( uint i = 0; i < texCoords.size(); ++i )
00902 mTexCoords.push_back( texCoords[i] );
00903 }
00904 private:
00905 PolygonNode_Tex::TexCoords mTexCoords;
00906 };
00907
00908 public: PolygonNode_Tex( const Value& value );
00909 public: PolygonNode_Tex( const PolygonNode_Tex& src );
00910 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00911 public: const PolygonNode_Tex::Value& GetValue( void ) const { return mValue; }
00912 protected: Node::Ptr Clone( void ) const;
00913
00914
00915 public:
00916 const PolygonNode_Tex::TexCoords& GetTexCoords( void ) const { return mValue.mTexCoords; }
00917
00918 public:
00919 Value mValue;
00920 };
00921
00925 class PolygonNode_TexTriColor1: public PolygonNode_Tex
00926 {
00927 NODE_FRIENDS
00928 public: PolygonNode_TexTriColor1( const Value& value );
00929 public: PolygonNode_TexTriColor1( const PolygonNode_TexTriColor1& src );
00930 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00931 protected: Node::Ptr Clone( void ) const;
00932 };
00933
00937 class PolygonNode_TexTriColor3: public PolygonNode_Tex
00938 {
00939 NODE_FRIENDS
00940 public: PolygonNode_TexTriColor3( const Value& value );
00941 public: PolygonNode_TexTriColor3( const PolygonNode_TexTriColor3& src );
00942 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00943 protected: Node::Ptr Clone( void ) const;
00944 };
00945
00949 class PolygonNode_TexQuadColor1: public PolygonNode_Tex
00950 {
00951 NODE_FRIENDS
00952 public: PolygonNode_TexQuadColor1( const Value& value );
00953 public: PolygonNode_TexQuadColor1( const PolygonNode_TexQuadColor1& src );
00954 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00955 protected: Node::Ptr Clone( void ) const;
00956 };
00957
00961 class PolygonNode_TexQuadColor4: public PolygonNode_Tex
00962 {
00963 NODE_FRIENDS
00964 public: PolygonNode_TexQuadColor4( const Value& value );
00965 public: PolygonNode_TexQuadColor4( const PolygonNode_TexQuadColor4& src );
00966 public: void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00967 protected: Node::Ptr Clone( void ) const;
00968 };
00969
00976 class SpecialNode : public Node
00977 {
00978 public:
00979 typedef SharedPtrNull<SpecialNode> Ptr;
00980
00982 class Value : public Node::Value
00983 {
00984
00985 friend class SpecialNode;
00986 public:
00987 Value( void ) { }
00988 ePriority1 GetPriority1( void ) const { return ePriority1_SpecialNode; }
00989
00990 };
00991
00992 SpecialNode( void ) : Node(), mValue() { }
00993 SpecialNode( const SpecialNode& src ) : Node(src), mValue(src.mValue) { }
00994 virtual ~SpecialNode() { }
00995
00996 public: virtual void Accept( Visitor& visitor ) { visitor.Visit( *this ); }
00997 public: const SpecialNode::Value& GetValue( void ) const { return mValue; }
00998 protected: virtual Node::Ptr Clone( void ) const = 0;
00999
01000 NODE_PROTECTED: TypeId GetTypeId( void ) const { return ID_SPECIAL_NODE; }
01001
01002 private:
01003 Value mValue;
01004 };
01005
01006 }
01007
01008 #endif // ENG_NODE_HH