customFeatureGLSL.h
Engine/source/shaderGen/GLSL/customFeatureGLSL.h
Classes:
Detailed Description
1 2#ifndef _SHADERGEN_GLSL_SHADERFEATUREGLSL_H_ 3#include "shaderGen/GLSL/shaderFeatureGLSL.h" 4#endif 5#ifndef _LANG_ELEMENT_H_ 6#include "shaderGen/langElement.h" 7#endif 8#ifndef _GFXDEVICE_H_ 9#include "gfx/gfxDevice.h" 10#endif 11#ifndef _FEATUREMGR_H_ 12#include "shaderGen/featureMgr.h" 13#endif 14#ifndef _MATERIALFEATURETYPES_H_ 15#include "materials/materialFeatureTypes.h" 16#endif 17#ifndef _MATERIALFEATUREDATA_H_ 18#include "materials/materialFeatureData.h" 19#endif 20 21#ifndef CUSTOMSHADERFEATURE_H 22#include "shaderGen/customShaderFeature.h" 23#endif 24 25class CustomShaderFeatureData; 26 27class CustomFeatureGLSL : public ShaderFeatureGLSL 28{ 29 friend class CustomShaderFeatureData; 30 31 struct VarHolder 32 { 33 String varName; 34 String type; 35 String defaultValue; 36 S32 elementId; 37 bool uniform; 38 bool sampler; 39 bool texture; 40 bool texCoord; 41 U32 constNum; 42 U32 arraySize; 43 String structName; 44 ConstantSortPosition constSortPos; 45 46 VarHolder() : 47 varName(""), 48 type(""), 49 defaultValue(""), 50 elementId(-1), 51 uniform(false), 52 sampler(false), 53 texture(false), 54 texCoord(false), 55 constNum(0), 56 arraySize(0), 57 structName(""), 58 constSortPos(cspUninit) 59 { 60 } 61 62 VarHolder(String _varName, String _type, String _defaultValue) : 63 elementId(-1), uniform(false), sampler(false), texture(false), texCoord(false), constNum(0), arraySize(0), structName(""), constSortPos(cspUninit) 64 { 65 varName = _varName; 66 type = _type; 67 defaultValue = _defaultValue; 68 } 69 }; 70 71 Vector<VarHolder> mVars; 72 73 Vector<VarHolder> mConnectorVars; 74 75 enum outputState 76 { 77 NoOutput, 78 VertexOutput, 79 PixelOutput 80 }; 81 82 outputState mOutputState; 83 84public: 85 CustomShaderFeatureData* mOwner; 86 87 Vector<ShaderComponent*> mComponentList; 88 MaterialFeatureData mFeatureData; 89 90protected: 91 MultiLine* meta; 92 93public: 94 95 //**************************************************************************** 96 // Accu Texture 97 //**************************************************************************** 98 virtual void processVert(Vector<ShaderComponent*>& componentList, 99 const MaterialFeatureData& fd); 100 101 virtual void processPix(Vector<ShaderComponent*>& componentList, 102 const MaterialFeatureData& fd); 103 104 virtual Material::BlendOp getBlendOp() { return Material::LerpAlpha; } 105 106 virtual Resources getResources(const MaterialFeatureData& fd) 107 { 108 Resources res; 109 res.numTex = 1; 110 res.numTexReg = 1; 111 return res; 112 } 113 114 virtual void setTexData(Material::StageData& stageDat, 115 const MaterialFeatureData& fd, 116 RenderPassData& passData, 117 U32& texIndex); 118 119 virtual String getName() 120 { 121 return mOwner->getName(); 122 } 123 124 bool hasFeature(String name); 125 126 void addUniform(String name, String type, String defaultValue, U32 arraySize = 0); 127 void addVariable(String name, String type, String defaultValue); 128 void addSampler(String name, String type, U32 arraySize = 0); 129 void addTexture(String name, String type, String samplerState, U32 arraySize); 130 void addConnector(String name, String type, String elementName); 131 void addVertTexCoord(String name); 132 void writeLine(String format, S32 argc, ConsoleValueRef* argv); 133}; 134