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 
87 
90 
91 
102  };
103 
105  // FBGeometry
107  __FB_FORWARD( FBGeometry );
108 
109 
121  {
128  } ;
129 
142  {
146  };
147 
148  FB_DEFINE_ENUM( FBSDK_DLL, GeometryMappingMode );
149  FB_DEFINE_ENUM( FBSDK_DLL, GeometryReferenceMode );
150 
152  {
159  };
160 
177 
178  protected:
183  FBGeometry(const char* pName, HIObject pObject=NULL);
184 
185  public:
194 
198  bool GeometryBegin();
199 
203  bool GeometryEnd();
204 
208  bool IsEditingEnabled() const;
210 
220  void VertexInit (int pSize, bool pResize, bool pInitUV = true, bool pInitVertexColor = false);
221 
227  bool VertexClear ();
228 
234  int VertexAdd (FBVertex pVertex);
235 
241  int VertexAdd (FBVertex pVertex, FBNormal pNormal);
242 
249  int VertexAdd (FBVertex pVertex, FBNormal pNormal, FBUV pUV);
250 
258  int VertexAdd (FBVertex pVertex, FBNormal pNormal, FBUV pUV, FBColorF pVertexColor);
259 
267  int VertexAdd (double px, double py, double pz);
268  int VertexAdd (double px, double py, double pz, double nx, double ny, double nz);
269  int VertexAdd (double px, double py, double pz, double nx, double ny, double nz, double UVu, double UVv);
270  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);
271 
277  bool VertexSet (FBVertex pVertex,int pIndex=-1);
278 
286  bool VertexSet (double px, double py, double pz,int pIndex=-1);
287 
293  bool VertexNormalSet(FBNormal pVertex,int pIndex=-1);
294 
302  bool VertexNormalSet(double px, double py, double pz,int pIndex=-1);
303 
304 
310  bool VertexUVSet(FBUV pUV, int pIndex=-1);
311 
318  bool VertexUVSet(float pU, float pV, int pIndex=-1);
319 
325  bool VertexColorSet(FBColorF pColor, int pIndex=-1);
326 
335  bool VertexColorSet(float pRed, float pGreen, float pBlue, float pAlpha, int pIndex=-1);
336 
338 
343 
347  int VertexCount () const;
348 
353  FBVertex VertexGet (int pIndex) const;
354 
358  FBVertex* GetVertexes() const;
359 
364  FBNormal VertexNormalGet(int pIndex=-1) const;
365 
370  FBUV VertexUVGet(int pIndex=-1) const;
371 
376  FBColorF VertexColorGet(int pIndex=-1) const;
377 
379 
380 
385 
396  bool VertexArrayInit (int pVertexcount, bool pUniqueMaterial, unsigned int pFBGeometryArrayIDs = 0);
397 
403  bool VertexArrayClear();
404 
410  FBVertex* GetPositionsArray(int& pOutArrayCount) const;
411 
414 
420  int* GetNormalsIndexArray(int& pOutArrayCount) const;
421 
427  FBNormal* GetNormalsDirectArray(int& pOutArrayCount) const;
428 
431 
437  int* GetTangentsIndexArray(int& pOutArrayCount) const;
438 
444  FBNormal* GetTangentsDirectArray(int& pOutArrayCount) const;
445 
448 
454  int* GetBinormalsIndexArray(int& pOutArrayCount) const;
455 
461  FBNormal* GetBinormalsDirectArray(int& pOutArrayCount) const;
462 
465 
471  int* GetVertexColorsIndexArray(int& pOutArrayCount) const;
472 
478  FBColorF* GetVertexColorsDirectArray(int& pOutArrayCount) const;
479 
483  FBStringList GetUVSets() const;
484 
489  FBGeometryMappingMode GetUVSetMappingMode(const char* pUVSetName = NULL) const;
490 
495  FBGeometryReferenceMode GetUVSetReferenceMode(const char* pUVSetName = NULL) const;
496 
503  int* GetUVSetIndexArray(int& pOutArrayCount, const char* pUVSetName = NULL) const;
504 
511  FBUV* GetUVSetDirectArray(int& pOutArrayCount, const char* pUVSetName = NULL) const;
512 
514 
520  int* GetMaterialIndexArray(int& pOutArrayCount) const;
522 
523 
528 
533  bool VertexGetSelected(int pIndex);
534 
540  bool VertexSetSelected(int pIndex,bool pState);
541 
546  bool VertexGetVisible(int pIndex);
547 
553  bool VertexSetVisible(int pIndex,bool pState);
554 
559  bool VertexGetTransformable(int pIndex);
561 
566 
568  int ShapeGetCount() const;
569 
571  const char* ShapeGetName(int pShapeIdx) const;
572 
577  int ShapeAdd(const char* pName);
578 
580  void ShapeClearAll();
581 
587  void ShapeInit(int pShapeIdx, int pDiffSize, bool pWithNormal = false);
588 
592  int ShapeGetDiffPointCount(int pShapeIdx) const;
593 
600  bool ShapeSetDiffPoint(int pShapeIdx, int pDiffIndex, int pOriIndex, const FBVertex& pPosDiff);
601 
609  bool ShapeSetDiffPoint(int pShapeIdx, int pDiffIndex, int pOriIndex, const FBVertex& pPosDiff, const FBNormal& pNormalDiff);
610 
617  bool ShapeGetDiffPoint(int pShapeIdx, int pDiffIndex, int& pOriIndex, FBVertex& pPosDiff) const;
618 
626  bool ShapeGetDiffPoint(int pShapeIdx, int pDiffIndex, int& pOriIndex, FBVertex& pPosDiff, FBNormal& pNormalDiff) const;
627 
629 
634 
640  void ModifyNotify( kFBGeometryUpdateFlags pFlags=kFBGeometryUpdateAll, int pFirstIndex=-1, int pLastIndex=-1 );
641 
643  };
644 
646  // FBMesh
648  __FB_FORWARD( FBMesh );
649 
651  class FBSDK_DLL FBMesh : public FBGeometry {
653 
654  public:
659  FBMesh(const char* pName, HIObject pObject=NULL);
660 
669  bool TriangleListAdd(int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
670 
679  bool TriangleStripAdd(int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
680 
690  bool PolygonListAdd(int pPolygonSize, int pIndexArraySize, int* pIndexArray, int pMaterialId=0);
691 
696  int PolygonBegin(int pMaterialId=0);
697 
702  bool PolygonVertexAdd(int pVertex);
703 
709  int PolygonEnd();
710 
715  int PolygonVertexCount(int pPolygonIndex) const;
716 
722  int PolygonVertexIndex(int pPolygonIndex, int pVertexPolygonIndex) const;
723 
727  int PolygonCount() const;
728 
738  const int* PolygonVertexArrayGet(int& pArraySize) const;
739 
743  bool IsTriangleMesh() const;
744 
749  int PolygonMaterialIdGet(int pIndex=-1) const;
750 
754  void ComputeVertexNormals(bool pCW = false);
755 
757  void InverseNormal();
758  };
759 
761  // FBSurface
764 
767  {
773  };
774  FB_DEFINE_ENUM( FBSDK_DLL, SurfaceMode );
775 
778  {
784  };
785  FB_DEFINE_ENUM( FBSDK_DLL, SurfaceType );
786 
787 
790  {
792 
793  public:
798  FBSurface(const char* pName, HIObject pObject=NULL);
799 
800  virtual void SurfaceBegin();
801  virtual void SurfaceEnd();
802  virtual void SurfaceEditBegin();
803  virtual void SurfaceEditEnd();
804  virtual bool GetSurfaceCapped( int pUorV, int pDirection );
805  virtual int GetVertexCount( int pUorVorGlobal = -1 );
806  virtual void ControlPointsBegin() = 0;
807  virtual void SetControlPoint( int pIndex, double pX, double pY, double pZ, double pW );
808  virtual void GetControlPoint( int pIndex, double &pX, double &pY, double &pZ, double &pW );
809  virtual void ControlPointsEnd();
810 
816  bool VertexGetSelected(int pU,int pV);
823  bool VertexSetSelected(int pU,int pV,bool pState);
824 
830  bool VertexGetVisible(int pU,int pV);
831 
838  bool VertexSetVisible(int pU,int pV,bool pState);
839 
845  bool VertexGetTransformable(int pU,int pV);
846 
847 
855 
856  private:
857  void FBSurfaceInitProperties();
858  };
859 
862  {
866  };
867  FB_DEFINE_ENUM( FBSDK_DLL, NurbType );
868 
869 
871  // FBNurbs
874 
876  class FBSDK_DLL FBNurbs : public FBSurface
877  {
879 
880  public:
885  FBNurbs(const char* pName, HIObject pObject=NULL);
886 
889  virtual void SurfaceBegin();
890 
893  virtual void SurfaceEnd();
894 
897  virtual void SurfaceEditBegin();
900  virtual void SurfaceEditEnd();
903  virtual void ControlPointsBegin();
906  virtual void ControlPointsEnd();
911  virtual void SetControlWeight( int pIndex, double pWeight );
916  virtual double GetControlWeight( int pIndex );
922  virtual void SetControlMultiplicity( int pUorV, int pIndex, int pMultiplicity );
927  virtual int GetControlMultiplicity( int pUorV, int pIndex );
933  virtual void SetControlKnotValue( int pUorV, int pIndex, double pKnotValue );
938  virtual double GetControlKnotValue( int pUorV, int pIndex );
943  virtual int GetKnotCount( int pUorV );
944 
949 
950  private:
951  void FBNurbsInitProperties();
952  };
953 
955  // FBPatch
958 
960  class FBSDK_DLL FBPatch : public FBSurface
961  {
963 
964  public:
969  FBPatch(const char* pName, HIObject pObject=NULL);
970 
973  virtual void SurfaceBegin();
974 
977  virtual void SurfaceEnd();
978 
981  virtual void SurfaceEditBegin();
982 
985  virtual void SurfaceEditEnd();
986 
989  virtual void ControlPointsBegin();
992  virtual void ControlPointsEnd();
993 
994 
997 
998  private:
999  void FBPatchInitProperties();
1000 
1001  };
1002 
1003 #ifdef FBSDKUseNamespace
1004 }
1005 #endif
1006 #endif
class FBPropertyBaseEnum< enum FBGeometryMappingMode > FBPropertyGeometryMappingMode
Definition: fbgeometry.h:148
ID to the Tangent array.
Definition: fbgeometry.h:80
FBPropertyBool VClosed
Read Write Property: V Closed
Definition: fbgeometry.h:853
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:132
FBPropertySurfaceType USurfaceType
Read Write Property: Patch mode for U direction.
Definition: fbgeometry.h:995
#define FB_DEFINE_COMPONENT(DllTag, Type)
Define a component and give it the ability to be a property.
Definition: fbproperties.h:139
Each element is an array of 3 float.
Definition: fbgeometry.h:98
ID to the Binormal array.
Definition: fbgeometry.h:81
FBPropertyInt VStep
Read Write Property: Step in V directions.
Definition: fbgeometry.h:851
ID to the Normal by Point array.
Definition: fbgeometry.h:79
FBGeometryArrayID
ID to use when requesting a specific array of data for a model.
Definition: fbgeometry.h:76
#define NULL
Definition: kaydara.h:169
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbgeometry.h:48
FBPropertyGeometryMappingMode BinormalMappingMode
Read Only Property: Binormal mapping mode.
Definition: fbgeometry.h:446
class FBPropertyBaseEnum< enum FBNurbType > FBPropertyNurbType
Definition: fbgeometry.h:867
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
FBPropertySurfaceType VSurfaceType
Read Write Property: Patch mode for V direction.
Definition: fbgeometry.h:996
Closed Type Nurb.
Definition: fbgeometry.h:864
FBPropertyGeometryReferenceMode VertexColorReferenceMode
Read Only Property: Vertex Color reference mode.
Definition: fbgeometry.h:464
only control point's position & normal change, so only update those values in the strip...
Definition: fbgeometry.h:155
ID to the Point array.
Definition: fbgeometry.h:78
control point add/remove, topology change, cluster/shape change and such events requiring regenerate ...
Definition: fbgeometry.h:154
Contains definitions for devices, boxes and models.
High quality, no normals.
Definition: fbgeometry.h:771
class FBVector4< float > FBNormal
Normal.
Definition: fbtypes.h:599
class FBPropertyBaseEnum< enum FBSurfaceMode > FBPropertySurfaceMode
Definition: fbgeometry.h:774
FBPropertyGeometryMappingMode MaterialMappingMode
Read Property: Material mapping mode.
Definition: fbgeometry.h:513
FBPropertyGeometryMappingMode NormalMappingMode
Read Only Property: Normal mapping mode.
Definition: fbgeometry.h:412
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:148
MotionBuilder SDK base class.
Definition: fbcomponent.h:668
Open Type Nurb.
Definition: fbgeometry.h:865
FBPropertyBool UClosed
Read Write Property: U Closed.
Definition: fbgeometry.h:852
FBPropertyInt VOrder
Read Write Property: Nurbs V order.
Definition: fbgeometry.h:946
FBPropertyGeometryReferenceMode NormalReferenceMode
Read Only Property: Normal reference mode.
Definition: fbgeometry.h:413
class FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
ID to the Vertex Color Array.
Definition: fbgeometry.h:82
Bezier Quadric surface.
Definition: fbgeometry.h:780
Nurbs class.
Definition: fbgeometry.h:876
FBPropertyNurbType VNurbType
Read Write Property: Nurbs Type for V direction.
Definition: fbgeometry.h:948
FBGeometryArrayElementType
Type of data when requesting an array.
Definition: fbgeometry.h:93
class FBVector4< float > FBVertex
Vertex.
Definition: fbtypes.h:597
class FBVector4< float > FBColorF
Color float.
Definition: fbtypes.h:444
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
Mesh class.
Definition: fbgeometry.h:651
FBPropertyGeometryReferenceMode TangentReferenceMode
Read Only Property: Tangent reference mode.
Definition: fbgeometry.h:430
FBPropertyInt VSize
Read Write Property: Size in V directions.
Definition: fbgeometry.h:849
FBSurfaceMode
Surface modes.
Definition: fbgeometry.h:766
FBPropertyInt USize
Read Write Property: Size in U directions.
Definition: fbgeometry.h:848
Low quality, no normals.
Definition: fbgeometry.h:769
#define FBSDKNamespace
FBSDKNamespace define.
Definition: fbversion.h:64
FBPropertySurfaceMode SurfaceMode
Read Write Property: Surface mode.
Definition: fbgeometry.h:854
Basic class definitions.
Geometry class.
Definition: fbgeometry.h:175
FBGeometryMappingMode
Determine how the element is mapped on a surface.
Definition: fbgeometry.h:120
FBPropertyNurbType UNurbType
Read Write Property: Nurbs Type for U direction.
Definition: fbgeometry.h:947
Surface class.
Definition: fbgeometry.h:789
mapping mode request from associated shading network change.
Definition: fbgeometry.h:158
FBPropertyInt UOrder
Read Write Property: Nurbs U order.
Definition: fbgeometry.h:945
#define K_DEPRECATED_2014
Definition: kaydara.h:412
String list.
Definition: fbstring.h:201
FBGeometryPrimitiveType
Definition: fbgeometry.h:61
Each element is an array of 4 float.
Definition: fbgeometry.h:99
class FBPropertyBaseEnum< enum FBSurfaceType > FBPropertySurfaceType
Definition: fbgeometry.h:785
FBNurbType
Surface types.
Definition: fbgeometry.h:861
FBPropertyInt UStep
Read Write Property: Step in U directions.
Definition: fbgeometry.h:850
FBGeometryReferenceMode
Determine how the mapping information is stored in the array of coordinate.
Definition: fbgeometry.h:141
Periodic Type Nurb.
Definition: fbgeometry.h:863
class FBPropertyBaseEnum< enum FBGeometryReferenceMode > FBPropertyGeometryReferenceMode
Definition: fbgeometry.h:149
class FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
FBSurfaceType
Surface types.
Definition: fbgeometry.h:777
const int kFBGeometryArrayID_VertexColor
Definition: fbgeometry.h:89
Patch class.
Definition: fbgeometry.h:960
const int kFBGeometryArrayID_NormalByPoint
Definition: fbgeometry.h:86
FBPropertyGeometryMappingMode TangentMappingMode
Read Only Property: Tangent mapping mode.
Definition: fbgeometry.h:429
FBPropertyGeometryReferenceMode BinormalReferenceMode
Read Only Property: Binormal reference mode.
Definition: fbgeometry.h:447
kFBGeometryUpdateFlags
Definition: fbgeometry.h:151
FBPropertyGeometryMappingMode VertexColorMappingMode
Read Only Property: Vertex Color mapping mode.
Definition: fbgeometry.h:463