00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "VolShaderStd.h"
00022 #include <sstream>
00023 using namespace glift;
00024 using namespace std;
00025
00026
00027
00028 VolShaderStd::VolShaderStd()
00029 {
00030 char fp[] =
00031 "!!ARBfp1.0 \n"
00032 "TEMP data0; \n"
00033 "PARAM red = {.01, 0, 0, 0.01}; \n "
00034 "TEX data0, fragment.texcoord[0], texture[0], 3D; #Read texture \n"
00035 "MOV data0, data0.xxxx; #replicate value one \n"
00036 "MUL data0.xyz, data0, data0.w; #Always muliply color by alpha \n"
00037 "MOV result.color, data0; #output color \n"
00038 "END \n";
00039 setPixelShader(new FragProgARB(fp,false));
00040 }
00041
00042
00043
00044
00045 void VolShaderStd::bindDef()
00046 {
00047 glDepthMask(GL_FALSE);
00048 glColor4f(1,1,1,1);
00049 glDisable(GL_LIGHTING);
00050 bindShaders();
00051 bindBlend();
00052 }
00053
00054
00055
00056
00057 void VolShaderStd::releaseDef()
00058 {
00059 glDepthMask(GL_TRUE);
00060 glEnable(GL_LIGHTING);
00061 releaseShaders();
00062 releaseBlend();
00063 }
00064
00065
00066
00067
00068
00069
00070
00071
00072 VolShaderTexCoord::VolShaderTexCoord(unsigned int tcNum)
00073 {
00074
00075 string fp;
00076 fp = "!!ARBfp1.0 \n"
00077 "TEMP data0; \n"
00078 "PARAM alpha = {0, 0, 0, 0.1}; \n"
00079 "MOV data0, fragment.texcoord[0];\n"
00080 "MUL data0.rgb, data0, alpha.a; \n"
00081 "MOV result.color, data0; \n"
00082 "MOV result.color.a, alpha.a; \n"
00083 "END \n";
00084 setPixelShader(new FragProgARB(fp.c_str(),false));
00085 }