1/****************************************************************************************
2
3 Copyright (C) 2015 Autodesk, Inc.
4 All rights reserved.
5
6 Use of this software is subject to the terms of the Autodesk license agreement
7 provided at the time of installation or download, or which otherwise accompanies
8 this software in either electronic or hard copy form.
9
10****************************************************************************************/
11
12//! \file fbxlayeredtexture.h
13#ifndef _FBXSDK_SCENE_SHADING_LAYERED_TEXTURE_H_
14#define _FBXSDK_SCENE_SHADING_LAYERED_TEXTURE_H_
15
16#include <fbxsdk/fbxsdk_def.h>
17
18#include <fbxsdk/scene/shading/fbxtexture.h>
19
20#include <fbxsdk/fbxsdk_nsbegin.h>
21
22/** FbxLayeredTexture is a combination of multiple textures(FbxTexture) blended sequentially.
23 * For example, you can access individual texture by:
24 * \code
25 * FbxTexture* pIndiTexture = lLayeredTexture->GetSrcObject(FbxTexture::ClassId, pTextureIndex);
26 * \endcode
27 * Another example to construct a layered texture with two sub textures.
28 * \code
29 * FbxFileTexture *background, *file1;
30 * FbxLayeredTexture* layeredTexture;
31 *
32 * // connect two file textures to a layered texture via OO connections
33 * layeredTexture->ConnectSrcObject(background);
34 * layeredTexture->ConnectSrcObject(file1);
35 *
36 * // set the second file texture's blend mode and alpha.
37 * layeredTexture->SetTextureBlendMode(1, FbxLayeredTexture::eOver);
38 * layeredTexture->SetTextureAlpha(1, 0.5);
39 * \endcode
40 * \nosubgrouping
41 * \see FbxTexture
42 */
43class FBXSDK_DLL FbxLayeredTexture : public FbxTexture
44{
45 FBXSDK_OBJECT_DECLARE(FbxLayeredTexture, FbxTexture);
46
47public:
48 /** \enum EBlendMode Blend modes.
49 * - \e eTranslucent, The new texture layer is transparent (depending on the Alpha value).
50 * - \e eAdditive, Add the color of the new texture to the previous texture.
51 * - \e eModulate, Multiples the color value of the new texture by the color values of all previous layers of texture.
52 * - \e eModulate2, Multiples the color value of the new texture by two and then by the color values of all previous layers of texture.
53 * - \e eOver, Equivalent to eTranslucent. Blends the new texture over top of the old texture, according to the new texture's alpha channel.
54 * - \e eNormal, The colors of the two layers will not interact in any way, and it will display the full value of the colors in layer 1.
55 * - \e eDissolve, Dissolve makes the lower layer take on the colors of the top layer, and how much depends on the opacity of the upper layer.
56 * - \e eDarken, Darken compares each pixel value of the upper layer to its counterpart's pixel value of the lower layer and chooses the darker of the two to display.
57 * - \e eColorBurn, Color Burn burns in the color of the upper layer with the lower layer. No part of the image will get lighter.
58 * - \e eLinearBurn, Linear Burn works like multiply but the results are more intense.
59 * - \e eDarkerColor, This blend mode simply divides pixel values of one layer with the other.
60 * - \e eLighten, Lighten compares the two layers pixel for pixel and uses the lightest pixel value. No part of the image gets darker.
61 * - \e eScreen, Screen brightens by lightning the lower layer based on the lightness of the upper layer
62 * - \e eColorDodge, Color Dodge dodges the lower layer with the upper layer, resulting in a lighter image. No part of the image will be darkened.
63 * - \e eLinearDodge, Linear Dodge works like screen but with more intense results.
64 * - \e eLighterColor, This blend mode has the opposite effect of the Darker Color mode. It compares all the values in both layers, then displays the lightest values.
65 * - \e eSoftLight, Soft Light will multiply the dark tones and screen the light tones.
66 * - \e eHardLight, Hard Light multiplies the dark colors and screens the light colors.
67 * - \e eVividLight, Vivid Light will dodges or burn the lower layer pixels depending on whether the upper layer pixels are brighter or darker than neutral gray. It works on the contrast of the lower layer.
68 * - \e eLinearLight, Linear Light is the same as Vivid light but it works on the brightness of the lower layer.
69 * - \e ePinLight, Pin Light changes the lower layer pixels depending on how bright the pixels are in the upper layer.
70 * - \e eHardMix, Produces either white or black, depending on similarities between A and B.
71 * - \e eDifference, Difference reacts to the differences between the upper and lower layer pixels.
72 * - \e eExclusion, Exclusion uses the darkness of the lower layer to mask the difference between upper and lower layers.
73 * - \e eSubtract, The result color is the foreground color subtracted from the background color. The result color is then applied over the background color using the foreground alpha to define the opacity of the result.
74 * - \e eDivide, This blend mode simply divides pixel values of one layer with the other.
75 * - \e eHue, Hue changes the hue of the lower layer to the hue of the upper layer but leaves brightness and saturation alone.
76 * - \e eSaturation, Saturation changes the saturation of the lower layer to the hue of the upper layer but leaves brightness and hue alone.
77 * - \e eColor, Color changes the hue and saturation of the lower layer to the hue and saturation of the upper layer but leaves luminosity alone.
78 * - \e eLuminosity, Luminosity changes the luminosity of the lower layer to the luminosity of the upper layer while leaving hue and saturation the same.
79 * - \e eOverlay, Multiplies (darkens) when the layer on which the mode is set is dark and screens (brightens) when the layer on which the mode is applied is lighter.
80 * - \e eBlendModeCount, Marks the end of the blend mode enum.
81 */
82 enum EBlendMode
83 {
84 eTranslucent,
85 eAdditive,
86 eModulate,
87 eModulate2,
88 eOver,
89 eNormal,
90 eDissolve,
91 eDarken,
92 eColorBurn,
93 eLinearBurn,
94 eDarkerColor,
95 eLighten,
96 eScreen,
97 eColorDodge,
98 eLinearDodge,
99 eLighterColor,
100 eSoftLight,
101 eHardLight,
102 eVividLight,
103 eLinearLight,
104 ePinLight,
105 eHardMix,
106 eDifference,
107 eExclusion,
108 eSubtract,
109 eDivide,
110 eHue,
111 eSaturation,
112 eColor,
113 eLuminosity,
114 eOverlay,
115 eBlendModeCount
116 };
117
118 /** Equivalence operator.
119 * \param pOther The object for comparison.
120 * \return \c True if pOther is equivalent to this object, returns \c false otherwise.
121 */
122 bool operator==( const FbxLayeredTexture& pOther ) const;
123
124 /** Sets the blending mode of a specified texture.
125 * \param pIndex The texture index.
126 * \param pMode The blend mode to be set.
127 * \return \c True if successful, returns \c false otherwise.
128 */
129 bool SetTextureBlendMode( int pIndex, EBlendMode pMode );
130
131 /** Returns the blending mode of a specified texture
132 * \param pIndex The texture index.
133 * \param pMode The parameter that will hold the returned blend mode.
134 * \return \c True if successful, returns \c false otherwise.
135 */
136 bool GetTextureBlendMode( int pIndex, EBlendMode& pMode ) const;
137
138 /** Sets the alpha of a specified texture.
139 * \param pIndex The texture index.
140 * \param pAlpha The alpha to be set.
141 * \return \c True if successful, returns \c false otherwise.
142 */
143 bool SetTextureAlpha( int pIndex, double pAlpha );
144
145 /** Returns the alpha of a specified texture
146 * \param pIndex The texture index.
147 * \param pAlpha The parameter that will hold the returned alpha.
148 * \return \c True if successful, returns \c false otherwise.
149 */
150 bool GetTextureAlpha( int pIndex, double& pAlpha ) const;
151
152/*****************************************************************************************************************************
153** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
154*****************************************************************************************************************************/
155#ifndef DOXYGEN_SHOULD_SKIP_THIS
156 virtual FbxObject& Copy(const FbxObject& pObject);
157
158protected:
159 struct InputData
160 {
161 EBlendMode mBlendMode;
162 double mAlpha;
163 };
164
165public:
166 FbxArray<InputData> mInputData;
167
168protected:
169 virtual bool ConnectNotify (FbxConnectEvent const &pEvent);
170
171 bool RemoveInputData( int pIndex );
172#endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
173};
174
175inline EFbxType FbxTypeOf(const FbxLayeredTexture::EBlendMode&){ return eFbxEnum; }
176
177#include <fbxsdk/fbxsdk_nsend.h>
178
179#endif /* _FBXSDK_SCENE_SHADING_LAYERED_TEXTURE_H_ */
180