add method to clear texture list to sprite class, add comments explaining model class's private member vars
This commit is contained in:
parent
edafaf08ea
commit
a055001482
|
@ -40,8 +40,17 @@ namespace sb
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/* When a texture is copied, it copies its shared pointer to its ID that identifies the texture memory on the GPU. Therefore, when
|
||||||
|
* this object is copied, its textures are copied with reference to the same GPU memory preserved. */
|
||||||
std::vector<sb::Texture> _textures;
|
std::vector<sb::Texture> _textures;
|
||||||
|
|
||||||
|
/* The attributes are associated with vertex data copied on the GPU. Shared pointers are used to store the attributes, so that if a
|
||||||
|
* copy of this object is made, each attributes in the copied object will point to its originally constructed attributes object, preserving
|
||||||
|
* the association with the vertex data on the GPU. */
|
||||||
std::map<std::string, std::shared_ptr<sb::Attributes>> _attributes;
|
std::map<std::string, std::shared_ptr<sb::Attributes>> _attributes;
|
||||||
|
|
||||||
|
/* The model keeps a single transformation matrix. Specific types of transformation, like scale, translate, etc, can be combined into this
|
||||||
|
* transformation. */
|
||||||
glm::mat4 _transformation {1.0f};
|
glm::mat4 _transformation {1.0f};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -149,14 +149,20 @@ namespace sb
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get a constant reference to the texture attached to the sprite's plane object at the object's current texture index.
|
* Get a constant reference to the texture attached to the sprite's plane object at the object's current texture index.
|
||||||
*
|
|
||||||
* @param index index of texture to get
|
|
||||||
*/
|
*/
|
||||||
const sb::Texture& texture() const
|
const sb::Texture& texture() const
|
||||||
{
|
{
|
||||||
return plane.texture(_texture_index);
|
return plane.texture(_texture_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Remove all textures from the sprite object's plane.
|
||||||
|
*/
|
||||||
|
void clear_textures()
|
||||||
|
{
|
||||||
|
plane.textures() = {};
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @param index set the object's texture index
|
* @param index set the object's texture index
|
||||||
* @return constant reference to the texture at the given index
|
* @return constant reference to the texture at the given index
|
||||||
|
|
Loading…
Reference in New Issue