00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __RE_CgShader_h__
00020 #define __RE_CgShader_h__
00021
00022 class RE_Render;
00023
00024 #include <UT/UT_String.h>
00025 #include <UT/UT_PtrArray.h>
00026 #include <UT/UT_IntArray.h>
00027
00028 #include "RE_Shader.h"
00029 #include "RE_API.h"
00030
00031 #ifdef RE_USE_CG
00032
00033 #ifdef CELLBE
00034 #include </usr/local/sony-cell-sdk/target/ppu/include/Cg/cg.h>
00035 #include </usr/local/sony-cell-sdk/target/ppu/include/Cg/cgGL.h>
00036 #else
00037 #include <Cg/cgGL.h>
00038 #include <Cg/cg.h>
00039 #endif
00040
00041 #endif
00042
00043
00044 class RE_API RE_CgShader : public RE_Shader
00045 {
00046 public:
00047 RE_CgShader();
00048 virtual ~RE_CgShader();
00049
00050
00051 virtual void applyShader() const;
00052 virtual void removeShader();
00053
00054
00055 virtual bool setPrograms(const char *english_shader_name,
00056 const char *vtxSrc, const char *fragSrc,
00057 UT_String *messages = NULL);
00058 virtual void clearPrograms();
00059
00060
00061
00062
00063
00064 virtual int bindTextureMap(const char *name, const char *tmap,
00065 const char *relativeTo);
00066 virtual bool bindTextureMap(const char *name, int tex_id, int tex_unit);
00067
00068
00069
00070 virtual bool bindVariableInt(const char *name, const int *val,
00071 int array_size=1);
00072 virtual bool bindVariableInt2(const char *name, const int *val,
00073 int array_size=1);
00074 virtual bool bindVariableInt3(const char *name, const int *val,
00075 int array_size=1);
00076 virtual bool bindVariableInt4(const char *name, const int *val,
00077 int array_size=1);
00078 virtual bool bindVariable1(const char *name, const float *val,
00079 int array_size=1);
00080 virtual bool bindVariable2(const char *name, const float *val,
00081 int array_size=1);
00082 virtual bool bindVariable3(const char *name, const float *val,
00083 int array_size=1);
00084 virtual bool bindVariable4(const char *name, const float *val,
00085 int array_size=1);
00086
00087 virtual bool bindMatrix2(const char *name, const float *val,
00088 int array_size=1);
00089 virtual bool bindMatrix3(const char *name, const float *val,
00090 int array_size=1);
00091 virtual bool bindMatrix4(const char *name, const float *val,
00092 int array_size=1);
00093
00094 virtual void loadShaderTexMaps(RE_Render *r);
00095 private:
00096 virtual bool loadShaderAttribNames();
00097 virtual bool loadShaderUniformNames();
00098
00099 #ifdef RE_USE_CG
00100 CGparameter fetchVertexParameter(const char *name);
00101 CGparameter fetchFragmentParameter(const char *name);
00102
00103 CGcontext myContext;
00104
00105 CGprogram myVertexProgram;
00106 CGprofile myVertexProfile;
00107
00108 CGprogram myFragmentProgram;
00109 CGprofile myFragmentProfile;
00110 #endif
00111 };
00112
00113 #endif