mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-15 09:34:53 +00:00
Initial Commit
This commit is contained in:
1 parent
397135f687
commit
0f32dd8620
82 files changed
+10693
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package codechicken.lib.render;
|
||||
|
||||
import net.minecraft.util.Icon;
|
||||
|
||||
/**
|
||||
* Icon index is specified as (int)u>>1
|
||||
*/
|
||||
public class MultiIconTransformation implements IUVTransformation
|
||||
{
|
||||
public Icon[] icons;
|
||||
|
||||
public MultiIconTransformation(Icon[] icons)
|
||||
{
|
||||
this.icons = icons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(UV texcoord)
|
||||
{
|
||||
int i = (int)texcoord.u>>1;
|
||||
Icon icon = icons[i%icons.length];
|
||||
texcoord.u = icon.getInterpolatedU(texcoord.u%2*16);
|
||||
texcoord.v = icon.getInterpolatedV(texcoord.v%2*16);
|
||||
}
|
||||
|
||||
public static CCModel setIconIndex(CCModel m, int index)
|
||||
{
|
||||
return setIconIndex(m, 0, m.verts.length, index);
|
||||
}
|
||||
|
||||
public static CCModel setIconIndex(CCModel m, int start, int length, int index)
|
||||
{
|
||||
for(int k = start; k < length; k++)
|
||||
{
|
||||
UV uv = m.verts[k].uv;
|
||||
uv.u = uv.u%2+index*2;
|
||||
uv.v %= 2;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user