mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
parent
ab7dbebf3f
commit
854d736882
@ -3262,7 +3262,7 @@ get_shader() const {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void NodePath::
|
void NodePath::
|
||||||
set_shader_input(ShaderInput inp) {
|
set_shader_input(const ShaderInput &inp) {
|
||||||
nassertv_always(!is_empty());
|
nassertv_always(!is_empty());
|
||||||
|
|
||||||
PandaNode *pnode = node();
|
PandaNode *pnode = node();
|
||||||
@ -3278,6 +3278,26 @@ set_shader_input(ShaderInput inp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void NodePath::
|
||||||
|
set_shader_input(ShaderInput &&inp) {
|
||||||
|
nassertv_always(!is_empty());
|
||||||
|
|
||||||
|
PandaNode *pnode = node();
|
||||||
|
const RenderAttrib *attrib =
|
||||||
|
pnode->get_attrib(ShaderAttrib::get_class_slot());
|
||||||
|
if (attrib != nullptr) {
|
||||||
|
const ShaderAttrib *sa = (const ShaderAttrib *)attrib;
|
||||||
|
pnode->set_attrib(sa->set_shader_input(move(inp)));
|
||||||
|
} else {
|
||||||
|
// Create a new ShaderAttrib for this node.
|
||||||
|
CPT(ShaderAttrib) sa = DCAST(ShaderAttrib, ShaderAttrib::make());
|
||||||
|
pnode->set_attrib(sa->set_shader_input(move(inp)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -629,7 +629,8 @@ PUBLISHED:
|
|||||||
void set_shader_auto(BitMask32 shader_switch, int priority=0);
|
void set_shader_auto(BitMask32 shader_switch, int priority=0);
|
||||||
void clear_shader();
|
void clear_shader();
|
||||||
|
|
||||||
void set_shader_input(ShaderInput input);
|
void set_shader_input(const ShaderInput &input);
|
||||||
|
void set_shader_input(ShaderInput &&input);
|
||||||
|
|
||||||
INLINE void set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority=0);
|
INLINE void set_shader_input(CPT_InternalName id, Texture *tex, const SamplerState &sampler, int priority=0);
|
||||||
INLINE void set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0);
|
INLINE void set_shader_input(CPT_InternalName id, Texture *tex, bool read, bool write, int z=-1, int n=0, int priority=0);
|
||||||
|
@ -195,7 +195,22 @@ clear_flag(int flag) const {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
CPT(RenderAttrib) ShaderAttrib::
|
CPT(RenderAttrib) ShaderAttrib::
|
||||||
set_shader_input(ShaderInput input) const {
|
set_shader_input(const ShaderInput &input) const {
|
||||||
|
ShaderAttrib *result = new ShaderAttrib(*this);
|
||||||
|
Inputs::iterator i = result->_inputs.find(input.get_name());
|
||||||
|
if (i == result->_inputs.end()) {
|
||||||
|
result->_inputs.insert(Inputs::value_type(input.get_name(), input));
|
||||||
|
} else {
|
||||||
|
i->second = input;
|
||||||
|
}
|
||||||
|
return return_new(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
CPT(RenderAttrib) ShaderAttrib::
|
||||||
|
set_shader_input(ShaderInput &&input) const {
|
||||||
ShaderAttrib *result = new ShaderAttrib(*this);
|
ShaderAttrib *result = new ShaderAttrib(*this);
|
||||||
Inputs::iterator i = result->_inputs.find(input.get_name());
|
Inputs::iterator i = result->_inputs.find(input.get_name());
|
||||||
if (i == result->_inputs.end()) {
|
if (i == result->_inputs.end()) {
|
||||||
|
@ -71,7 +71,8 @@ PUBLISHED:
|
|||||||
|
|
||||||
CPT(RenderAttrib) clear_shader() const;
|
CPT(RenderAttrib) clear_shader() const;
|
||||||
// Shader Inputs
|
// Shader Inputs
|
||||||
CPT(RenderAttrib) set_shader_input(ShaderInput input) const;
|
CPT(RenderAttrib) set_shader_input(const ShaderInput &input) const;
|
||||||
|
CPT(RenderAttrib) set_shader_input(ShaderInput &&input) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, Texture *tex, int priority=0) const;
|
INLINE CPT(RenderAttrib) set_shader_input(CPT_InternalName id, Texture *tex, int priority=0) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user