ShaderAttrib

class ShaderAttrib

Bases: RenderAttrib

Inheritance diagram

Inheritance diagram of ShaderAttrib

bool auto_gloss_on(void) const
bool auto_glow_on(void) const
bool auto_normal_on(void) const
bool auto_ramp_on(void) const
bool auto_shader(void) const

If true, then this ShaderAttrib does not contain an explicit shader - instead, it requests the automatic generation of a shader.

bool auto_shadow_on(void) const
ConstPointerTo<RenderAttrib> clear_all_shader_inputs(void) const

Clears all the shader inputs on the attrib.

ConstPointerTo<RenderAttrib> clear_flag(int flag) const
ConstPointerTo<RenderAttrib> clear_shader(void) const
ConstPointerTo<RenderAttrib> clear_shader_input(InternalName const *id) const
ConstPointerTo<RenderAttrib> clear_shader_input(std::string const &id) const
static int get_class_slot(void)
static TypeHandle get_class_type(void)
bool get_flag(int flag) const
int get_instance_count(void) const

Returns the number of geometry instances. A value of 0 means not to use instancing at all.

Shader const *get_shader(void) const

Returns the shader object associated with the node. If get_override returns true, but get_shader returns NULL, that means that this attribute should disable the shader.

ShaderInput const &get_shader_input(InternalName const *id) const
ShaderInput const &get_shader_input(std::string const &id) const

Returns the ShaderInput of the given name. If no such name is found, this function does not return NULL — it returns the “blank” ShaderInput.

ShaderBuffer *get_shader_input_buffer(InternalName const *id) const

Returns the ShaderInput as a ShaderBuffer. Assertion fails if there is none, or if it is not a ShaderBuffer.

LMatrix4 const &get_shader_input_matrix(InternalName const *id, LMatrix4 &matrix) const

Returns the ShaderInput as a matrix. Assertion fails if there is none, or if it is not a matrix or NodePath.

NodePath const &get_shader_input_nodepath(InternalName const *id) const

Returns the ShaderInput as a nodepath. Assertion fails if there is none, or if it is not a nodepath.

Shader::ShaderPtrData const *get_shader_input_ptr(InternalName const *id) const

Returns the ShaderInput as a ShaderPtrData struct. Assertion fails if there is none. or if it is not a PTA(double/float)

Texture *get_shader_input_texture(InternalName const *id, SamplerState *sampler = nullptr) const

Returns the ShaderInput as a texture. Assertion fails if there is none, or if it is not a texture.

If sampler is not NULL, the sampler state to use for this texture is assigned to it.

LVecBase4 get_shader_input_vector(InternalName *id) const

Returns the ShaderInput as a vector. Assertion fails if there is none, or if it is not a vector.

int get_shader_priority(void) const
bool has_shader(void) const

If true, the shader field of this attribute overrides the shader field of the parent attribute.

bool has_shader_input(CPT_InternalName id) const

Returns true if there is a ShaderInput of the given name.

static ConstPointerTo<RenderAttrib> make(Shader const *shader = nullptr, int priority = 0)

Constructs a new ShaderAttrib object with nothing set.

static ConstPointerTo<RenderAttrib> make_default(void)

Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.

static ConstPointerTo<RenderAttrib> make_off(void)

Constructs a new ShaderAttrib object that disables the use of shaders (it does not clear out all shader data, however.)

static void register_with_read_factory(void)

Factory method to generate a Shader object

ConstPointerTo<RenderAttrib> set_flag(int flag, bool value) const
ConstPointerTo<RenderAttrib> set_instance_count(int instance_count) const

Sets the geometry instance count. Do not confuse this with instanceTo, which is used for animation instancing, and has nothing to do with this. A value of 0 means not to use instancing at all.

ConstPointerTo<RenderAttrib> set_shader(Shader const *s, int priority = 0) const
ConstPointerTo<RenderAttrib> set_shader_auto(int priority = 0) const
ConstPointerTo<RenderAttrib> set_shader_auto(BitMask32 shader_switch, int priority = 0) const

Set auto shader with bitmask to customize use, e.g., to keep normal, glow, etc., on or off

ConstPointerTo<RenderAttrib> set_shader_input(ShaderInput const &input) const
ConstPointerTo<RenderAttrib> set_shader_input(ShaderInput &&input) const
ConstPointerTo<RenderAttrib> set_shader_input(CPT_InternalName, PyObject*, int priority = 0) const

Shader Inputs

ConstPointerTo<RenderAttrib> set_shader_inputs(PyObject *args, PyObject *kwargs) const
ConstPointerTo<RenderAttrib> set_shader_off(int priority = 0) const