Coloring sprites with a per-vertex attribute in a spritebatch

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

Coloring sprites with a per-vertex attribute in a spritebatch

Post by KayleMaster »

Let's say I have swordy1, he's wearing blue. He's in a spritebatch.
If I attach a per vertex attribute to color his clothes from blue to orange, will swordy2 also have orange clothes (same spritebatch)?
Can I attach different attributes for the shader to use on different instances of swordy unit, based on the index returned from SpriteBatch:add?
So in a spritebatch, can I have 10 orange swordys, 20 blue swordys, 5 red swordys for example?

I'm looking at https://love2d.org/wiki/SpriteBatch:attachAttribute
Nelvin
Party member
Posts: 124
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: Coloring sprites with a per-vertex attribute in a spritebatch

Post by Nelvin »

It's a per vertex attribute, so yes, you can use different values for quads in the same batch.
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

Re: Coloring sprites with a per-vertex attribute in a spritebatch

Post by KayleMaster »

That's great. But I have no idea how to uses meshes or shaders. I have no idea how to code this.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 237 guests