mirror of
https://github.com/ApfelTeeSaft/vb01.git
synced 2026-08-26 19:33:45 +00:00
methods to set shader uniforms
This commit is contained in:
+30
-5
@@ -26,15 +26,40 @@ namespace vb01{
|
|||||||
return uni;
|
return uni;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Material::setIntUniform(string name, int value){
|
||||||
|
IntUniform *uni = (IntUniform*)getUniform(name);
|
||||||
|
uni->value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Material::setBoolUniform(string name, bool value){
|
||||||
|
BoolUniform *uni = (BoolUniform*)getUniform(name);
|
||||||
|
uni->value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Material::setFloatUniform(string name, float value){
|
||||||
|
FloatUniform *uni = (FloatUniform*)getUniform(name);
|
||||||
|
uni->value = value;
|
||||||
|
}
|
||||||
|
|
||||||
void Material::setTexUniform(string name, Texture *texture, bool animatable){
|
void Material::setTexUniform(string name, Texture *texture, bool animatable){
|
||||||
TextureUniform *uni = (TextureUniform*)getUniform(name);
|
TextureUniform *uni = (TextureUniform*)getUniform(name);
|
||||||
uni->value = texture;
|
uni->value = texture;
|
||||||
uni->animatable = animatable;
|
uni->animatable = animatable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Material::setVec2Uniform(string name, Vector2 value){
|
||||||
|
Vector2Uniform *uni = (Vector2Uniform*)getUniform(name);
|
||||||
|
uni->value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Material::setVec3Uniform(string name, Vector3 value){
|
||||||
|
Vector3Uniform *uni = (Vector3Uniform*)getUniform(name);
|
||||||
|
uni->value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Material::setVec4Uniform(string name, Vector4 value){
|
void Material::setVec4Uniform(string name, Vector4 value){
|
||||||
Vector4Uniform *uni = (Vector4Uniform*)getUniform(name);
|
Vector4Uniform *uni = (Vector4Uniform*)getUniform(name);
|
||||||
uni->value = value;
|
uni->value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Material::update(){
|
void Material::update(){
|
||||||
|
|||||||
@@ -142,6 +142,11 @@ namespace vb01{
|
|||||||
Material(std::string, bool = false);
|
Material(std::string, bool = false);
|
||||||
~Material();
|
~Material();
|
||||||
void update();
|
void update();
|
||||||
|
void setIntUniform(std::string, int);
|
||||||
|
void setBoolUniform(std::string, bool);
|
||||||
|
void setFloatUniform(std::string, float);
|
||||||
|
void setVec2Uniform(std::string, Vector2);
|
||||||
|
void setVec3Uniform(std::string, Vector3);
|
||||||
void setVec4Uniform(std::string, Vector4);
|
void setVec4Uniform(std::string, Vector4);
|
||||||
void setTexUniform(std::string, Texture*, bool);
|
void setTexUniform(std::string, Texture*, bool);
|
||||||
Uniform* getUniform(std::string);
|
Uniform* getUniform(std::string);
|
||||||
|
|||||||
Reference in New Issue
Block a user