00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef SHADERINPUT_H
00017 #define SHADERINPUT_H
00018
00019 #include "pandabase.h"
00020 #include "typedWritableReferenceCount.h"
00021 #include "pointerTo.h"
00022 #include "nodePath.h"
00023 #include "texture.h"
00024 #include "internalName.h"
00025 #include "shader.h"
00026 #include "pta_float.h"
00027 #include "pta_double.h"
00028 #include "pta_LMatrix4.h"
00029 #include "pta_LMatrix3.h"
00030 #include "pta_LVecBase4.h"
00031 #include "pta_LVecBase3.h"
00032 #include "pta_LVecBase2.h"
00033
00034
00035
00036
00037
00038
00039
00040
00041 class EXPCL_PANDA_PGRAPH ShaderInput: public TypedWritableReferenceCount {
00042 public:
00043 INLINE ~ShaderInput();
00044
00045 PUBLISHED:
00046 static const ShaderInput *get_blank();
00047 INLINE ShaderInput(const InternalName *id, int priority=0);
00048 INLINE ShaderInput(const InternalName *id, const NodePath &np, int priority=0);
00049 INLINE ShaderInput(const InternalName *id, Texture *tex, int priority=0);
00050 INLINE ShaderInput(const InternalName *id, const PTA_float &ptr, int priority=0);
00051 INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4f &ptr, int priority=0);
00052 INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3f &ptr, int priority=0);
00053 INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2f &ptr, int priority=0);
00054 INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4f &ptr, int priority=0);
00055 INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3f &ptr, int priority=0);
00056 INLINE ShaderInput(const InternalName *id, const LVecBase4f &vec, int priority=0);
00057 INLINE ShaderInput(const InternalName *id, const LVecBase3f &vec, int priority=0);
00058 INLINE ShaderInput(const InternalName *id, const LVecBase2f &vec, int priority=0);
00059 INLINE ShaderInput(const InternalName *id, const LMatrix4f &mat, int priority=0);
00060 INLINE ShaderInput(const InternalName *id, const LMatrix3f &mat, int priority=0);
00061
00062 INLINE ShaderInput(const InternalName *id, const PTA_double &ptr, int priority=0);
00063 INLINE ShaderInput(const InternalName *id, const PTA_LVecBase4d &ptr, int priority=0);
00064 INLINE ShaderInput(const InternalName *id, const PTA_LVecBase3d &ptr, int priority=0);
00065 INLINE ShaderInput(const InternalName *id, const PTA_LVecBase2d &ptr, int priority=0);
00066 INLINE ShaderInput(const InternalName *id, const PTA_LMatrix4d &ptr, int priority=0);
00067 INLINE ShaderInput(const InternalName *id, const PTA_LMatrix3d &ptr, int priority=0);
00068 INLINE ShaderInput(const InternalName *id, const LVecBase4d &vec, int priority=0);
00069 INLINE ShaderInput(const InternalName *id, const LVecBase3d &vec, int priority=0);
00070 INLINE ShaderInput(const InternalName *id, const LVecBase2d &vec, int priority=0);
00071 INLINE ShaderInput(const InternalName *id, const LMatrix4d &mat, int priority=0);
00072 INLINE ShaderInput(const InternalName *id, const LMatrix3d &mat, int priority=0);
00073
00074 enum ShaderInputType {
00075 M_invalid = 0,
00076 M_texture,
00077 M_nodepath,
00078 M_numeric
00079 };
00080
00081 INLINE const InternalName *get_name() const;
00082
00083 INLINE int get_value_type() const;
00084 INLINE int get_priority() const;
00085 INLINE Texture *get_texture() const;
00086 INLINE const NodePath &get_nodepath() const;
00087 INLINE const LVecBase4 &get_vector() const;
00088 INLINE const Shader::ShaderPtrData &get_ptr() const;
00089
00090 public:
00091 static void register_with_read_factory();
00092
00093 private:
00094 CPT(InternalName) _name;
00095 int _type;
00096 int _priority;
00097 Shader::ShaderPtrData _stored_ptr;
00098 PT(Texture) _stored_texture;
00099 NodePath _stored_nodepath;
00100 LVecBase4 _stored_vector;
00101
00102 public:
00103 static TypeHandle get_class_type() {
00104 return _type_handle;
00105 }
00106 static void init_type() {
00107 ReferenceCount::init_type();
00108 register_type(_type_handle, "ShaderInput",
00109 TypedWritableReferenceCount::get_class_type());
00110 }
00111 virtual TypeHandle get_type() const {
00112 return get_class_type();
00113 }
00114 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00115
00116 private:
00117 static TypeHandle _type_handle;
00118 };
00119
00120
00121 #include "shaderInput.I"
00122
00123 #endif // SHADERINPUT_H
00124