Open Reality Reference Guide
fbmaterial.h
Go to the documentation of this file.
1 #ifndef __FBMATERIAL_H__
2 #define __FBMATERIAL_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
48  #define FBSDK_DLL K_DLLIMPORT
49 #endif
50 
51 #include <fbsdk/fbcore.h>
52 #include <fbsdk/fbcomponent.h>
53 #include <fbsdk/fbtexture.h>
54 
55 #ifdef FBSDKUseNamespace
56  namespace FBSDKNamespace {
57 #endif
58 
60 // FBMaterial
63 
66  kFBMaterialTextureEmissive,
67  kFBMaterialTextureEmissiveFactor,
68  kFBMaterialTextureAmbient,
69  kFBMaterialTextureAmbientFactor,
70  kFBMaterialTextureDiffuse,
71  kFBMaterialTextureDiffuseFactor,
72  kFBMaterialTextureSpecular,
73  kFBMaterialTextureSpecularFactor,
74  kFBMaterialTextureShiness,
75  kFBMaterialTextureBump,
76  kFBMaterialTextureNormalMap,
77  kFBMaterialTextureTransparent,
78  kFBMaterialTextureTransparentFactor,
79  kFBMaterialTextureReflection,
80  kFBMaterialTextureReflectionFactor,
81  kFBMaterialTextureDisplacementColor
82 };
83 
84 FB_DEFINE_COMPONENT( FBSDK_DLL, Material );
85 
87 class FBSDK_DLL FBMaterial : public FBBox {
89 public:
94  FBMaterial(const char* pName, HIObject pObject=NULL);
95 
101 
104 
107 
110 
113 
117 
121 
124 
127 
131  FBTexture* GetTexture(FBMaterialTextureType pType = kFBMaterialTextureDiffuse);
132 
137  void SetTexture(FBTexture* pTexture, FBMaterialTextureType pType = kFBMaterialTextureDiffuse);
138 
140  void OGLInit();
141 
143  virtual const char* GetMaterialName() const;
144 
146  virtual const char* GetMaterialDesc() const;
147 
152  virtual bool FbxStore(FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat) override;
153  virtual bool FbxRetrieve(FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat) override;
154 
158  virtual const char* FbxGetObjectType() override;
159 
163  virtual const char* FbxGetObjectSubType() override;
164 
165 protected:
174  FBProperty* CreateTextureConnectableUserProperty(const char* pName, FBPropertyType pType, const char* pDataType, bool pAnimatable);
175 };
176 
178 // FBPropertyListMaterial
182 {
183 public:
189  FBMaterial* operator[](int pIndex);
190 };
191 
196 #define FBStorableCustomMaterialImplementation(ClassName, Type)\
197  const char* ClassName::FbxGetObjectSubType(){ return #ClassName; }\
198  HIObject RegisterStorable##ClassName##Create(HIObject /*pOwner*/, const char* pName, void* /*pData*/){\
199  ClassName* Class = new ClassName(pName);\
200  Class->mAllocated = true;\
201  if( Class->FBCreate() ){\
202  return Class->GetHIObject();\
203  } else {\
204  delete Class;\
205  return NULL;}}\
206  FBLibraryModule(ClassName##Storable){\
207  FBString lGroup = "FbxStorable/";\
208  lGroup += #Type;\
209  FBRegisterObject(ClassName##R2, lGroup, #ClassName, "", RegisterStorable##ClassName##Create, true, NULL);\
210  FBSetStoreableCustomMaterialRegistered();}\
211 
212 
213 #ifdef FBSDKUseNamespace
214  }
215 #endif
216 #endif
A box is a fundamental building block in the application architecture.
Definition: fbcore.h:218
FBX file interface.
Definition: fbfbx.h:80
Material class.
Definition: fbmaterial.h:87
FBPropertyAnimatableDouble DisplacementFactor
Read Write Property: Displacement Factor value.
Definition: fbmaterial.h:126
FBPropertyAnimatableDouble AmbientFactor
Read Write Property: Ambient Factor value.
Definition: fbmaterial.h:103
FBPropertyAnimatableColor DisplacementColor
Read Write Property: Displacement color.
Definition: fbmaterial.h:125
void SetTexture(FBTexture *pTexture, FBMaterialTextureType pType=kFBMaterialTextureDiffuse)
Set associated texture.
FBPropertyAnimatableColor Ambient
Read Write Property: Ambient color.
Definition: fbmaterial.h:102
FBPropertyAnimatableDouble EmissiveFactor
Read Write Property: Emissive Factor value.
Definition: fbmaterial.h:106
virtual const char * GetMaterialDesc() const
Return Material Desc Name.
void OGLInit()
Setup OpenGL fixed pipeline material settings.
FBMaterial(const char *pName, HIObject pObject=NULL)
Constructor.
FBMaterial * Clone()
Clone the material.
FBProperty * CreateTextureConnectableUserProperty(const char *pName, FBPropertyType pType, const char *pDataType, bool pAnimatable)
Create user custom texture connect property for custom material derived from FBMaterial only.
FBPropertyAnimatableColor Bump
Read Write Property: Bump.
Definition: fbmaterial.h:114
virtual const char * FbxGetObjectType() override
Returns the class type inherited by the class of an object, for example: 'Material'.
FBPropertyAnimatableColor NormalMap
Read Write Property: Normal Map.
Definition: fbmaterial.h:115
virtual const char * FbxGetObjectSubType() override
Returns the class sub type inherited by the class of an object, for example: 'Default',...
FBPropertyAnimatableDouble Shininess
Read Write Property: Shininess value.
Definition: fbmaterial.h:120
virtual bool FbxStore(FBFbxObject *pFbxObject, kFbxObjectStore pStoreWhat) override
Store and Retrieve function that can be overloaded.
FBTexture * GetTexture(FBMaterialTextureType pType=kFBMaterialTextureDiffuse)
Retrieve associated texture.
virtual const char * GetMaterialName() const
Return Material Name.
FBPropertyAnimatableColor Diffuse
Read Write Property: Diffuse color.
Definition: fbmaterial.h:108
FBPropertyAnimatableDouble TransparencyFactor
Read Write Property: Transparency Factor value.
Definition: fbmaterial.h:112
FBPropertyAnimatableDouble BumpFactor
Read Write Property: Bump Factor value.
Definition: fbmaterial.h:116
FBPropertyAnimatableColor Reflection
Read Write Property: Reflection color.
Definition: fbmaterial.h:122
FBPropertyAnimatableDouble SpecularFactor
Read Write Property: Specular Factor value.
Definition: fbmaterial.h:119
FBPropertyAnimatableDouble DiffuseFactor
Read Write Property: Diffuse Factor value.
Definition: fbmaterial.h:109
FBPropertyAnimatableColor Emissive
Read Write Property: Emissive color.
Definition: fbmaterial.h:105
FBPropertyAnimatableColor TransparentColor
Read Write Property: Transparent color.
Definition: fbmaterial.h:111
FBPropertyAnimatableDouble ReflectionFactor
Read Write Property: Reflection Factor value.
Definition: fbmaterial.h:123
FBPropertyAnimatableColor Specular
Read Write Property: Specular color.
Definition: fbmaterial.h:118
Property: Base property class.
Definition: fbproperties.h:195
PropertyList: Concrete class for PropertyList of component
Definition: fbcomponent.h:536
PropertyList: Material
Definition: fbmaterial.h:182
FBMaterial * operator[](int pIndex)
Get the material at a specific index.
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
Contains definitions for devices, boxes and models.
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbmaterial.h:48
FBMaterialTextureType
Various Material texture channels' type.
Definition: fbmaterial.h:65
class K_DLLIMPORT FBPropertyBaseAnimatable< FBColor, kFBPT_ColorRGB > FBPropertyAnimatableColor
FBPropertyAnimatableColor type definition.
FBPropertyType
Property types.
Definition: fbproperties.h:80
class K_DLLIMPORT FBPropertyBaseAnimatable< double, kFBPT_double > FBPropertyAnimatableDouble
FBPropertyBaseAnimatableDouble type definition.
kFbxObjectStore
Description of the different store/retrieve passes of the FBX format.
Definition: fbtypes.h:74
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68