00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 6-17-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 /// VolShader.h 00019 /// Base class for Simian Volume Shaders 00020 /// also implements the shader for drawing the outlines of slices 00021 00022 #ifndef __VOL_SHADER_DOT_H 00023 #define __VOL_SHADER_DOT_H 00024 00025 #include <stateGlift.h> 00026 #include <textureGlift.h> 00027 #include <smartptr.h> 00028 #include <simBase/simBase.h> 00029 00030 class VolShader : 00031 public glift::StateGLI, 00032 public SimBase 00033 { 00034 public: 00035 VolShader(); 00036 virtual ~VolShader(); 00037 00038 //////////////////////////////////////////////////////////// 00039 /// Set/get Pixel Shader, a user policy 00040 void setPixelShader(glift::PixelShader *ps); 00041 glift::PixelShaderSP getPixelShader(); 00042 00043 //////////////////////////////////////////////////////////// 00044 /// Set/get Vertex Shader, a user policy 00045 void setVertexShader(glift::VertexShader *vs); 00046 glift::VertexShaderSP getVertexShader(); 00047 00048 /// blend modes 00049 enum{ 00050 BLEND_NONE, ///blending off 00051 BLEND_F2B, ///Front to back 00052 BLEND_B2F, ///Back to front 00053 BLEND_MODE_LAST ///add new modes after this enum value 00054 }; 00055 /// blend defaults to NONE 00056 void setBlend(int blendMode); 00057 int getBlend() const {return _blendMode;} 00058 00059 protected: 00060 00061 00062 ///////////////////////////////////////////// 00063 /// Defs 00064 /// Override these to change the behavior 00065 /// of this class, default draws lines 00066 virtual void bindDef(); 00067 virtual void releaseDef(); 00068 00069 ///////////////////////////////////////////// 00070 /// State 00071 /// Bind and release all state in the 00072 /// state array. 00073 virtual void bindState(); 00074 virtual void releaseState(); 00075 00076 ///////////////////////////////////////////// 00077 /// Shaders 00078 /// You probably won't need to override these, 00079 /// They do what ya expect 00080 virtual void bindShaders(); 00081 virtual void releaseShaders(); 00082 00083 ///////////////////////////////////////////// 00084 /// Blend 00085 /// You probably won't need to override these, 00086 /// They do what ya expect 00087 virtual void bindBlend(); 00088 virtual void releaseBlend(); 00089 00090 glift::PixelShaderSP _curPixShade; 00091 glift::VertexShaderSP _curVertShade; 00092 00093 glift::VecStateP _state; 00094 00095 int _blendMode; 00096 00097 private: 00098 00099 }; 00100 00101 typedef gutz::SmartPtr<VolShader> VolShaderSP; 00102 00103 #endif 00104