jeu-de-combat/src/engine/Primitive.java
2021-05-14 15:34:08 +02:00

69 lines
1.8 KiB
Java

package engine;
public class Primitive {
public float[] vertices;
public byte[] indices;
public Primitive(Vector3f vertex1, Vector3f vertex2, Vector3f vertex3){
vertices = new float[]{
vertex1.x, vertex1.y, vertex1.z,
vertex2.x, vertex2.y, vertex2.z,
vertex3.x, vertex3.y, vertex3.z
};
indices = new byte[]{
0, 1, 2
};
}
public Primitive(Vector3f vertex1, Vector3f vertex2, Vector3f vertex3, Vector3f vertex4){
vertices = new float[]{
vertex1.x, vertex1.y, vertex1.z,
vertex2.x, vertex2.y, vertex2.z,
vertex3.x, vertex3.y, vertex3.z,
vertex4.x, vertex4.y, vertex4.z
};
indices = new byte[]{
0, 1, 2,
1, 2, 3
};
}
public static float[] triangle = new float[] {
0.0f, 0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
};
public static byte[] triangle_indices = new byte[]{
0, 1, 2
};
public static float[] two_triangle = new float[] {
0.0f, 0.5f, 0.0f,
0.5f, -0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
-0.8f, -0.8f, 0.0f,
0.8f, -0.8f, 0.0f,
0.8f, -0.9f, 0.0f,
};
public static byte[] two_triangle_indices = new byte[]{
0, 1, 2,
3, 4, 5
};
public static float[] rectangle = new float[] {
0.5f, 0.5f, 0.0f, // top right
0.5f, -0.5f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, // bottom left
-0.5f, 0.5f, 0.0f // top left
};
public static byte[] rectangle_indices = new byte[] {
0, 1, 3,
1, 2, 3
};
}