MaterialRequiredStreams.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2010 Autodesk, Inc.  All rights reserved.
00003 //
00004 // Use of this software is subject to the terms of the Autodesk license
00005 // agreement provided at the time of installation or download, or which 
00006 // otherwise accompanies this software in either electronic or hard copy form.   
00007 //
00008 //
00009 
00010 #pragma once
00011 
00012 #include "./DataBridgeExport.h"
00013 #include "./Types.h"
00014 #include "./GeometryEnums.h"
00015 
00016 #include "../MaxHeap.h"
00017 #include "../tab.h"
00018 
00019 namespace MaxSDK { namespace Graphics {
00020 
00026 struct MaterialRequiredStreamElement : public MaxHeapOperators
00027 {
00028 public:
00029     DataBridgeAPI MaterialRequiredStreamElement();
00030     DataBridgeAPI MaterialRequiredStreamElement(const MaterialRequiredStreamElement& from);
00031     DataBridgeAPI MaterialRequiredStreamElement& operator = (const MaterialRequiredStreamElement& from);
00032     DataBridgeAPI ~MaterialRequiredStreamElement();
00033 
00039     DataBridgeAPI int Compare(const MaterialRequiredStreamElement& rhs) const;
00040 
00048     inline int GetChannelID() const;
00049 
00053     inline VertexFieldType GetType() const;
00054 
00058     inline MeshChannelCategory GetChannelCategory() const;
00059 
00063     inline unsigned short GetUsageIndex() const;
00064 
00068     inline void SetChannelID(int maxMapChannel);
00069 
00073     inline void SetType(VertexFieldType type);
00074 
00078     inline void SetChannelCategory(MeshChannelCategory channelCategory);
00079 
00083     inline void SetUsageIndex(unsigned short usageIndex);
00084 
00085     inline bool operator == (const MaterialRequiredStreamElement& rhs) const;
00086     inline bool operator != (const MaterialRequiredStreamElement& rhs) const;
00087     inline bool operator < (const MaterialRequiredStreamElement& rhs) const;
00088     inline bool operator <= (const MaterialRequiredStreamElement& rhs) const;
00089     inline bool operator > (const MaterialRequiredStreamElement& rhs) const;
00090     inline bool operator >= (const MaterialRequiredStreamElement& rhs) const;
00091 
00092 protected:
00093 #pragma warning(disable:4201)
00094     union DataUnion
00095     {
00096         unsigned __int64 mKey;
00097         struct
00098         {
00099             unsigned long mChannelId;
00100             unsigned short mUsageIndex;
00101             unsigned char mFieldType; // VertexFieldType
00102             unsigned char mChannelCategory; // MeshChannelCategory
00103         };
00104     };
00105 #pragma warning(default:4201)
00106 
00107     DataUnion mData;
00108 };
00109 
00113 enum MaterialRequirementFlags
00114 {
00118     MaterialRequirementSplitByMaterialID        = 0x00000001, 
00119 };
00120 
00121 class MaterialRequiredStreamsImpl;
00122 
00166 class MaterialRequiredStreams : public MaxHeapOperators
00167 {
00168 public:
00169     DataBridgeAPI MaterialRequiredStreams();
00170     DataBridgeAPI MaterialRequiredStreams(const MaterialRequiredStreams& from);
00171     DataBridgeAPI MaterialRequiredStreams& operator = (const MaterialRequiredStreams& from);
00172     DataBridgeAPI ~MaterialRequiredStreams();
00173 
00176     DataBridgeAPI void Clear();
00177 
00183     DataBridgeAPI size_t AddStream(
00184         const MaterialRequiredStreamElement& streamElement);
00185 
00190     DataBridgeAPI size_t FindStream(
00191         const MaterialRequiredStreamElement& streamElement) const;
00192 
00196     DataBridgeAPI void RemoveStream(size_t index);
00197 
00201     DataBridgeAPI size_t GetNumberOfStreams() const;
00202 
00207     DataBridgeAPI const MaterialRequiredStreamElement& GetStreamElement(size_t i) const;
00208 
00214     DataBridgeAPI int Compare(const MaterialRequiredStreams& rhs) const;
00215 
00220     DataBridgeAPI unsigned long GetFlags() const;
00221 
00226     DataBridgeAPI void SetFlags(unsigned long flags);
00227 
00228     inline bool operator == (const MaterialRequiredStreams& rhs) const;
00229     inline bool operator != (const MaterialRequiredStreams& rhs) const;
00230     inline bool operator < (const MaterialRequiredStreams& rhs) const;
00231     inline bool operator <= (const MaterialRequiredStreams& rhs) const;
00232     inline bool operator > (const MaterialRequiredStreams& rhs) const;
00233     inline bool operator >= (const MaterialRequiredStreams& rhs) const;
00234 
00235 private:
00236     MaterialRequiredStreamsImpl* mpImpl;
00237 };
00238 
00239 inline int MaterialRequiredStreamElement::GetChannelID() const
00240 {
00241     return (int)((unsigned int)(mData.mChannelId));
00242 }
00243 
00244 inline VertexFieldType MaterialRequiredStreamElement::GetType() const
00245 {
00246     return (VertexFieldType)(mData.mFieldType);
00247 }
00248 
00249 inline MeshChannelCategory MaterialRequiredStreamElement::GetChannelCategory() const
00250 {
00251     return (MeshChannelCategory)(mData.mChannelCategory);
00252 }
00253 
00254 inline unsigned short MaterialRequiredStreamElement::GetUsageIndex() const
00255 {
00256     return mData.mUsageIndex;
00257 }
00258 
00259 inline void MaterialRequiredStreamElement::SetChannelID(int maxMapChannel)
00260 {
00261     mData.mChannelId = (unsigned long)((unsigned int)maxMapChannel);
00262 }
00263 
00264 inline void MaterialRequiredStreamElement::SetType(VertexFieldType type)
00265 {
00266     mData.mFieldType = (unsigned char)type;
00267 }
00268 
00269 inline void MaterialRequiredStreamElement::SetChannelCategory(MeshChannelCategory channelCategory)
00270 {
00271     mData.mChannelCategory = (unsigned char)channelCategory;
00272 }
00273 
00274 inline void MaterialRequiredStreamElement::SetUsageIndex(unsigned short usageIndex)
00275 {
00276     mData.mUsageIndex = usageIndex;
00277 }
00278 
00279 inline bool MaterialRequiredStreamElement::operator == (
00280     const MaterialRequiredStreamElement& rhs) const
00281 {
00282     return Compare(rhs) == 0;
00283 }
00284 
00285 inline bool MaterialRequiredStreamElement::operator != (
00286     const MaterialRequiredStreamElement& rhs) const
00287 {
00288     return Compare(rhs) != 0;
00289 }
00290 
00291 inline bool MaterialRequiredStreamElement::operator < (
00292     const MaterialRequiredStreamElement& rhs) const
00293 {
00294     return Compare(rhs) < 0;
00295 }
00296 
00297 inline bool MaterialRequiredStreamElement::operator <= (
00298     const MaterialRequiredStreamElement& rhs) const
00299 {
00300     return Compare(rhs) <= 0;
00301 }
00302 
00303 inline bool MaterialRequiredStreamElement::operator > (
00304     const MaterialRequiredStreamElement& rhs) const
00305 {
00306     return Compare(rhs) > 0;
00307 }
00308 
00309 inline bool MaterialRequiredStreamElement::operator >= (
00310     const MaterialRequiredStreamElement& rhs) const
00311 {
00312     return Compare(rhs) >= 0;
00313 }
00314 
00315 inline bool MaterialRequiredStreams::operator == (const MaterialRequiredStreams& rhs) const
00316 {
00317     return Compare(rhs) == 0;
00318 }
00319 
00320 inline bool MaterialRequiredStreams::operator != (const MaterialRequiredStreams& rhs) const
00321 {
00322     return Compare(rhs) != 0;
00323 }
00324 
00325 inline bool MaterialRequiredStreams::operator < (const MaterialRequiredStreams& rhs) const
00326 {
00327     return Compare(rhs) < 0;
00328 }
00329 
00330 inline bool MaterialRequiredStreams::operator <= (const MaterialRequiredStreams& rhs) const
00331 {
00332     return Compare(rhs) <= 0;
00333 }
00334 
00335 inline bool MaterialRequiredStreams::operator > (const MaterialRequiredStreams& rhs) const
00336 {
00337     return Compare(rhs) > 0;
00338 }
00339 
00340 inline bool MaterialRequiredStreams::operator >= (const MaterialRequiredStreams& rhs) const
00341 {
00342     return Compare(rhs) >= 0;
00343 }
00344 
00345 } } // namespace