39class EXPCL_PANDA_PGRAPH ShaderAttrib:
public RenderAttrib {
41 INLINE ShaderAttrib();
42 INLINE ShaderAttrib(
const ShaderAttrib ©);
45 static CPT(RenderAttrib)
make(
const Shader *shader =
nullptr,
int priority = 0);
50 F_disable_alpha_write = 0,
51 F_subsume_alpha_test = 1,
52 F_hardware_skinning = 2,
53 F_shader_point_size = 3,
58 INLINE
int get_shader_priority()
const;
60 INLINE
bool auto_normal_on()
const;
61 INLINE
bool auto_glow_on()
const;
62 INLINE
bool auto_gloss_on()
const;
63 INLINE
bool auto_ramp_on()
const;
64 INLINE
bool auto_shadow_on()
const;
66 CPT(RenderAttrib) set_shader(
const Shader *s,
int priority=0)
const;
67 CPT(RenderAttrib) set_shader_off(
int priority=0)
const;
68 CPT(RenderAttrib) set_shader_auto(
int priority=0)
const;
70 CPT(RenderAttrib) set_shader_auto(BitMask32 shader_switch,
int priority=0)
const;
72 CPT(RenderAttrib) clear_shader()
const;
74 CPT(RenderAttrib) set_shader_input(
const ShaderInput &input)
const;
75 CPT(RenderAttrib) set_shader_input(
ShaderInput &&input)
const;
80 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_float &v,
int priority=0)
const;
81 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_double &v,
int priority=0)
const;
82 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_LMatrix4 &v,
int priority=0)
const;
83 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_LMatrix3 &v,
int priority=0)
const;
84 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_LVecBase4 &v,
int priority=0)
const;
85 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_LVecBase3 &v,
int priority=0)
const;
86 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const PTA_LVecBase2 &v,
int priority=0)
const;
87 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const LVecBase4 &v,
int priority=0)
const;
88 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const LVecBase3 &v,
int priority=0)
const;
89 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const LVecBase2 &v,
int priority=0)
const;
90 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const LMatrix4 &v,
int priority=0)
const;
91 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
const LMatrix3 &v,
int priority=0)
const;
92 INLINE CPT(RenderAttrib) set_shader_input(
CPT_InternalName id,
double n1=0,
double n2=0,
double n3=0,
double n4=1,
93 int priority=0)
const;
96 EXTENSION(CPT(RenderAttrib) set_shader_input(
CPT_InternalName, PyObject *,
int priority=0)
const);
97 EXTENSION(CPT(RenderAttrib) set_shader_inputs(PyObject *args, PyObject *kwargs)
const);
101 CPT(RenderAttrib) set_flag(
int flag,
bool value)
const;
102 CPT(RenderAttrib) clear_flag(
int flag)
const;
104 CPT(RenderAttrib) clear_shader_input(
const InternalName *
id)
const;
105 CPT(RenderAttrib) clear_shader_input(
const std::string &
id)
const;
109 INLINE
bool get_flag(
int flag)
const;
130 virtual void output(std::ostream &out)
const;
133 virtual int compare_to_impl(
const RenderAttrib *other)
const;
134 virtual size_t get_hash_impl()
const;
135 virtual CPT(RenderAttrib) compose_impl(
const RenderAttrib *other)
const;
140 int _shader_priority;
147 bool _auto_normal_on;
151 bool _auto_shadow_on;
155 typedef pmap<const InternalName *, ShaderInput> Inputs;
162 static int get_class_slot() {
165 virtual int get_slot()
const {
166 return get_class_slot();
168 MAKE_PROPERTY(class_slot, get_class_slot);
171 static TypeHandle get_class_type() {
174 static void init_type() {
175 RenderAttrib::init_type();
177 RenderAttrib::get_class_type());
178 _attrib_slot =
register_slot(_type_handle, 10,
new ShaderAttrib);
180 virtual TypeHandle get_type()
const {
181 return get_class_type();
183 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
186 static TypeHandle _type_handle;
187 static int _attrib_slot;
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
The default class template does not define any methods.
Encodes a string name in a hash table, mapping it to a pointer.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
static int register_slot(TypeHandle type_handle, int sort, RenderAttrib *default_attrib)
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot ...
Represents a set of settings that indicate how a texture is sampled.
static ConstPointerTo< RenderAttrib > make_off()
Constructs a new ShaderAttrib object that disables the use of shaders (it does not clear out all shad...
ConstPointerTo< RenderAttrib > clear_all_shader_inputs() const
Clears all the shader inputs on the attrib.
Texture * get_shader_input_texture(const InternalName *id, SamplerState *sampler=nullptr) const
Returns the ShaderInput as a texture.
bool auto_shader() const
If true, then this ShaderAttrib does not contain an explicit shader - instead, it requests the automa...
const LMatrix4 & get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const
Returns the ShaderInput as a matrix.
bool has_shader_input(CPT_InternalName id) const
Returns true if there is a ShaderInput of the given name.
get_shader
Returns the shader object associated with the node.
ShaderBuffer * get_shader_input_buffer(const InternalName *id) const
Returns the ShaderInput as a ShaderBuffer.
const NodePath & get_shader_input_nodepath(const InternalName *id) const
Returns the ShaderInput as a nodepath.
static ConstPointerTo< RenderAttrib > make(const Shader *shader=nullptr, int priority=0)
Constructs a new ShaderAttrib object with nothing set.
ConstPointerTo< RenderAttrib > set_instance_count(int instance_count) const
Sets the geometry instance count.
const ShaderInput & get_shader_input(const InternalName *id) const
Returns the ShaderInput of the given name.
static void register_with_read_factory()
Factory method to generate a Shader object.
static ConstPointerTo< RenderAttrib > make_default()
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attrib...
get_instance_count
Returns the number of geometry instances.
bool has_shader() const
If true, the shader field of this attribute overrides the shader field of the parent attribute.
const Shader::ShaderPtrData * get_shader_input_ptr(const InternalName *id) const
Returns the ShaderInput as a ShaderPtrData struct.
LVecBase4 get_shader_input_vector(InternalName *id) const
Returns the ShaderInput as a vector.
This is a generic buffer object that lives in graphics memory.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.