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
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 */
A box is a fundamental building block in the application architecture.
Definition: fbcore.h:218
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
LayeredTexture class.
Definition: fbtexture.h:189
virtual void FBDelete() override
Open Reality deletion function.
void SetLayerConfigDirty()
Set layer config dirty to trigger new composition.
FBLayeredTexture * Clone()
Clone the current texture.
FBPropertyListTexture Layers
Read/Write Property: Textures Layers.
Definition: fbtexture.h:220
virtual void TextureLayerComposition(FBTime pTime, FBTime pTimeInCurrentTimeRef, int pWidth, int pHeight)
Virtual function to be override if custom layer blend method needed.
FBPropertyAnimatableColorAndAlpha BackgroundColor
Read/Write Property: Animatable Background color which is used to clear color buffer before compositi...
Definition: fbtexture.h:219
FBLayeredTexture(const char *pName, HIObject pObject=NULL)
Constructor.
PropertyList: Concrete class for PropertyList of component
Definition: fbcomponent.h:536
PropertyList: Texture
Definition: fbtexture.h:159
FBTexture * operator[](int pIndex)
Get the texture at a specific index.
virtual int Add(FBTexture *pItem)
Add a texture to the property list.
FBPropertyAnimatableVector3d Scaling
Read Write Property: Scaling coordinates.
Definition: fbtexture.h:139
FBPropertyAnimatableDouble Alpha
Read Write Property: Texture alpha value.
Definition: fbtexture.h:140
FBPropertyInt Height
Read Only Property: Height of texture.
Definition: fbtexture.h:133
virtual void FBDelete() override
Open Reality deletion function.
FBPropertyTextureMapping Mapping
Read Write Property: Texture mapping.
Definition: fbtexture.h:135
FBPropertyInt TextureOGLId
Read Only: OpenGL texture buffer object Id.
Definition: fbtexture.h:146
FBPropertyBool TakeBased
Read Write Property: A video is linked to a take, changing the take will change the connected video.
Definition: fbtexture.h:145
FBPropertyVideo Video
Read Write Property: Media used for texturing.
Definition: fbtexture.h:144
FBPropertyAnimatableVector3d Translation
Read Write Property: Translation coordinates.
Definition: fbtexture.h:137
FBPropertyTextureUseType UseType
Read Write Property: Texture Use Type.
Definition: fbtexture.h:134
FBPropertyTextureBlendMode BlendMode
Read Write Property: Texture blend mode.
Definition: fbtexture.h:136
FBTexture(const char *pName, HIObject pObject=NULL)
Constructor.
FBPropertyAnimatableVector3d Rotation
Read Write Property: Rotation coordinates.
Definition: fbtexture.h:138
FBTexture * Clone()
Clone the texture.
FBPropertyInt Width
Read Only Property: Width of texture.
Definition: fbtexture.h:132
FBPropertyBool SwapUV
Read Write Property: Swap UV coordinates?
Definition: fbtexture.h:141
Time data structure.
Definition: fbtime.h:88
Basic class definitions.
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Contains definitions for devices, boxes and models.
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
Property classes.
class K_DLLIMPORT FBPropertyBaseAnimatable< FBVector3d, kFBPT_Vector3D > FBPropertyAnimatableVector3d
FBPropertyAnimatableVector3D type definition.
class K_DLLIMPORT FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
class K_DLLIMPORT FBPropertyBaseAnimatable< double, kFBPT_double > FBPropertyAnimatableDouble
FBPropertyBaseAnimatableDouble type definition.
class K_DLLIMPORT FBPropertyBaseAnimatable< FBColorAndAlpha, kFBPT_ColorRGBA > FBPropertyAnimatableColorAndAlpha
FBPropertyAnimatableColorAndAlpha type definition.
class K_DLLIMPORT FBPropertyBase< bool, kFBPT_bool > FBPropertyBool
Property: bool
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:150
#define FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:62
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
FBVideo and derivative classes.