ProjectZombie/src/projectzombie/model/ModelGui.java

92 lines
1.7 KiB
Java

package projectzombie.model;
import gl_engine.texture.TextureRef3D;
import gl_engine.vec.Vec2d;
public class ModelGui extends Model
{
private int animationSize;
private int animationSpeed;
private double width, height;
private TextureRef3D ref;
private Vec2d size;
public ModelGui(TextureRef3D ref, Vec2d size, int animationSize, int animationSpeed)
{
this.ref = ref;
this.size = size;
this.animationSize = animationSize;
this.animationSpeed = animationSpeed;
}
public ModelGui(TextureRef3D tex, int animationSize, int animationSpeed) {
this(tex, new Vec2d(1, 1), animationSize, animationSpeed);
}
public ModelGui(TextureRef3D tex, Vec2d size) {
this(tex, size, 1, 1);
}
public ModelGui(TextureRef3D tex) {
this(tex, new Vec2d(1, 1), 1, 1);
}
@Override
public int getSize() {
return 4;
}
@Override
public float[] getVerticies()
{
float x = (float)size.x;
float y = (float)size.y;
int asi = animationSize;
int asp = animationSpeed;
width = x;
height = y;
return new float[] {
0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0b10,
x, 0, 0, 1, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0b10,
x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0b10,
0, y, 0, 0, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0b10,
};
}
@Override
public int getIndexSize() {
return 6;
}
@Override
public int[] getIndicies() {
return new int[] {
0, 1, 2,
2, 3, 0,
};
}
@Override
public TextureRef3D[] getTextures()
{
return new TextureRef3D[] {
ref, ref, ref, ref
};
}
@Override
public double getHeight() {
generate();
return height;
}
public double getWidth() {
generate();
return width;
}
}