pass attributes as int
This commit is contained in:
parent
3baaa7624e
commit
3e5e0fcbb8
|
@ -134,6 +134,12 @@ std::size_t sb::Attributes::dimensions() const
|
|||
}, vertices);
|
||||
}
|
||||
|
||||
/* Normalization isn't supported, so this always returns false */
|
||||
bool sb::Attributes::normalized() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Returns a pointer to the first vertex in the object's underlying vector of vertices. This can be used
|
||||
* along with the size function to pass the raw bytes of the vertices to the GPU. */
|
||||
sb::Attributes::operator const void*() const
|
||||
|
@ -151,6 +157,12 @@ sb::Attributes::operator const void*() const
|
|||
}, vertices);
|
||||
}
|
||||
|
||||
/* Attributes can be represented by their GL index when an int is requested. */
|
||||
sb::Attributes::operator int() const
|
||||
{
|
||||
return index();
|
||||
}
|
||||
|
||||
/* Extend to include these attributes at the end. The argument will be automatically converted to an
|
||||
* Attributes object, so the vertices can be in any of the Attributes constructor formats. If no attributes
|
||||
* have been constructed or initialized, the current vertices will be set to these vertices. Otherwise,
|
||||
|
|
|
@ -129,8 +129,7 @@ namespace sb
|
|||
std::monostate, std::vector<std::uint8_t>, std::vector<std::uint32_t>, std::vector<std::int32_t>, std::vector<float>,
|
||||
std::vector<glm::bvec2>, std::vector<glm::uvec2>, std::vector<glm::ivec2>, std::vector<glm::vec2>,
|
||||
std::vector<glm::bvec3>, std::vector<glm::uvec3>, std::vector<glm::ivec3>, std::vector<glm::vec3>,
|
||||
std::vector<glm::bvec4>, std::vector<glm::uvec4>, std::vector<glm::ivec4>, std::vector<glm::vec4>
|
||||
>;
|
||||
std::vector<glm::bvec4>, std::vector<glm::uvec4>, std::vector<glm::ivec4>, std::vector<glm::vec4>>;
|
||||
Vertices vertices;
|
||||
GLuint attribute_index = 0;
|
||||
|
||||
|
@ -222,8 +221,10 @@ namespace sb
|
|||
std::size_t count() const;
|
||||
GLenum type() const;
|
||||
std::size_t dimensions() const;
|
||||
bool normalized() const;
|
||||
friend std::ostream& operator<<(std::ostream&, const Attributes&);
|
||||
operator const void*() const;
|
||||
operator int() const;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue