![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvGraphics/vrvGraphics.h> 00013 00014 namespace makVrv 00015 { 00018 class DT_DLL_VRVGRAPHICS DtEffect 00019 { 00020 public: 00021 00022 struct VaryingAttributeAddress 00023 { 00024 VaryingAttributeAddress(const void* p, unsigned int t, unsigned int s) 00025 : pointer(p) 00026 , type(t) 00027 , size(s) 00028 { 00029 } 00030 00031 const void* pointer; //Address 00032 unsigned int type; //The OpenGL type of the attribute. 00033 unsigned int size; //The OpenGL width of the attribute 1-4 00034 }; 00035 00036 00038 DtEffect(); 00039 00041 virtual ~DtEffect(); 00042 00044 void releaseResources(); 00045 00047 bool enabled() const; 00048 00049 //Start using the effect. Returns true if the effect is enabled. 00050 bool enable(); 00051 00052 //Stop using the effect. 00053 void disable(); 00054 00055 protected: 00057 virtual void getShaderSource(const char*& vs,const char*& fs,const char*& gs) = 0; 00058 virtual void updateUniformLocations() = 0; 00059 virtual void updateUniforms() = 0; 00060 00061 protected: 00062 00064 bool compileProgram(const char* vs,const char* fs,const char* gs); 00065 00066 protected: 00067 00068 bool myEnabledFlag; 00069 unsigned int myProgram; 00070 unsigned int myVertexShader; 00071 unsigned int myFragmentShader; 00072 }; 00073 00077 class DT_DLL_VRVGRAPHICS DtEffectCreator 00078 { 00079 public: 00080 00081 class CreateParameters 00082 { 00083 virtual ~CreateParameters() 00084 { 00085 } 00086 }; 00087 00088 DtEffectCreator(); 00089 virtual ~DtEffectCreator(); 00090 virtual DtEffect* create(CreateParameters* params = 0) = 0; 00091 }; 00092 00093 } 00094