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
45 
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 
157  virtual const char* FbxGetObjectType() override;
158 
161  virtual const char* FbxGetObjectSubType() override;
162 
163 protected:
172  FBProperty* CreateTextureConnectableUserProperty(const char* pName, FBPropertyType pType, const char* pDataType, bool pAnimatable);
173 };
174 
176 // FBPropertyListMaterial
180 {
181 public:
187  FBMaterial* operator[](int pIndex);
188 };
189 
194 #define FBStorableCustomMaterialImplementation(ClassName, Type)\
195  const char* ClassName::FbxGetObjectSubType(){ return #ClassName; }\
196  HIObject RegisterStorable##ClassName##Create(HIObject /*pOwner*/, const char* pName, void* /*pData*/){\
197  ClassName* Class = new ClassName(pName);\
198  Class->mAllocated = true;\
199  if( Class->FBCreate() ){\
200  return Class->GetHIObject();\
201  } else {\
202  delete Class;\
203  return NULL;}}\
204  FBLibraryModule(ClassName##Storable){\
205  FBString lGroup = "FbxStorable/";\
206  lGroup += #Type;\
207  FBRegisterObject(ClassName##R2, lGroup, #ClassName, "", RegisterStorable##ClassName##Create, true, NULL);\
208  FBSetStoreableCustomMaterialRegistered();}\
209 
210 
211 #ifdef FBSDKUseNamespace
212  }
213 #endif
214 #endif
FBMaterial::GetMaterialDesc
virtual const char * GetMaterialDesc() const
Return Material Desc Name.
FBMaterial::FBMaterial
FBMaterial(const char *pName, HIObject pObject=NULL)
Constructor.
kFbxObjectStore
kFbxObjectStore
Description of the different store/retrieve passes of the FBX format.
Definition: fbtypes.h:74
FBMaterial::FbxStore
virtual bool FbxStore(FBFbxObject *pFbxObject, kFbxObjectStore pStoreWhat) override
Store and Retrieve function that can be overloaded.
FBMaterial::DisplacementColor
FBPropertyAnimatableColor DisplacementColor
Read Write Property: Displacement color.
Definition: fbmaterial.h:125
FBMaterial::GetTexture
FBTexture * GetTexture(FBMaterialTextureType pType=kFBMaterialTextureDiffuse)
Retrieve associated texture.
FBSDK_DLL
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbmaterial.h:48
FBMaterial::DisplacementFactor
FBPropertyAnimatableDouble DisplacementFactor
Read Write Property: Displacement Factor value.
Definition: fbmaterial.h:126
FBMaterial::Reflection
FBPropertyAnimatableColor Reflection
Read Write Property: Reflection color.
Definition: fbmaterial.h:122
FBMaterial::Bump
FBPropertyAnimatableColor Bump
Read Write Property: Bump.
Definition: fbmaterial.h:114
FBPropertyAnimatableColor
class K_DLLIMPORT FBPropertyBaseAnimatable< FBColor, kFBPT_ColorRGB > FBPropertyAnimatableColor
FBPropertyAnimatableColor type definition.
Definition: fbproperties.h:1776
FBBox
A box is a fundamental building block in the application architecture.
Definition: fbcore.h:218
FBMaterial::AmbientFactor
FBPropertyAnimatableDouble AmbientFactor
Read Write Property: Ambient Factor value.
Definition: fbmaterial.h:103
FBMaterial::OGLInit
void OGLInit()
Setup OpenGL fixed pipeline material settings.
FBMaterial::Shininess
FBPropertyAnimatableDouble Shininess
Read Write Property: Shininess value.
Definition: fbmaterial.h:120
FBMaterial::BumpFactor
FBPropertyAnimatableDouble BumpFactor
Read Write Property: Bump Factor value.
Definition: fbmaterial.h:116
FBMaterial::TransparencyFactor
FBPropertyAnimatableDouble TransparencyFactor
Read Write Property: Transparency Factor value.
Definition: fbmaterial.h:112
FBMaterial::GetMaterialName
virtual const char * GetMaterialName() const
Return Material Name.
FBMaterial::Clone
FBMaterial * Clone()
Clone the material.
FBMaterialTextureType
FBMaterialTextureType
Various Material texture channels' type.
Definition: fbmaterial.h:65
FBMaterial::NormalMap
FBPropertyAnimatableColor NormalMap
Read Write Property: Normal Map.
Definition: fbmaterial.h:115
FBMaterial::Diffuse
FBPropertyAnimatableColor Diffuse
Read Write Property: Diffuse color.
Definition: fbmaterial.h:108
FBMaterial::ReflectionFactor
FBPropertyAnimatableDouble ReflectionFactor
Read Write Property: Reflection Factor value.
Definition: fbmaterial.h:123
FBMaterial::Specular
FBPropertyAnimatableColor Specular
Read Write Property: Specular color.
Definition: fbmaterial.h:118
FBMaterial::EmissiveFactor
FBPropertyAnimatableDouble EmissiveFactor
Read Write Property: Emissive Factor value.
Definition: fbmaterial.h:106
FBMaterial::Emissive
FBPropertyAnimatableColor Emissive
Read Write Property: Emissive color.
Definition: fbmaterial.h:105
__FBClassDeclare
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
FBPropertyAnimatableDouble
class K_DLLIMPORT FBPropertyBaseAnimatable< double, kFBPT_double > FBPropertyAnimatableDouble
FBPropertyBaseAnimatableDouble type definition.
Definition: fbproperties.h:1752
FBMaterial::SpecularFactor
FBPropertyAnimatableDouble SpecularFactor
Read Write Property: Specular Factor value.
Definition: fbmaterial.h:119
FBProperty
Property: Base property class.
Definition: fbproperties.h:195
__FB_FORWARD
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
FBMaterial::CreateTextureConnectableUserProperty
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.
FBPropertyListMaterial
PropertyList: Material
Definition: fbmaterial.h:180
FBMaterial::TransparentColor
FBPropertyAnimatableColor TransparentColor
Read Write Property: Transparent color.
Definition: fbmaterial.h:111
FBMaterial::Ambient
FBPropertyAnimatableColor Ambient
Read Write Property: Ambient color.
Definition: fbmaterial.h:102
fbcomponent.h
Basic class definitions.
FBPropertyType
FBPropertyType
Property types.
Definition: fbproperties.h:80
FBMaterial
Material class.
Definition: fbmaterial.h:87
FBPropertyListMaterial::operator[]
FBMaterial * operator[](int pIndex)
Get the material at a specific index.
FBPropertyListComponent
PropertyList: Concrete class for PropertyList of component
Definition: fbcomponent.h:536
fbcore.h
Contains definitions for devices, boxes and models.
FB_DEFINE_COMPONENT
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
FBTexture
Definition: fbtexture.h:116
FBFbxObject
FBX file interface.
Definition: fbfbx.h:80
FBMaterial::FbxGetObjectSubType
virtual const char * FbxGetObjectSubType() override
Returns the class sub type inherited by the class of an object, for example: 'Default',...
FBMaterial::SetTexture
void SetTexture(FBTexture *pTexture, FBMaterialTextureType pType=kFBMaterialTextureDiffuse)
Set associated texture.
FBMaterial::DiffuseFactor
FBPropertyAnimatableDouble DiffuseFactor
Read Write Property: Diffuse Factor value.
Definition: fbmaterial.h:109
FBMaterial::FbxGetObjectType
virtual const char * FbxGetObjectType() override
Returns the class type inherited by the class of an object, for example: 'Material'.