customMaterialDefinition.h
Engine/source/materials/customMaterialDefinition.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23#ifndef _CUSTOMMATERIALDEFINITION_H_ 24#define _CUSTOMMATERIALDEFINITION_H_ 25 26#ifndef _MATERIALDEFINITION_H_ 27#include "materials/materialDefinition.h" 28#endif 29 30class ShaderData; 31class GFXStateBlockData; 32 33//************************************************************************** 34// Custom Material 35//************************************************************************** 36class CustomMaterial : public Material 37{ 38 typedef Material Parent; 39public: 40 enum CustomConsts 41 { 42 MAX_PASSES = 8, 43 NUM_FALLBACK_VERSIONS = 2, 44 }; 45 46 FileName mTexFilename[MAX_TEX_PER_PASS]; 47 String mSamplerNames[MAX_TEX_PER_PASS]; 48 String mOutputTarget; 49 Material* mFallback; 50 bool mForwardLit; 51 52 F32 mVersion; // 0 = legacy, 1 = DX 8.1, 2 = DX 9.0 53 bool mRefract; 54 ShaderData* mShaderData; 55 56 CustomMaterial(); 57 const GFXStateBlockData* getStateBlockData() const; 58 59 // 60 // SimObject interface 61 // 62 virtual bool onAdd(); 63 virtual void onRemove(); 64 65 // 66 // ConsoleObject interface 67 // 68 static void initPersistFields(); 69 DECLARE_CONOBJECT(CustomMaterial); 70protected: 71 U32 mMaxTex; 72 String mShaderDataName; 73 U32 mFlags[MAX_TEX_PER_PASS]; 74 GFXStateBlockData* mStateBlockData; 75 76 virtual void _mapMaterial(); 77}; 78 79#endif 80