Open Reality Reference Guide
fbtexture.h
1 #ifndef __FBTEXTURE_H__
2 #define __FBTEXTURE_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/fbcomponent.h>
52 #include <fbsdk/fbcore.h>
53 #include <fbsdk/fbproperties.h>
54 #include <fbsdk/fbvideo.h>
55 
56 #ifdef FBSDKUseNamespace
57 namespace FBSDKNamespace {
58 #endif
59 
60 
62 // FBTexture
65 
70 enum FBTextureUseType {
71  kFBTextureUseAll,
72  kFBTextureUseColor,
73  kFBTextureUseShadowMap,
74  kFBTextureUseLightMap,
75  kFBTextureUseSphericalReflexionMap,
76  kFBTextureUseSphereReflexionMap,
77  kFBTextureUseBumpNormalMap
78 };
79 
83 enum FBTextureMapping {
84  kFBTextureNoMapping,
85  kFBTextureMappingUV,
86  kFBTextureMappingXY,
87  kFBTextureMappingYZ,
88  kFBTextureMappingXZ,
89  kFBTextureMappingSpherical,
90  kFBTextureMappingCylindrical,
91  kFBTextureMappingEnvironment,
92  kFBTextureMappingProjection
93 };
94 
98 enum FBTextureBlendMode {
99  kFBTextureBlendTranslucent,
100  kFBTextureBlendAdditive,
101  kFBTextureBlendModulate,
102  kFBTextureBlendModulate2,
103 };
104 
105 FB_DEFINE_ENUM( FBSDK_DLL, TextureUseType );
106 FB_DEFINE_ENUM( FBSDK_DLL, TextureMapping );
107 FB_DEFINE_ENUM( FBSDK_DLL, TextureBlendMode );
108 
110 // This class is used to encapsulate an underlying media that is used to texture a model.
111 //
113 
114 FB_DEFINE_COMPONENT( FBSDK_DLL, Texture );
115 
116 class FBSDK_DLL FBTexture : public FBBox {
118 public:
123  FBTexture(const char* pName, HIObject pObject=NULL);
124  virtual void FBDelete() override;
125 
131 
134  FBPropertyTextureUseType UseType;
135  FBPropertyTextureMapping Mapping;
136  FBPropertyTextureBlendMode BlendMode;
142  FBPropertyInt CroppingX[2];
143  FBPropertyInt CroppingY[2];
144  FBPropertyVideo Video;
147 
148  void OGLInit(FBRenderOptions* pRenderOptions = NULL);
149  unsigned int GetTextureObject();
150  double* GetMatrix();
151 };
152 
154 // FBPropertyListTexture
157 
159 {
160 public:
168  virtual int Add( FBTexture* pItem );
173  FBTexture* operator[](int pIndex);
174 
175 private:
176  inline virtual int Add ( FBComponent* pItem ) { return Add((FBTexture*)pItem); }
177 };
178 
180 // FBLayeredTexture
183 
191 public:
196  FBLayeredTexture(const char* pName, HIObject pObject=NULL);
197  virtual void FBDelete() override;
198 
204 
214  virtual void TextureLayerComposition(FBTime pTime,FBTime pTimeInCurrentTimeRef, int pWidth, int pHeight);
215 
218 
221 };
222 
225 #define FBStorableCustomTextureImplementation(ClassName, Type)\
226  const char* ClassName::FbxGetObjectSubType(){ return #ClassName; }\
227  HIObject RegisterStorable##ClassName##Create(HIObject /*pOwner*/, const char* pName, void* /*pData*/){\
228  ClassName* Class = new ClassName(pName);\
229  Class->mAllocated = true;\
230  if( Class->FBCreate() ){\
231  return Class->GetHIObject();\
232  } else {\
233  delete Class;\
234  return NULL;}}\
235  FBLibraryModule(ClassName##Storable){\
236  FBString lGroup = "FbxStorable/";\
237  lGroup += #Type;\
238  FBRegisterObject(ClassName##R2, lGroup, #ClassName, "", RegisterStorable##ClassName##Create, true, NULL);\
239  FBSetStoreableCustomTextureRegistered();}\
240 
241 
242 #ifdef FBSDKUseNamespace
243 }
244 #endif
245 
246 #endif /* this must be the last line of this file */
FBTexture::TakeBased
FBPropertyBool TakeBased
Read Write Property: A video is linked to a take, changing the take will change the connected video.
Definition: fbtexture.h:145
FBLayeredTexture::BackgroundColor
FBPropertyAnimatableColorAndAlpha BackgroundColor
Read/Write Property: Animatable Background color which is used to clear color buffer before compositi...
Definition: fbtexture.h:219
FBTexture::Mapping
FBPropertyTextureMapping Mapping
Read Write Property: Texture mapping.
Definition: fbtexture.h:135
FB_DEFINE_ENUM
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:150
FBPropertyInt
class K_DLLIMPORT FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
Definition: fbproperties.h:1331
FBTexture::FBTexture
FBTexture(const char *pName, HIObject pObject=NULL)
Constructor.
FBBox
A box is a fundamental building block in the application architecture.
Definition: fbcore.h:218
FBSDK_DLL
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbconstraintlayout.h:48
FBPropertyListTexture
PropertyList: Texture
Definition: fbtexture.h:159
FBTexture::Rotation
FBPropertyAnimatableVector3d Rotation
Read Write Property: Rotation coordinates.
Definition: fbtexture.h:138
FBPropertyListTexture::operator[]
FBTexture * operator[](int pIndex)
Get the texture at a specific index.
FBLayeredTexture
LayeredTexture class.
Definition: fbtexture.h:189
FBTexture::Height
FBPropertyInt Height
Read Only Property: Height of texture.
Definition: fbtexture.h:133
FBTime
Time data structure.
Definition: fbtime.h:88
fbvideo.h
FBVideo and derivative classes.
fbproperties.h
Property classes.
FBPropertyAnimatableVector3d
class K_DLLIMPORT FBPropertyBaseAnimatable< FBVector3d, kFBPT_Vector3D > FBPropertyAnimatableVector3d
FBPropertyAnimatableVector3D type definition.
Definition: fbproperties.h:1768
FBTexture::Alpha
FBPropertyAnimatableDouble Alpha
Read Write Property: Texture alpha value.
Definition: fbtexture.h:140
FBLayeredTexture::Clone
FBLayeredTexture * Clone()
Clone the current texture.
__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
__FB_FORWARD
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
FBLayeredTexture::Layers
FBPropertyListTexture Layers
Read/Write Property: Textures Layers.
Definition: fbtexture.h:220
FBPropertyListTexture::Add
virtual int Add(FBTexture *pItem)
Add a texture to the property list.
FBTexture::FBDelete
virtual void FBDelete() override
Open Reality deletion function.
FBTexture::Translation
FBPropertyAnimatableVector3d Translation
Read Write Property: Translation coordinates.
Definition: fbtexture.h:137
FBTexture::Clone
FBTexture * Clone()
Clone the texture.
FBTexture::TextureOGLId
FBPropertyInt TextureOGLId
Read Only: OpenGL texture buffer object Id.
Definition: fbtexture.h:146
FBTexture::BlendMode
FBPropertyTextureBlendMode BlendMode
Read Write Property: Texture blend mode.
Definition: fbtexture.h:136
FBRenderOptions
Definition: fbshader.h:345
FBPropertyBool
class K_DLLIMPORT FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
Definition: fbproperties.h:1308
fbcomponent.h
Basic class definitions.
FBLayeredTexture::TextureLayerComposition
virtual void TextureLayerComposition(FBTime pTime, FBTime pTimeInCurrentTimeRef, int pWidth, int pHeight)
Virtual function to be override if custom layer blend method needed.
FBTexture::Width
FBPropertyInt Width
Read Only Property: Width of texture.
Definition: fbtexture.h:132
FBTexture::Scaling
FBPropertyAnimatableVector3d Scaling
Read Write Property: Scaling coordinates.
Definition: fbtexture.h:139
FBPropertyListComponent
PropertyList: Concrete class for PropertyList of component
Definition: fbcomponent.h:536
fbcore.h
Contains definitions for devices, boxes and models.
FBTexture::UseType
FBPropertyTextureUseType UseType
Read Write Property: Texture Use Type.
Definition: fbtexture.h:134
FBTexture::SwapUV
FBPropertyBool SwapUV
Read Write Property: Swap UV coordinates?
Definition: fbtexture.h:141
FB_FORWARD
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
FB_DEFINE_COMPONENT
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
FBTexture::Video
FBPropertyVideo Video
Read Write Property: Media used for texturing.
Definition: fbtexture.h:144
FBLayeredTexture::FBDelete
virtual void FBDelete() override
Open Reality deletion function.
FBTexture
Definition: fbtexture.h:116
FBPropertyAnimatableColorAndAlpha
class K_DLLIMPORT FBPropertyBaseAnimatable< FBColorAndAlpha, kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha
FBPropertyAnimatableColorAndAlpha type definition.
Definition: fbproperties.h:1780
FBComponent
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
FBLayeredTexture::FBLayeredTexture
FBLayeredTexture(const char *pName, HIObject pObject=NULL)
Constructor.
FBLayeredTexture::SetLayerConfigDirty
void SetLayerConfigDirty()
Set layer config dirty to trigger new composition.