| 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 fbximplementation.h |
| 13 | #ifndef _FBXSDK_SCENE_SHADING_IMPLEMENTATION_H_ |
| 14 | #define _FBXSDK_SCENE_SHADING_IMPLEMENTATION_H_ |
| 15 | |
| 16 | #include <fbxsdk/fbxsdk_def.h> |
| 17 | |
| 18 | #include <fbxsdk/core/fbxobject.h> |
| 19 | |
| 20 | #include <fbxsdk/fbxsdk_nsbegin.h> |
| 21 | |
| 22 | class FbxBindingOperator; |
| 23 | class FbxBindingTable; |
| 24 | |
| 25 | /** This object represents the shading node implementation. |
| 26 | * It defines basic information about the shader and the binding table(FbxBindingTable). |
| 27 | * For example, you can create a new FbxImplementation like this: |
| 28 | * \code |
| 29 | * FbxImplementation* lImpl = FbxImplementation::Create( &pMyScene, "MyImplementation" ); |
| 30 | * pMyObject.AddImplementation( lImpl ); |
| 31 | * pMyObject.SetDefaultImplementation( lImpl ); |
| 32 | * lImpl->RenderAPI = FBXSDK_RENDERING_API_DIRECTX; //FBXSDK_RENDERING_API_DIRECTX, FBXSDK_RENDERING_API_OPENGL, FBXSDK_RENDERING_API_MENTALRAY or FBXSDK_RENDERING_API_PREVIEW |
| 33 | * lImpl->RenderAPIVersion = "9.0"; //API Version |
| 34 | * |
| 35 | * lImpl->Language = FBXSDK_SHADING_LANGUAGE_HLSL; //FBXSDK_SHADING_LANGUAGE_HLSL, FBXSDK_SHADING_LANGUAGE_GLSL, FBXSDK_SHADING_LANGUAGE_CGFX or FBXSDK_SHADING_LANGUAGE_MRSL |
| 36 | * lImpl->LanguageVersion = "1.0"; //Language Version |
| 37 | * \endcode |
| 38 | * |
| 39 | * After the new FbxImplementation is created, you can access FbxBindingTable like this: |
| 40 | * \code |
| 41 | * FbxBindingTable* lTable = lImpl->GetTableByTargetName("root"); |
| 42 | * \endcode |
| 43 | * Also, you can access the exist FbxImplementation in FbxObject by this: |
| 44 | * \code |
| 45 | * const FbxImplementation* lImpl = GetImplementation( pMyObject, FBXSDK_IMPLEMENTATION_CGFX ); // FBXSDK_IMPLEMENTATION_PREVIEW, FBXSDK_IMPLEMENTATION_MENTALRAY, FBXSDK_IMPLEMENTATION_CGFX, FBXSDK_IMPLEMENTATION_HLSL, FBXSDK_IMPLEMENTATION_OGS or FBXSDK_IMPLEMENTATION_NONE |
| 46 | * \endcode |
| 47 | * \nosubgrouping |
| 48 | * \see FbxImplementationFilter |
| 49 | */ |
| 50 | class FBXSDK_DLL FbxImplementation : public FbxObject |
| 51 | { |
| 52 | FBXSDK_OBJECT_DECLARE(FbxImplementation, FbxObject); |
| 53 | |
| 54 | public: |
| 55 | /** |
| 56 | * \name Target Name. |
| 57 | */ |
| 58 | //@{ |
| 59 | FbxString RenderName; |
| 60 | //@} |
| 61 | |
| 62 | /** |
| 63 | * \name Shader Language and API descriptions. |
| 64 | */ |
| 65 | //@{ |
| 66 | |
| 67 | /** Shader Language. |
| 68 | * \see FBXSDK_SHADING_LANGUAGE_HLSL, FBXSDK_SHADING_LANGUAGE_GLSL, FBXSDK_SHADING_LANGUAGE_CGFX and FBXSDK_SHADING_LANGUAGE_MRSL in conventions.h |
| 69 | */ |
| 70 | FbxPropertyT<FbxString> Language; |
| 71 | |
| 72 | //! Shader Language version. |
| 73 | FbxPropertyT<FbxString> LanguageVersion; |
| 74 | |
| 75 | /** Render API. |
| 76 | * \see FBXSDK_SHADING_LANGUAGE_HLSL, FBXSDK_SHADING_LANGUAGE_GLSL, FBXSDK_SHADING_LANGUAGE_CGFX and FBXSDK_SHADING_LANGUAGE_MRSL in conventions.h |
| 77 | */ |
| 78 | FbxPropertyT<FbxString> RenderAPI; |
| 79 | |
| 80 | //! Render API version. |
| 81 | FbxPropertyT<FbxString> RenderAPIVersion; |
| 82 | //@} |
| 83 | |
| 84 | |
| 85 | /** |
| 86 | * \name Binding description |
| 87 | */ |
| 88 | //@{ |
| 89 | |
| 90 | //! Name of root binding table. |
| 91 | FbxPropertyT<FbxString> RootBindingName; |
| 92 | |
| 93 | //! Property to store the shader parameters(constants) values in this implementation. |
| 94 | FbxProperty GetConstants() const; |
| 95 | |
| 96 | /** Add a new binding table to the table list. |
| 97 | * \param pTargetName The target name for the binding table. |
| 98 | * \param pTargetType The target type for the binding table. |
| 99 | * \return the new binding table. |
| 100 | */ |
| 101 | FbxBindingTable* AddNewTable( const char* pTargetName, const char* pTargetType ); |
| 102 | |
| 103 | /** Retrieves a handle on the root binding table. |
| 104 | * \return A const pointer to the root table or NULL if it does not exist. |
| 105 | */ |
| 106 | const FbxBindingTable* GetRootTable() const; |
| 107 | |
| 108 | /** Retrieves a handle on the root binding table. |
| 109 | * \return A pointer to the root table or NULL if it does not exist. |
| 110 | */ |
| 111 | FbxBindingTable* GetRootTable(); |
| 112 | |
| 113 | /** Gets the number of binding tables. |
| 114 | * \return the number of binding tables. |
| 115 | */ |
| 116 | int GetTableCount() const; |
| 117 | |
| 118 | /** Retrieves a handle on the (pIndex)th binding table. |
| 119 | * \param pIndex The index of the table to retrieve. Valid values are [ 0, GetTableCount() ). |
| 120 | * \return A const pointer to the pIndex-th table or NULL if pIndex is out of range. |
| 121 | */ |
| 122 | const FbxBindingTable* GetTable( int pIndex ) const; |
| 123 | /** Retrieves a handle on the (pIndex)th binding table. |
| 124 | * \param pIndex The index of the table to retrieve. Valid values are [ 0, GetTableCount() ). |
| 125 | * \return A const pointer to the pIndex-th table or NULL if pIndex is out of range. |
| 126 | */ |
| 127 | FbxBindingTable* GetTable( int pIndex ); |
| 128 | |
| 129 | /** Returns the binding table that has the given target name. |
| 130 | * \param pName The target name of the table to look for. |
| 131 | * \return A const pointer to the binding table with the given target name, or NULL if there is no such binding table. |
| 132 | */ |
| 133 | const FbxBindingTable* GetTableByTargetName( const char* pName ) const; |
| 134 | |
| 135 | /** Returns the binding table that has the given target name. |
| 136 | * \param pName The target name of the table to look for. |
| 137 | * \return A pointer to the binding table with the given target name, or NULL if there is no such binding table. |
| 138 | */ |
| 139 | FbxBindingTable* GetTableByTargetName( const char* pName ); |
| 140 | |
| 141 | /** Returns the binding table that has the given target type. |
| 142 | * \param pTargetName The target type to look for. |
| 143 | * \return A const pointer to the binding table with the given target type, or NULL if there is no such binding table. |
| 144 | */ |
| 145 | const FbxBindingTable* GetTableByTargetType( const char* pTargetName ) const; |
| 146 | |
| 147 | /** Returns the binding table that has the given target type. |
| 148 | * \param pTargetName The target type to look for. |
| 149 | * \return A pointer to the binding table with the given target type, or NULL if there is no such binding table. |
| 150 | */ |
| 151 | FbxBindingTable* GetTableByTargetType( const char* pTargetName ); |
| 152 | |
| 153 | |
| 154 | /** Add a new binding operator to the operator list. |
| 155 | * \param pTargetName The target name for the binding operator. |
| 156 | * \param pFunctionName The function name for the binding operator. |
| 157 | * \return The new operator. |
| 158 | */ |
| 159 | FbxBindingOperator* AddNewBindingOperator( const char* pTargetName, const char* pFunctionName ); |
| 160 | |
| 161 | /** Gets the number of binding operators. |
| 162 | * \return the number of binding operators. |
| 163 | */ |
| 164 | int GetBindingOperatorCount() const; |
| 165 | |
| 166 | /** Returns the binding operator that has the given name. |
| 167 | * \param pTargetName The target name of the binding operator to look for. |
| 168 | * \return A const pointer to the binding operator with the given name, or NULL if there is no such binding table. |
| 169 | */ |
| 170 | const FbxBindingOperator* GetOperatorByTargetName( const char* pTargetName ) const; |
| 171 | //@} |
| 172 | |
| 173 | |
| 174 | /** |
| 175 | * \name Static values |
| 176 | */ |
| 177 | //@{ |
| 178 | |
| 179 | // property names |
| 180 | |
| 181 | /** Shader Language name. |
| 182 | * \see Language |
| 183 | */ |
| 184 | static const char* sLanguage; |
| 185 | |
| 186 | /** Shader Language version. |
| 187 | * \see LanguageVersion |
| 188 | */ |
| 189 | static const char* sLanguageVersion; |
| 190 | |
| 191 | /** Shader render API. |
| 192 | * \see RenderAPI |
| 193 | */ |
| 194 | static const char* sRenderAPI; |
| 195 | |
| 196 | /** Shader render API version. |
| 197 | * \see RenderAPIVersion |
| 198 | */ |
| 199 | static const char* sRenderAPIVersion; |
| 200 | |
| 201 | /** Name of root binding table. |
| 202 | * \see RootBindingName |
| 203 | */ |
| 204 | static const char* sRootBindingName; |
| 205 | |
| 206 | /** Name of property to store the shader parameters(constants) values in this implementation. |
| 207 | * \see GetConstants |
| 208 | */ |
| 209 | static const char* sConstants; |
| 210 | |
| 211 | //! default value for implementation type. |
| 212 | static const char* sDefaultType; |
| 213 | |
| 214 | //! default value for shader language. |
| 215 | static const char* sDefaultLanguage; |
| 216 | |
| 217 | //! default value for shader language version. |
| 218 | static const char* sDefaultLanguageVersion; |
| 219 | |
| 220 | //! default value for shader render API. |
| 221 | static const char* sDefaultRenderAPI; |
| 222 | |
| 223 | //! default value for shader render API version. |
| 224 | static const char* sDefaultRenderAPIVersion; |
| 225 | |
| 226 | //! default value for root binding table name. |
| 227 | static const char* sDefaultRootBindingName; |
| 228 | //@} |
| 229 | |
| 230 | /***************************************************************************************************************************** |
| 231 | ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! ** |
| 232 | *****************************************************************************************************************************/ |
| 233 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 234 | protected: |
| 235 | virtual void ConstructProperties(bool pForceSet); |
| 236 | #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/ |
| 237 | }; |
| 238 | |
| 239 | #include <fbxsdk/fbxsdk_nsend.h> |
| 240 | |
| 241 | #endif /* _FBXSDK_SCENE_SHADING_IMPLEMENTATION_H_ */ |
| 242 | |