mirror of
https://github.com/love2d/love.git
synced 2026-08-18 03:34:23 +02:00
Add low-level hardware instancing support to Meshes.
Add “instancing” Graphics Feature constant. Add love.graphics.drawInstanced(mesh, instancecount, x, y, …) which draws the mesh multiple times in a single draw call. Each instance of the mesh will appear in the exact same spot unless one of the following are used: - Add an optional vertex attribute step type argument to Mesh:attachAttribute. “pervertex” is the default. “perinstance” causes the attribute to be per-instance instead of per-vertex, when the mesh is drawn. - Add love_InstanceID as a built-in read only int variable in GLSL 3 vertex shaders. It is always 0 except when a Mesh is drawn with more than 1 instance specified in the draw call. It can be used to manually compute or index into per-instance values in a shader. --HG-- branch : minor
This commit is contained in:
@@ -142,6 +142,7 @@ GLSL.VERTEX = {
|
||||
#define varying out
|
||||
#ifndef LOVE_GLSL1_ON_GLSL3
|
||||
#define love_VertexID gl_VertexID
|
||||
#define love_InstanceID gl_InstanceID
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -221,15 +222,15 @@ vec4 VideoTexel(vec2 texcoords) {
|
||||
}]],
|
||||
|
||||
FOOTER = [[
|
||||
uniform sampler2D MainTexture;
|
||||
uniform sampler2D MainTex;
|
||||
void main() {
|
||||
love_PixelColor = effect(VaryingColor, MainTexture, VaryingTexCoord.st, love_PixelCoord);
|
||||
love_PixelColor = effect(VaryingColor, MainTex, VaryingTexCoord.st, love_PixelCoord);
|
||||
}]],
|
||||
|
||||
FOOTER_MULTI_CANVAS = [[
|
||||
uniform sampler2D MainTexture;
|
||||
uniform sampler2D MainTex;
|
||||
void main() {
|
||||
effects(VaryingColor, MainTexture, VaryingTexCoord.st, love_PixelCoord);
|
||||
effects(VaryingColor, MainTex, VaryingTexCoord.st, love_PixelCoord);
|
||||
}]],
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user