00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef DXSHADERCONTEXT9_H
00016 #define DXSHADERCONTEXT9_H
00017
00018 #include "dtool_config.h"
00019 #include "pandabase.h"
00020 #include "string_utils.h"
00021 #include "internalName.h"
00022 #include "shader.h"
00023 #include "shaderContext.h"
00024
00025
00026 #define CLP(name) DX##name##9
00027 #define CLASSPREFIX_QUOTED "DX"
00028
00029
00030 class VertexElementArray;
00031 class CLP(GraphicsStateGuardian);
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 class EXPCL_PANDADX CLP(ShaderContext): public ShaderContext {
00067 public:
00068 typedef CLP(GraphicsStateGuardian) GSG;
00069
00070 CLP(ShaderContext)(Shader *s, GSG *gsg);
00071 ~CLP(ShaderContext)();
00072
00073 INLINE bool valid(GSG *gsg);
00074 bool bind(GSG *gsg);
00075 void unbind(GSG *gsg);
00076 void issue_parameters(GSG *gsg, int altered);
00077 void issue_transform(GSG *gsg);
00078 void disable_shader_vertex_arrays(GSG *gsg);
00079 bool update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg,
00080 bool force);
00081 void disable_shader_texture_bindings(GSG *gsg);
00082 void update_shader_texture_bindings(CLP(ShaderContext) *prev, GSG *gsg);
00083
00084 class VertexElementArray* _vertex_element_array;
00085 LPDIRECT3DVERTEXDECLARATION9 _vertex_declaration;
00086
00087 int _num_bound_streams;
00088
00089
00090 string _name;
00091
00092 private:
00093
00094 #ifdef HAVE_CG
00095 CGcontext _cg_context;
00096 CGprogram _cg_vprogram;
00097 CGprogram _cg_fprogram;
00098
00099
00100 CGprogram _cg_gprogram;
00101
00102
00103 pvector <CGparameter> _cg_parameter_map;
00104 #endif
00105
00106 private:
00107
00108 void release_resources(void);
00109
00110 public:
00111 static TypeHandle get_class_type() {
00112 return _type_handle;
00113 }
00114 static void init_type() {
00115 TypedObject::init_type();
00116 register_type(_type_handle, CLASSPREFIX_QUOTED "ShaderContext",
00117 TypedObject::get_class_type());
00118 }
00119 virtual TypeHandle get_type() const {
00120 return get_class_type();
00121 }
00122 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00123
00124 private:
00125 static TypeHandle _type_handle;
00126 };
00127
00128 #include "dxShaderContext9.I"
00129
00130 #endif