mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
Add love.graphics.newMesh variant to create a Mesh from existing Buffers.
This allows a Mesh to be created that doesn't have its own internal vertex buffer and purely references other vertex buffers instead.
The prototype looks like this:
mesh = love.graphics.newMesh(attributelist, drawmode)
where attributelist is an array of tables each with the following fields, similar to Mesh:attachAttribute:
{
buffer = vertexbuffer,
name = "VertexPosition", -- the name this vertex attribute will use in a shader
nameinbuffer = nil, -- the name of the attribute in the vertex buffer. Defaults to the name field.
step = nil, -- vertex attribute step ("pervertex" or "perinstance"), defaults to "pervertex".
startindex = nil, -- 1-based array index within the given vertex buffer where the attribute data will start being pulled from during rendering. Defaults to 1.
}
This commit is contained in:
@@ -56,6 +56,7 @@ public:
|
||||
std::string name;
|
||||
StrongRef<Buffer> buffer;
|
||||
StrongRef<Mesh> mesh;
|
||||
std::string nameInBuffer;
|
||||
int indexInBuffer;
|
||||
int startArrayIndex;
|
||||
AttributeStep step;
|
||||
@@ -186,6 +187,7 @@ private:
|
||||
|
||||
void setupAttachedAttributes();
|
||||
int getAttachedAttributeIndex(const std::string &name) const;
|
||||
void finalizeAttribute(Graphics *gfx, BufferAttribute &attrib) const;
|
||||
|
||||
void drawInternal(Graphics *gfx, const Matrix4 &m, int instancecount, Buffer *indirectargs, int argsindex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user