TriangleList.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.
00006 // Use of this software is subject to the terms of the Autodesk license agreement
00007 // provided at the time of installation or download, or which otherwise accompanies
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 #ifndef _TRIANGLELIST_H
00013 #define _TRIANGLELIST_H
00014 
00015 #include "Template.h"
00016 
00017 class CSLBaseMaterial;
00018 
00019 struct SLTriangle
00020 {
00021     SI_Int  m_iVtx1;
00022     SI_Int  m_iVtx2;
00023     SI_Int  m_iVtx3;
00024 };
00025 
00037 class XSIEXPORT CSLTriangleList
00038     : public CSLTemplate
00039 {
00040 public:
00044     typedef CSLArrayProxy<SLTriangle, SI_Int, 3> CSLTriangleArray;
00045 
00046     CSLTriangleList(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate);
00047     virtual ~CSLTriangleList();
00048 
00052     SI_Int                  GetTriangleCount() { return m_VertexIndices.GetUsed(); };
00053 
00057     SI_Int*                 GetVertexIndicesPtr() { return (SI_Int *) m_VertexIndices.ArrayPtr(); }
00058 
00062     CSLTriangleArray*       GetVertexIndices() { return &m_VertexIndices; }
00063 
00067     CSLTriangleArray*       CreateNormalIndices();
00068 
00072     CSLTriangleArray*       GetNormalIndices() { return m_NormalIndices; }
00073 
00077     SI_Int*                 GetNormalIndicesPtr();
00078 
00082     SI_Error                DestroyNormalIndices();
00083 
00087     CSLTriangleArray*       CreateColorIndices();
00088 
00092     CSLTriangleArray*       GetColorIndices() { return m_ColorIndices; }
00093 
00097     SI_Int*                 GetColorIndicesPtr();
00098 
00102     SI_Error                DestroyColorIndices();
00103 
00107     CSLTriangleArray*       AddUVArray();
00108 
00112     SI_Int                  GetUVArrayCount();
00113 
00117     SI_Int*                 GetUVIndicesPtr(SI_Int in_nId);
00118 
00123     CSLTriangleArray*       GetUVIndices(SI_Int in_nId);
00124 
00128     SI_Error                RemoveUVArray();
00129 
00133     SI_Error                ClearUVArrays();
00134 
00138     CSLBaseMaterial*        GetMaterial() { return m_pMaterial; }
00139 
00144     SI_Void                 SetMaterial(CSLBaseMaterial *in_pNewMaterial) { m_pMaterial = in_pNewMaterial; }
00145 
00146     virtual ETemplateType   Type() { return SI_TRIANGLE_LIST; }
00147     virtual SI_Error        Synchronize();
00148     virtual CSLAnimatableType* ParameterFromName(SI_Char *in_szName);
00149 
00150 private:
00151     CSLBaseMaterial*        m_pMaterial;
00152     CSLTriangleArray        m_VertexIndices;
00153 
00154     CSLTriangleArray*       m_NormalIndices;
00155     CSIBCArray<CSLTriangleArray* >  m_UVIndices;
00156     CSLTriangleArray*       m_ColorIndices;
00157 
00158     SI_Bool                 m_bSingleUV;
00159     SI_Int                  m_iArrayCount;
00160 
00161     void *m_pReserved;  // reserved for future extension
00162 };
00163 
00164 #endif