fbsdk/fbgeometry.h Source File

fbgeometry.h
Go to the documentation of this file.
1 #ifndef __FBGEOMETRY_H__
2 #define __FBGEOMETRY_H__
3 /**************************************************************************
4 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5 All Rights Reserved.
6 
7 The coded instructions, statements, computer programs, and/or related
8 material (collectively the "Data") in these files contain unpublished
9 information proprietary to Autodesk, Inc. and/or its licensors, which is
10 protected by Canada and United States of America federal copyright law
11 and by international treaties.
12 
13 The Data may not be disclosed or distributed to third parties, in whole
14 or in part, without the prior written consent of Autodesk, Inc.
15 ("Autodesk").
16 
17 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24 FREE.
25 
26 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
43 #include <kaydaradef.h>
44 #ifndef FBSDK_DLL
45 
48 #define FBSDK_DLL K_DLLIMPORT
49 #endif
50 
51 #include <fbsdk/fbcore.h>
52 #include <fbsdk/fbcomponent.h>
53 
54 #ifdef FBSDKUseNamespace
55 namespace FBSDKNamespace {
56 #endif
57 
60 
62  {
63  kFBGeometry_POINTS = 0x0000, //GL_POINTS,
64  kFBGeometry_LINES = 0x0001, //GL_LINES,
65  kFBGeometry_LINE_LOOP = 0x0002, //GL_LINE_LOOP,
66  kFBGeometry_LINE_STRIP = 0x0003, //GL_LINE_STRIP,
67  kFBGeometry_TRIANGLES = 0x0004, //GL_TRIANGLES,
68  kFBGeometry_TRIANGLE_STRIP = 0x0005, //GL_TRIANGLE_STRIP,
69  kFBGeometry_TRIANGLE_FAN = 0x0006, //GL_TRIANGLE_FAN,
70  kFBGeometry_QUADS = 0x0007, //GL_QUADS,
71  kFBGeometry_QUADS_STRIP = 0x0008, //GL_QUAD_STRIP,
72  kFBGeometry_POLYGON = 0x0009, //GL_POLYGON,
73  };
74 
77  {
83  };
84 
95  };
96 
98  // FBGeometry
100  __FB_FORWARD( FBGeometry );
101 
102 
114  {
121  } ;
122 
135  {
139  };
140 
141  FB_DEFINE_ENUM( FBSDK_DLL, GeometryMappingMode );
142  FB_DEFINE_ENUM( FBSDK_DLL, GeometryReferenceMode );
143 
145  {
152  };
153 
170 
171  protected:
176  FBGeometry(const char* pName, HIObject pObject=NULL);
177 
178  public:
187 
191  bool GeometryBegin();
192 
196  bool GeometryEnd();
197 
201  bool IsEditingEnabled() const;
203 
213  void VertexInit (int pSize, bool pResize, bool pInitUV = true, bool pInitVertexColor = false);
214 
220  bool VertexClear ();
221 
227  int VertexAdd (FBVertex pVertex);
228 
234  int VertexAdd (FBVertex pVertex, FBNormal pNormal);
235 
242  int VertexAdd (FBVertex pVertex, FBNormal pNormal, FBUV pUV);
243 
251  int VertexAdd (FBVertex pVertex, FBNormal pNormal, FBUV pUV, FBColorF pVertexColor);
252 
260  int VertexAdd (double px, double py, double pz);
261  int VertexAdd (double px, double py, double pz, double nx, double ny, double nz);
262  int VertexAdd (double px, double py, double pz, double nx, double ny, double nz, double UVu, double UVv);
263  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);
264 
270  bool VertexSet (FBVertex pVertex,int pIndex=-1);
271 
279  bool VertexSet (double px, double py, double pz,int pIndex=-1);
280 
286  bool VertexNormalSet(FBNormal pVertex,int pIndex=-1);
287 
295  bool VertexNormalSet(double px, double py, double pz,int pIndex=-1);
296 
297 
303  bool VertexUVSet(FBUV pUV, int pIndex=-1);
304 
311  bool VertexUVSet(float pU, float pV, int pIndex=-1);
312 
318  bool VertexColorSet(FBColorF pColor, int pIndex=-1);
319 
328  bool VertexColorSet(float pRed, float pGreen, float pBlue, float pAlpha, int pIndex=-1);
329 
331 
336 
340  int VertexCount () const;
341 
346  FBVertex VertexGet (int pIndex) const;
347 
351  FBVertex* GetVertexes() const;
352 
357  FBNormal VertexNormalGet(int pIndex=-1) const;
358 
363  FBUV VertexUVGet(int pIndex=-1) const;
364 
369  FBColorF VertexColorGet(int pIndex=-1) const;
370 
372 
373 
378 
389  bool VertexArrayInit (int pVertexcount, bool pUniqueMaterial, unsigned int pFBGeometryArrayIDs = 0);
390 
396  bool VertexArrayClear();
397 
403  FBVertex* GetPositionsArray(int& pOutArrayCount) const;
404 
407 
413  int* GetNormalsIndexArray(int& pOutArrayCount) const;
414 
420  FBNormal* GetNormalsDirectArray(int& pOutArrayCount) const;
421 
424 
430  int* GetTangentsIndexArray(int& pOutArrayCount) const;
431 
437  FBNormal* GetTangentsDirectArray(int& pOutArrayCount) const;
438 
441 
447  int* GetBinormalsIndexArray(int& pOutArrayCount) const;
448 
454  FBNormal* GetBinormalsDirectArray(int& pOutArrayCount) const;
455 
458 
464  int* GetVertexColorsIndexArray(int& pOutArrayCount) const;
465 
471  FBColorF* GetVertexColorsDirectArray(int& pOutArrayCount) const;
472 
476  FBStringList GetUVSets() const;
477 
482  FBGeometryMappingMode GetUVSetMappingMode(const char* pUVSetName = NULL) const;
483 
488  FBGeometryReferenceMode GetUVSetReferenceMode(const char* pUVSetName = NULL) const;
489 
496  int* GetUVSetIndexArray(int& pOutArrayCount, const char* pUVSetName = NULL) const;
497 
504  FBUV* GetUVSetDirectArray(int& pOutArrayCount, const char* pUVSetName = NULL) const;
505 
507 
513  int* GetMaterialIndexArray(int& pOutArrayCount) const;
515 
516 
521 
526  bool VertexGetSelected(int pIndex);
527 
533  bool VertexSetSelected(int pIndex,bool pState);
534 
539  bool VertexGetVisible(int pIndex);
540 
546  bool VertexSetVisible(int pIndex,bool pState);
547 
552  bool VertexGetTransformable(int pIndex);
554 
559 
561  int ShapeGetCount() const;
562 
564  const char* ShapeGetName(int pShapeIdx) const;
565 
570  int ShapeAdd(const char* pName);
571 
573  void ShapeClearAll();
574 
580  void ShapeInit(int pShapeIdx, int pDiffSize, bool pWithNormal = false);
581 
585  int ShapeGetDiffPointCount(int pShapeIdx) const;
586 
593  bool ShapeSetDiffPoint(int pShapeIdx, int pDiffIndex, int pOriIndex, const FBVertex& pPosDiff);
594 
602  bool ShapeSetDiffPoint(int pShapeIdx, int pDiffIndex, int pOriIndex, const FBVertex& pPosDiff, const FBNormal& pNormalDiff);
603 
610  bool ShapeGetDiffPoint(int pShapeIdx, int pDiffIndex, int& pOriIndex, FBVertex& pPosDiff) const;
611 
619  bool ShapeGetDiffPoint(int pShapeIdx, int pDiffIndex, int& pOriIndex, FBVertex& pPosDiff, FBNormal& pNormalDiff) const;
620 
622 
627 
633  void ModifyNotify( kFBGeometryUpdateFlags pFlags=kFBGeometryUpdateAll, int pFirstIndex=-1, int pLastIndex=-1 );
634 
636  };
637 
639  // FBMesh
641  __FB_FORWARD( FBMesh );
642 
644  class FBSDK_DLL FBMesh : public FBGeometry {
646 
647  public:
652  FBMesh(const char* pName, HIObject pObject=NULL);
653 
662  bool TriangleListAdd(int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
663 
672  bool TriangleStripAdd(int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
673 
683  bool PolygonListAdd(int pPolygonSize, int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
684 
689  int PolygonBegin(int pMaterialId=0);
690 
695  bool PolygonVertexAdd(int pVertex);
696 
702  int PolygonEnd();
703 
708  int PolygonVertexCount(int pPolygonIndex) const;
709 
715  int PolygonVertexIndex(int pPolygonIndex, int pVertexPolygonIndex) const;
716 
720  int PolygonCount() const;
721 
731  const int* PolygonVertexArrayGet(int& pArraySize) const;
732 
736  bool IsTriangleMesh() const;
737 
742  int PolygonMaterialIdGet(int pIndex=-1) const;
743 
747  void ComputeVertexNormals(bool pCW = false);
748 
750  void InverseNormal();
751  };
752 
754  // FBSurface
757 
760  {
766  };
767  FB_DEFINE_ENUM( FBSDK_DLL, SurfaceMode );
768 
771  {
777  };
778  FB_DEFINE_ENUM( FBSDK_DLL, SurfaceType );
779 
780 
783  {
785 
786  public:
791  FBSurface(const char* pName, HIObject pObject=NULL);
792 
793  virtual void SurfaceBegin();
794  virtual void SurfaceEnd();
795  virtual void SurfaceEditBegin();
796  virtual void SurfaceEditEnd();
797  virtual bool GetSurfaceCapped( int pUorV, int pDirection );
798  virtual int GetVertexCount( int pUorVorGlobal = -1 );
799  virtual void ControlPointsBegin() = 0;
800  virtual void SetControlPoint( int pIndex, double pX, double pY, double pZ, double pW );
801  virtual void GetControlPoint( int pIndex, double &pX, double &pY, double &pZ, double &pW );
802  virtual void ControlPointsEnd();
803 
809  bool VertexGetSelected(int pU,int pV);
816  bool VertexSetSelected(int pU,int pV,bool pState);
817 
823  bool VertexGetVisible(int pU,int pV);
824 
831  bool VertexSetVisible(int pU,int pV,bool pState);
832 
838  bool VertexGetTransformable(int pU,int pV);
839 
840 
848 
849  private:
850  void FBSurfaceInitProperties();
851  };
852 
855  {
859  };
860  FB_DEFINE_ENUM( FBSDK_DLL, NurbType );
861 
862 
864  // FBNurbs
867 
869  class FBSDK_DLL FBNurbs : public FBSurface
870  {
872 
873  public:
878  FBNurbs(const char* pName, HIObject pObject=NULL);
879 
882  virtual void SurfaceBegin();
883 
886  virtual void SurfaceEnd();
887 
890  virtual void SurfaceEditBegin();
893  virtual void SurfaceEditEnd();
896  virtual void ControlPointsBegin();
899  virtual void ControlPointsEnd();
904  virtual void SetControlWeight( int pIndex, double pWeight );
909  virtual double GetControlWeight( int pIndex );
915  virtual void SetControlMultiplicity( int pUorV, int pIndex, int pMultiplicity );
920  virtual int GetControlMultiplicity( int pUorV, int pIndex );
926  virtual void SetControlKnotValue( int pUorV, int pIndex, double pKnotValue );
931  virtual double GetControlKnotValue( int pUorV, int pIndex );
936  virtual int GetKnotCount( int pUorV );
937 
942 
943  private:
944  void FBNurbsInitProperties();
945  };
946 
948  // FBPatch
951 
953  class FBSDK_DLL FBPatch : public FBSurface
954  {
956 
957  public:
962  FBPatch(const char* pName, HIObject pObject=NULL);
963 
966  virtual void SurfaceBegin();
967 
970  virtual void SurfaceEnd();
971 
974  virtual void SurfaceEditBegin();
975 
978  virtual void SurfaceEditEnd();
979 
982  virtual void ControlPointsBegin();
985  virtual void ControlPointsEnd();
986 
987 
990 
991  private:
992  void FBPatchInitProperties();
993 
994  };
995 
996 #ifdef FBSDKUseNamespace
997 }
998 #endif
999 #endif
FBPropertyBool VClosed
Read Write Property: V Closed
Definition: fbgeometry.h:846
FBPropertyGeometryReferenceMode BinormalReferenceMode
Read Only Property: Binormal reference mode.
Definition: fbgeometry.h:440
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:132
Low quality, no normals.
Definition: fbgeometry.h:762
FBPropertyGeometryMappingMode TangentMappingMode
Read Only Property: Tangent mapping mode.
Definition: fbgeometry.h:422
FBGeometryArrayElementType
Type of data when requesting an array.
Definition: fbgeometry.h:86
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
Definition: fbproperties.h:139
class FBVector4< float > FBVertex
Vertex.
Definition: fbtypes.h:597
FBPropertyInt VStep
Read Write Property: Step in V directions.
Definition: fbgeometry.h:844
mapping mode request from associated shading network change.
Definition: fbgeometry.h:151
FBSurfaceMode
Surface modes.
Definition: fbgeometry.h:759
#define NULL
Definition: kaydara.h:179
Mesh class.
Definition: fbgeometry.h:644
FBGeometryReferenceMode
Determine how the mapping information is stored in the array of coordinate.
Definition: fbgeometry.h:134
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbgeometry.h:48
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
FBPropertyGeometryMappingMode MaterialMappingMode
Read Property: Material mapping mode.
Definition: fbgeometry.h:506
FBPropertyGeometryMappingMode VertexColorMappingMode
Read Only Property: Vertex Color mapping mode.
Definition: fbgeometry.h:456
Periodic Type Nurb.
Definition: fbgeometry.h:856
FBGeometryMappingMode
Determine how the element is mapped on a surface.
Definition: fbgeometry.h:113
Contains definitions for devices, boxes and models.
FBSurfaceType
Surface types.
Definition: fbgeometry.h:770
Each element is an array of 4 float.
Definition: fbgeometry.h:92
Surface class.
Definition: fbgeometry.h:782
FBGeometryPrimitiveType
Definition: fbgeometry.h:61
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:148
class FBPropertyBaseEnum< enum FBSurfaceType > FBPropertySurfaceType
Definition: fbgeometry.h:778
FBNurbType
Surface types.
Definition: fbgeometry.h:854
FBPropertyBool UClosed
Read Write Property: U Closed.
Definition: fbgeometry.h:845
kFBGeometryUpdateFlags
Definition: fbgeometry.h:144
FBPropertyGeometryMappingMode NormalMappingMode
Read Only Property: Normal mapping mode.
Definition: fbgeometry.h:405
class FBPropertyBaseEnum< enum FBGeometryMappingMode > FBPropertyGeometryMappingMode
Definition: fbgeometry.h:141
class FBPropertyBaseEnum< enum FBGeometryReferenceMode > FBPropertyGeometryReferenceMode
Definition: fbgeometry.h:142
Nurbs class.
Definition: fbgeometry.h:869
FBPropertySurfaceType VSurfaceType
Read Write Property: Patch mode for V direction.
Definition: fbgeometry.h:989
FBPropertyGeometryReferenceMode NormalReferenceMode
Read Only Property: Normal reference mode.
Definition: fbgeometry.h:406
ID to the Binormal array.
Definition: fbgeometry.h:81
FBPropertySurfaceType USurfaceType
Read Write Property: Patch mode for U direction.
Definition: fbgeometry.h:988
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
ID to the Tangent array.
Definition: fbgeometry.h:80
FBPropertyInt VSize
Read Write Property: Size in V directions.
Definition: fbgeometry.h:842
FBPropertyInt USize
Read Write Property: Size in U directions.
Definition: fbgeometry.h:841
FBPropertySurfaceMode SurfaceMode
Read Write Property: Surface mode.
Definition: fbgeometry.h:847
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
FBPropertyGeometryReferenceMode VertexColorReferenceMode
Read Only Property: Vertex Color reference mode.
Definition: fbgeometry.h:457
Each element is an array of 3 float.
Definition: fbgeometry.h:91
Basic class definitions.
class FBPropertyBaseEnum< enum FBNurbType > FBPropertyNurbType
Definition: fbgeometry.h:860
ID to the Normal by Point array.
Definition: fbgeometry.h:79
MotionBuilder SDK base class.
Definition: fbcomponent.h:664
class FBVector4< float > FBNormal
Normal.
Definition: fbtypes.h:599
String list.
Definition: fbstring.h:201
FBGeometryArrayID
ID to use when requesting a specific array of data for a model.
Definition: fbgeometry.h:76
FBPropertyInt VOrder
Read Write Property: Nurbs V order.
Definition: fbgeometry.h:939
High quality, no normals.
Definition: fbgeometry.h:764
FBPropertyNurbType VNurbType
Read Write Property: Nurbs Type for V direction.
Definition: fbgeometry.h:941
FBPropertyInt UStep
Read Write Property: Step in U directions.
Definition: fbgeometry.h:843
Open Type Nurb.
Definition: fbgeometry.h:858
Closed Type Nurb.
Definition: fbgeometry.h:857
Geometry class.
Definition: fbgeometry.h:168
only control point's position & normal change, so only update those values in the strip...
Definition: fbgeometry.h:148
ID to the Point array.
Definition: fbgeometry.h:78
class FBVector2< float > FBUV
Represents a UV coordinate as a FBVector2 of floats in the range of 0.0f to 1.0f; value 0 is the U va...
Definition: fbtypes.h:595
control point add/remove, topology change, cluster/shape change and such events requiring regenerate ...
Definition: fbgeometry.h:147
ID to the Vertex Color Array.
Definition: fbgeometry.h:82
Bezier Quadric surface.
Definition: fbgeometry.h:773
FBPropertyGeometryReferenceMode TangentReferenceMode
Read Only Property: Tangent reference mode.
Definition: fbgeometry.h:423
Patch class.
Definition: fbgeometry.h:953
class FBPropertyBaseEnum< enum FBSurfaceMode > FBPropertySurfaceMode
Definition: fbgeometry.h:767
FBPropertyNurbType UNurbType
Read Write Property: Nurbs Type for U direction.
Definition: fbgeometry.h:940
FBPropertyInt UOrder
Read Write Property: Nurbs U order.
Definition: fbgeometry.h:938
class FBVector4< float > FBColorF
Color float.
Definition: fbtypes.h:444
FBPropertyGeometryMappingMode BinormalMappingMode
Read Only Property: Binormal mapping mode.
Definition: fbgeometry.h:439
class FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool