add method to clear texture list to sprite class, add comments explaining model class's private member vars

This commit is contained in:
ohsqueezy 2023-08-14 16:30:38 -04:00
parent edafaf08ea
commit a055001482
2 changed files with 17 additions and 2 deletions

View File

@ -40,8 +40,17 @@ namespace sb
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;
/* 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;
/* 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};
public:

View File

@ -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.
*
* @param index index of texture to get
*/
const sb::Texture& texture() const
{
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
* @return constant reference to the texture at the given index