mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +02:00
Added SpriteBatch:attachAttribute(attributename, mesh), which lets SpriteBatches use per-vertex information from a vertex attribute in a Mesh when drawing.
Each sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can be multiplied by 4 to determine the first vertex in a specific sprite.
This commit is contained in:
@@ -126,6 +126,7 @@ public:
|
||||
**/
|
||||
const std::vector<AttribFormat> &getVertexFormat() const;
|
||||
DataType getAttributeInfo(int attribindex, int &components) const;
|
||||
int getAttributeIndex(const std::string &name) const;
|
||||
|
||||
/**
|
||||
* Sets whether a specific vertex attribute is used when drawing the Mesh.
|
||||
@@ -193,6 +194,8 @@ public:
|
||||
void setDrawRange();
|
||||
void getDrawRange(int &min, int &max) const;
|
||||
|
||||
int bindAttributeToShaderInput(int attributeindex, const std::string &inputname);
|
||||
|
||||
// Implements Drawable.
|
||||
void draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) override;
|
||||
|
||||
@@ -212,7 +215,7 @@ private:
|
||||
struct AttachedAttribute
|
||||
{
|
||||
Mesh *mesh;
|
||||
size_t index;
|
||||
int index;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user