customShaderFeature.h
Engine/source/shaderGen/customShaderFeature.h
Classes:
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 CUSTOMSHADERFEATURE_H 24#define CUSTOMSHADERFEATURE_H 25 26#ifndef _SIMOBJECT_H_ 27#include "console/simObject.h" 28#endif 29 30#ifdef TORQUE_D3D11 31class CustomFeatureHLSL; 32#endif 33#ifdef TORQUE_OPENGL 34class CustomFeatureGLSL; 35#endif 36 37class CustomShaderFeatureData : public SimObject 38{ 39 typedef SimObject Parent; 40 41public: 42#ifdef TORQUE_D3D11 43 CustomFeatureHLSL* mFeatureHLSL; 44#endif 45#ifdef TORQUE_OPENGL 46 CustomFeatureGLSL* mFeatureGLSL; 47#endif 48 49 Vector<StringTableEntry> mAddedShaderConstants; 50 51public: 52 CustomShaderFeatureData(); 53 virtual ~CustomShaderFeatureData(); 54 55 // Declare this object as a ConsoleObject so that we can 56 // instantiate it into the world and network it 57 DECLARE_CONOBJECT(CustomShaderFeatureData); 58 59 //-------------------------------------------------------------------------- 60 // Object Editing 61 // Since there is always a server and a client object in Torque and we 62 // actually edit the server object we need to implement some basic 63 // networking functions 64 //-------------------------------------------------------------------------- 65 // Set up any fields that we want to be editable (like position) 66 static void initPersistFields(); 67 68 // Handle when we are added to the scene and removed from the scene 69 bool onAdd(); 70 void onRemove(); 71 72 //shadergen setup 73 void addVariable(String name, String type, String defaultValue); 74 void addUniform(String name, String type, String defaultValue, U32 arraySize); 75 void addSampler(String name, String type, U32 arraySize); 76 void addTexture(String name, String type, String samplerState, U32 arraySize); 77 void addConnector(String name, String type, String elementName); 78 void addVertTexCoord(String name); 79 bool hasFeature(String name); 80 81 void writeLine(String format, S32 argc, ConsoleValueRef *argv); 82}; 83 84#endif 85