00001 #ifndef __FBGEOMETRY_H__
00002 #define __FBGEOMETRY_H__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00043 #include <kaydaradef.h>
00044 #ifndef FBSDK_DLL
00045
00048 #define FBSDK_DLL K_DLLIMPORT
00049 #endif
00050
00051 #include <fbsdk/fbcore.h>
00052 #include <fbsdk/fbcomponent.h>
00053
00054 #ifdef FBSDKUseNamespace
00055 namespace FBSDKNamespace {
00056 #endif
00057
00058 FB_DEFINE_COMPONENT( FBSDK_DLL, Geometry );
00059 FB_DEFINE_COMPONENT( FBSDK_DLL, Mesh );
00060
00061 enum FBGeometryPrimitiveType
00062 {
00063 kFBGeometry_POINTS = 0x0000,
00064 kFBGeometry_LINES = 0x0001,
00065 kFBGeometry_LINE_LOOP = 0x0002,
00066 kFBGeometry_LINE_STRIP = 0x0003,
00067 kFBGeometry_TRIANGLES = 0x0004,
00068 kFBGeometry_TRIANGLE_STRIP = 0x0005,
00069 kFBGeometry_TRIANGLE_FAN = 0x0006,
00070 kFBGeometry_QUADS = 0x0007,
00071 kFBGeometry_QUADS_STRIP = 0x0008,
00072 kFBGeometry_POLYGON = 0x0009,
00073 };
00074
00076 enum FBGeometryArrayID
00077 {
00078 kFBGeometryArrayID_Point = 1 << 0,
00079 kFBGeometryArrayID_Normal = 1 << 1,
00080 kFBGeometryArrayID_Tangent = 1 << 2,
00081 kFBGeometryArrayID_Binormal = 1 << 3,
00082 kFBGeometryArrayID_Color = 1 << 4
00083 };
00084
00086 K_DEPRECATED_2014 const int kFBGeometryArrayID_NormalByPoint = kFBGeometryArrayID_Normal;
00087
00089 K_DEPRECATED_2014 const int kFBGeometryArrayID_VertexColor = kFBGeometryArrayID_Color;
00090
00091
00093 enum FBGeometryArrayElementType {
00094 kFBGeometryArrayElementType_Unknown,
00095 kFBGeometryArrayElementType_Integer,
00096 kFBGeometryArrayElementType_Float,
00097 kFBGeometryArrayElementType_Float2,
00098 kFBGeometryArrayElementType_Float3,
00099 kFBGeometryArrayElementType_Float4,
00100 kFBGeometryArrayElementType_FloatMatrix4x4,
00101 kFBGeometryArrayElementType_IntegerArrayPointer
00102 };
00103
00105
00107 __FB_FORWARD( FBGeometry );
00108
00109
00120 enum FBGeometryMappingMode
00121 {
00122 kFBGeometryMapping_NONE,
00123 kFBGeometryMapping_BY_CONTROL_POINT,
00124 kFBGeometryMapping_BY_POLYGON_VERTEX,
00125 kFBGeometryMapping_BY_POLYGON,
00126 kFBGeometryMapping_BY_EDGE,
00127 kFBGeometryMapping_ALL_SAME
00128 } ;
00129
00141 enum FBGeometryReferenceMode
00142 {
00143 kFBGeometryReference_DIRECT,
00144 kFBGeometryReference_INDEX,
00145 kFBGeometryReference_INDEX_TO_DIRECT
00146 };
00147
00148 FB_DEFINE_ENUM( FBSDK_DLL, GeometryMappingMode );
00149 FB_DEFINE_ENUM( FBSDK_DLL, GeometryReferenceMode );
00150
00151 enum kFBGeometryUpdateFlags
00152 {
00153 kFBGeometryUpdateNone = 0,
00154 kFBGeometryUpdateAll = 1 << 0,
00155 kFBGeometryUpdatePositionAndNormal = 1 << 1,
00156 kFBGeometryUpdateSkinWeight = 1 << 2,
00157 kFBGeometryUpdateInverseNormal = 1 << 3,
00158 kFBGeometryUpdateMappingMode = 1 << 4,
00159 };
00160
00175 class FBSDK_DLL FBGeometry : public FBComponent {
00176 __FBClassDeclare( FBGeometry,FBComponent );
00177
00178 protected:
00183 FBGeometry(const char* pName, HIObject pObject=NULL);
00184
00185 public:
00194
00198 bool GeometryBegin();
00199
00203 bool GeometryEnd();
00204
00208 bool IsEditingEnabled() const;
00210
00220 void VertexInit (int pSize, bool pResize, bool pInitUV = true, bool pInitVertexColor = false);
00221
00227 bool VertexClear ();
00228
00234 int VertexAdd (FBVertex pVertex);
00235
00241 int VertexAdd (FBVertex pVertex, FBNormal pNormal);
00242
00249 int VertexAdd (FBVertex pVertex, FBNormal pNormal, FBUV pUV);
00250
00258 int VertexAdd (FBVertex pVertex, FBNormal pNormal, FBUV pUV, FBColorF pVertexColor);
00259
00267 int VertexAdd (double px, double py, double pz);
00268 int VertexAdd (double px, double py, double pz, double nx, double ny, double nz);
00269 int VertexAdd (double px, double py, double pz, double nx, double ny, double nz, double UVu, double UVv);
00270 int VertexAdd (double px, double py, double pz, double nx, double ny, double nz, double UVu, double UVv, double pRed, double pGreen, double pBlue, double pAlpha);
00271
00277 bool VertexSet (FBVertex pVertex,int pIndex=-1);
00278
00286 bool VertexSet (double px, double py, double pz,int pIndex=-1);
00287
00293 bool VertexNormalSet(FBNormal pVertex,int pIndex=-1);
00294
00302 bool VertexNormalSet(double px, double py, double pz,int pIndex=-1);
00303
00304
00310 bool VertexUVSet(FBUV pUV, int pIndex=-1);
00311
00318 bool VertexUVSet(float pU, float pV, int pIndex=-1);
00319
00325 bool VertexColorSet(FBColorF pColor, int pIndex=-1);
00326
00335 bool VertexColorSet(float pRed, float pGreen, float pBlue, float pAlpha, int pIndex=-1);
00336
00338
00343
00347 int VertexCount () const;
00348
00353 FBVertex VertexGet (int pIndex) const;
00354
00358 FBVertex* GetVertexes() const;
00359
00364 FBNormal VertexNormalGet(int pIndex=-1) const;
00365
00370 FBUV VertexUVGet(int pIndex=-1) const;
00371
00376 FBColorF VertexColorGet(int pIndex=-1) const;
00377
00379
00380
00385
00396 bool VertexArrayInit (int pVertexcount, bool pUniqueMaterial, unsigned int pFBGeometryArrayIDs = 0);
00397
00403 bool VertexArrayClear();
00404
00410 FBVertex* GetPositionsArray(int& pOutArrayCount) const;
00411
00412 FBPropertyGeometryMappingMode NormalMappingMode;
00413 FBPropertyGeometryReferenceMode NormalReferenceMode;
00414
00420 int* GetNormalsIndexArray(int& pOutArrayCount) const;
00421
00427 FBNormal* GetNormalsDirectArray(int& pOutArrayCount) const;
00428
00429 FBPropertyGeometryMappingMode TangentMappingMode;
00430 FBPropertyGeometryReferenceMode TangentReferenceMode;
00431
00437 int* GetTangentsIndexArray(int& pOutArrayCount) const;
00438
00444 FBNormal* GetTangentsDirectArray(int& pOutArrayCount) const;
00445
00446 FBPropertyGeometryMappingMode BinormalMappingMode;
00447 FBPropertyGeometryReferenceMode BinormalReferenceMode;
00448
00454 int* GetBinormalsIndexArray(int& pOutArrayCount) const;
00455
00461 FBNormal* GetBinormalsDirectArray(int& pOutArrayCount) const;
00462
00463 FBPropertyGeometryMappingMode VertexColorMappingMode;
00464 FBPropertyGeometryReferenceMode VertexColorReferenceMode;
00465
00471 int* GetVertexColorsIndexArray(int& pOutArrayCount) const;
00472
00478 FBColorF* GetVertexColorsDirectArray(int& pOutArrayCount) const;
00479
00483 FBStringList GetUVSets() const;
00484
00489 FBGeometryMappingMode GetUVSetMappingMode(const char* pUVSetName = NULL) const;
00490
00495 FBGeometryReferenceMode GetUVSetReferenceMode(const char* pUVSetName = NULL) const;
00496
00503 int* GetUVSetIndexArray(int& pOutArrayCount, const char* pUVSetName = NULL) const;
00504
00511 FBUV* GetUVSetDirectArray(int& pOutArrayCount, const char* pUVSetName = NULL) const;
00512
00513 FBPropertyGeometryMappingMode MaterialMappingMode;
00514
00520 int* GetMaterialIndexArray(int& pOutArrayCount) const;
00522
00523
00528
00533 bool VertexGetSelected(int pIndex);
00534
00540 bool VertexSetSelected(int pIndex,bool pState);
00541
00546 bool VertexGetVisible(int pIndex);
00547
00553 bool VertexSetVisible(int pIndex,bool pState);
00554
00559 bool VertexGetTransformable(int pIndex);
00561
00566
00568 int ShapeGetCount() const;
00569
00571 const char* ShapeGetName(int pShapeIdx) const;
00572
00577 int ShapeAdd(const char* pName);
00578
00580 void ShapeClearAll();
00581
00587 void ShapeInit(int pShapeIdx, int pDiffSize, bool pWithNormal = false);
00588
00592 int ShapeGetDiffPointCount(int pShapeIdx) const;
00593
00600 bool ShapeSetDiffPoint(int pShapeIdx, int pDiffIndex, int pOriIndex, const FBVertex& pPosDiff);
00601
00609 bool ShapeSetDiffPoint(int pShapeIdx, int pDiffIndex, int pOriIndex, const FBVertex& pPosDiff, const FBNormal& pNormalDiff);
00610
00617 bool ShapeGetDiffPoint(int pShapeIdx, int pDiffIndex, int& pOriIndex, FBVertex& pPosDiff) const;
00618
00626 bool ShapeGetDiffPoint(int pShapeIdx, int pDiffIndex, int& pOriIndex, FBVertex& pPosDiff, FBNormal& pNormalDiff) const;
00627
00629
00634
00640 void ModifyNotify( kFBGeometryUpdateFlags pFlags=kFBGeometryUpdateAll, int pFirstIndex=-1, int pLastIndex=-1 );
00641
00643 };
00644
00646
00648 __FB_FORWARD( FBMesh );
00649
00651 class FBSDK_DLL FBMesh : public FBGeometry {
00652 __FBClassDeclare( FBMesh,FBGeometry );
00653
00654 public:
00659 FBMesh(const char* pName, HIObject pObject=NULL);
00660
00669 bool TriangleListAdd(int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
00670
00679 bool TriangleStripAdd(int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
00680
00690 bool PolygonListAdd(int pPolygonSize, int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
00691
00696 int PolygonBegin(int pMaterialId=0);
00697
00702 bool PolygonVertexAdd(int pVertex);
00703
00709 int PolygonEnd();
00710
00715 int PolygonVertexCount(int pPolygonIndex) const;
00716
00722 int PolygonVertexIndex(int pPolygonIndex, int pVertexPolygonIndex) const;
00723
00727 int PolygonCount() const;
00728
00738 const int* PolygonVertexArrayGet(int& pArraySize) const;
00739
00743 bool IsTriangleMesh() const;
00744
00749 int PolygonMaterialIdGet(int pIndex=-1) const;
00750
00754 void ComputeVertexNormals(bool pCW = false);
00755
00757 void InverseNormal();
00758 };
00759
00761
00763 __FB_FORWARD( FBSurface );
00764
00766 enum FBSurfaceMode
00767 {
00768 kFBSurfaceModeRaw,
00769 kFBSurfaceModeLowNoNormals,
00770 kFBSurfaceModeLow,
00771 kFBSurfaceModeHighNoNormals,
00772 kFBSurfaceModeHigh
00773 };
00774 FB_DEFINE_ENUM( FBSDK_DLL, SurfaceMode );
00775
00777 enum FBSurfaceType
00778 {
00779 kFBSurfaceTypeBezier,
00780 kFBSurfaceTypeBezierQuadric,
00781 kFBSurfaceTypeCardinal,
00782 kFBSurfaceTypeBspline,
00783 kFBSurfaceTypeLinear,
00784 };
00785 FB_DEFINE_ENUM( FBSDK_DLL, SurfaceType );
00786
00787
00789 class FBSDK_DLL FBSurface : public FBGeometry
00790 {
00791 __FBClassDeclare( FBSurface, FBGeometry );
00792
00793 public:
00798 FBSurface(const char* pName, HIObject pObject=NULL);
00799
00800 virtual void SurfaceBegin();
00801 virtual void SurfaceEnd();
00802 virtual void SurfaceEditBegin();
00803 virtual void SurfaceEditEnd();
00804 virtual bool GetSurfaceCapped( int pUorV, int pDirection );
00805 virtual int GetVertexCount( int pUorVorGlobal = -1 );
00806 virtual void ControlPointsBegin() = 0;
00807 virtual void SetControlPoint( int pIndex, double pX, double pY, double pZ, double pW );
00808 virtual void GetControlPoint( int pIndex, double &pX, double &pY, double &pZ, double &pW );
00809 virtual void ControlPointsEnd();
00810
00816 bool VertexGetSelected(int pU,int pV);
00823 bool VertexSetSelected(int pU,int pV,bool pState);
00824
00830 bool VertexGetVisible(int pU,int pV);
00831
00838 bool VertexSetVisible(int pU,int pV,bool pState);
00839
00845 bool VertexGetTransformable(int pU,int pV);
00846
00847
00848 FBPropertyInt USize;
00849 FBPropertyInt VSize;
00850 FBPropertyInt UStep;
00851 FBPropertyInt VStep;
00852 FBPropertyBool UClosed;
00853 FBPropertyBool VClosed;
00854 FBPropertySurfaceMode SurfaceMode;
00855
00856 private:
00857 void FBSurfaceInitProperties();
00858 };
00859
00861 enum FBNurbType
00862 {
00863 kFBNurbTypePeriodic,
00864 kFBNurbTypeClosed,
00865 kFBNurbTypeOpen,
00866 };
00867 FB_DEFINE_ENUM( FBSDK_DLL, NurbType );
00868
00869
00871
00873 __FB_FORWARD( FBNurbs );
00874
00876 class FBSDK_DLL FBNurbs : public FBSurface
00877 {
00878 __FBClassDeclare( FBNurbs, FBSurface );
00879
00880 public:
00885 FBNurbs(const char* pName, HIObject pObject=NULL);
00886
00889 virtual void SurfaceBegin();
00890
00893 virtual void SurfaceEnd();
00894
00897 virtual void SurfaceEditBegin();
00900 virtual void SurfaceEditEnd();
00903 virtual void ControlPointsBegin();
00906 virtual void ControlPointsEnd();
00911 virtual void SetControlWeight( int pIndex, double pWeight );
00916 virtual double GetControlWeight( int pIndex );
00922 virtual void SetControlMultiplicity( int pUorV, int pIndex, int pMultiplicity );
00927 virtual int GetControlMultiplicity( int pUorV, int pIndex );
00933 virtual void SetControlKnotValue( int pUorV, int pIndex, double pKnotValue );
00938 virtual double GetControlKnotValue( int pUorV, int pIndex );
00943 virtual int GetKnotCount( int pUorV );
00944
00945 FBPropertyInt UOrder;
00946 FBPropertyInt VOrder;
00947 FBPropertyNurbType UNurbType;
00948 FBPropertyNurbType VNurbType;
00949
00950 private:
00951 void FBNurbsInitProperties();
00952 };
00953
00955
00957 __FB_FORWARD( FBPatch );
00958
00960 class FBSDK_DLL FBPatch : public FBSurface
00961 {
00962 __FBClassDeclare( FBPatch, FBSurface );
00963
00964 public:
00969 FBPatch(const char* pName, HIObject pObject=NULL);
00970
00973 virtual void SurfaceBegin();
00974
00977 virtual void SurfaceEnd();
00978
00981 virtual void SurfaceEditBegin();
00982
00985 virtual void SurfaceEditEnd();
00986
00989 virtual void ControlPointsBegin();
00992 virtual void ControlPointsEnd();
00993
00994
00995 FBPropertySurfaceType USurfaceType;
00996 FBPropertySurfaceType VSurfaceType;
00997
00998 private:
00999 void FBPatchInitProperties();
01000
01001 };
01002
01003 #ifdef FBSDKUseNamespace
01004 }
01005 #endif
01006 #endif