BaseShape.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 _BASESHAPE_H
00013 #define _BASESHAPE_H
00014 
00015 #include "Template.h"
00016 
00017 
00021 struct SLIndexedVector2D
00022 {
00023     SI_Float m_fIndex;          
00024     CSIBCVector2D m_Vector2D;   
00025 };
00026 
00027 
00031 struct SLIndexedVector3D
00032 {
00033     SI_Float m_fIndex;          
00034     CSIBCVector3D m_Vector3D;   
00035 };
00036 
00037 
00041 struct SLIndexedColor
00042 {
00043     SI_Float m_fIndex;          
00044     CSIBCColorf m_Color;        
00045 };
00046 
00047 
00116 class XSIEXPORT CSLBaseShape
00117     : public CSLTemplate
00118 {
00119 public:
00123     typedef CSLArrayProxy<CSIBCVector2D, SI_Float, 2>       CSLVector2DArray;
00124 
00128     typedef CSLArrayProxy<CSIBCVector3D, SI_Float, 3>       CSLVector3DArray;
00129 
00133     typedef CSLArrayProxy<CSIBCColorf, SI_Float, 4>         CSLColorArray;
00134 
00138     typedef CSLArrayProxy<SLIndexedVector2D, SI_Float, 3>   CSLIndexedVector2DArray;
00139 
00143     typedef CSLArrayProxy<SLIndexedVector3D, SI_Float, 4>   CSLIndexedVector3DArray;
00144 
00148     typedef CSLArrayProxy<SLIndexedColor, SI_Float, 5>      CSLIndexedColorArray;
00149 
00153     enum EShapeType
00154     {
00155         SI_ORDERED, 
00156         SI_INDEXED, 
00157     };
00158 
00161     virtual ~CSLBaseShape();
00162 
00166     CSLVector3DArray*               CreateNormals();
00167 
00171     CSLIndexedVector3DArray*        CreateIndexedNormals();
00172 
00176     SI_Int                          GetNormalCount();
00177 
00181     CSLVector3DArray*               GetNormalList();
00182 
00186     CSIBCVector3D*                  GetNormalListPtr();
00187 
00191     CSLIndexedVector3DArray*        GetIndexedNormalList();
00192 
00196     SLIndexedVector3D*              GetIndexedNormalListPtr();
00197 
00201     SI_Error                        DestroyNormals();
00202 
00206     CSLColorArray*                  CreateColors();
00207 
00211     CSLIndexedColorArray*           CreateIndexedColors();
00212 
00216     SI_Int                          GetColorCount();
00217 
00221     CSLColorArray*                  GetColorList();
00222 
00226     CSIBCColorf*                    GetColorListPtr();
00227 
00231     CSLIndexedColorArray*           GetIndexedColorList();
00232 
00236     SLIndexedColor*                 GetIndexedColorListPtr();
00237 
00241     SI_Error                        DestroyColors();
00242 
00246     SI_Int                          GetVertexCount();
00247 
00251     CSLVector3DArray*               GetVertexList();
00252 
00256     CSIBCVector3D*                  GetVertexListPtr();
00257 
00261     CSLIndexedVector3DArray*        GetIndexedVertexList();
00262 
00266     SLIndexedVector3D*              GetIndexedVertexListPtr();
00267 
00271     EShapeType                      ShapeType();
00272 
00273     virtual SI_Error Fix();
00274     virtual SI_Error Synchronize();
00275 
00276 protected:
00277 
00284     CSLBaseShape(CSLScene* in_pScene, CSLModel *in_pModel, CdotXSITemplate* in_pTemplate, EShapeType in_Type);
00285 
00286     CSLIntProxy                     m_NumArrays;
00287     CSLStringProxy                  m_ArrayType;
00288 
00289     CSLVector3DArray*               m_pPositions;
00290     CSLVector3DArray*               m_pNormals;
00291     CSLColorArray*                  m_pVertexColors;
00292 
00293     CSLIndexedVector3DArray*        m_pIndexedPositions;
00294     CSLIndexedVector3DArray*        m_pIndexedNormals;
00295     CSLIndexedColorArray*           m_pIndexedVertexColors;
00296 
00297     CSLIntProxy*                    m_iNbPositions;
00298     CSLIntProxy*                    m_iNbNormals;
00299     CSLIntProxy*                    m_iNbColors;
00300 
00301     CSLStringProxy*                 m_pPositionStringProxy;
00302     CSLStringProxy*                 m_pNormalStringProxy;
00303     CSLStringProxy*                 m_pColorStringProxy;
00304 
00305     EShapeType                      m_Type;
00306 
00307     void *m_pReserved;  // reserved for future extension
00308 };
00309 
00310 //XSITEMPLATEEXP template class XSIEXPORT CSLArrayProxy<CSIBCVector2D, SI_Float, 2>;
00311 //XSITEMPLATEEXP template class XSIEXPORT CSLArrayProxy<CSIBCVector3D, SI_Float, 3>;
00312 //XSITEMPLATEEXP template class XSIEXPORT CSLArrayProxy<CSIBCColorf, SI_Float, 4>;
00313 //XSITEMPLATEEXP template class XSIEXPORT CSLArrayProxy<SLIndexedVector2D, SI_Float, 3>;
00314 //XSITEMPLATEEXP template class XSIEXPORT CSLArrayProxy<SLIndexedVector3D, SI_Float, 4>;
00315 //XSITEMPLATEEXP template class XSIEXPORT CSLArrayProxy<SLIndexedColor, SI_Float, 5>;
00316 
00317 #endif
00318