Skip to content

Commit

Permalink
Add comments to uniform setters
Browse files Browse the repository at this point in the history
  • Loading branch information
matteblair committed Sep 24, 2014
1 parent 2f8067d commit 0777e11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/util/shaderProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ class ShaderProgram {
void setUniformf(const std::string& _name, float _value0, float _value1, float _value2);
void setUniformf(const std::string& _name, float _value0, float _value1, float _value2, float _value3);

/*
* setUniformMatrix - ensure the program is bound and then sets the named uniform to the values
* beginning at the pointer _value; 4 values are used for a 2x2 matrix, 9 values for a 3x3, etc.
*/
void setUniformMatrix2f(const std::string& _name, float* _value, bool transpose = false);

This comment has been minimized.

Copy link
@tallytalwar

tallytalwar Sep 24, 2014

Member

There can be more overloaded methods to accept glm::vec2/3 glm::mat2/3/4

This comment has been minimized.

Copy link
@tallytalwar

tallytalwar Sep 24, 2014

Member

Matt has already mentioned this in the initial comments to the pull request.

void setUniformMatrix3f(const std::string& _name, float* _value, bool transpose = false);
void setUniformMatrix4f(const std::string& _name, float* _value, bool transpose = false);
Expand All @@ -76,8 +80,8 @@ class ShaderProgram {
ShaderLocation() : loc(-2) {}
// This struct exists to resolve an ambiguity in shader locations:
// In the unordered_maps that store shader uniform and attrib locations,
// Un-mapped 'keys' are initialized by constructing the 'value' type and
// for numerical types this constructs a value of 0. But 0 is a valid
// Un-mapped 'keys' are initialized by constructing the 'value' type.
// For numerical types this constructs a value of 0. But 0 is a valid
// location, so it is ambiguous whether the value is unmapped or simply 0.
// Therefore, we use a dummy structure which does nothing but initialize
// to a value that is not a valid uniform or attribute location.
Expand Down

0 comments on commit 0777e11

Please sign in to comment.