Merge branch 'worldgen' of https://github.com/halotroop/Ginger3D into worldgen

pull/12/head
valoeghese 2020-02-29 11:45:32 +13:00
commit e70f21c81c
2 changed files with 11 additions and 6 deletions

View File

@ -37,8 +37,7 @@ public class BlockRenderer extends Renderer implements WorldGenConstants
public void prepareModel(TexturedModel model)
{
RawModel rawModel = model.getRawModel();
GL30.glBindVertexArray(rawModel.getVaoID());
GL30.glBindVertexArray(model.getRawModel().getVaoID());
GL20.glEnableVertexAttribArray(0);
GL20.glEnableVertexAttribArray(1);
GL20.glEnableVertexAttribArray(2);

View File

@ -39,14 +39,20 @@ public class Maths
return matrix;
}
private static final Vector3f XVEC = new Vector3f(1, 0, 0);
private static final Vector3f YVEC = new Vector3f(0, 1, 0);
private static final Vector3f ZVEC = new Vector3f(0, 0, 1);
private static final Matrix4f matrix = new Matrix4f();
public static Matrix4f createTransformationMatrix(Vector3f translation, float rx, float ry, float rz, Vector3f scale)
{
Matrix4f matrix = new Matrix4f();
matrix.zero();
matrix.identity();
matrix.translate(translation, matrix);
matrix.rotate((float) Math.toRadians(rx), new Vector3f(1, 0, 0), matrix);
matrix.rotate((float) Math.toRadians(ry), new Vector3f(0, 1, 0), matrix);
matrix.rotate((float) Math.toRadians(rz), new Vector3f(0, 0, 1), matrix);
matrix.rotate((float) Math.toRadians(rx), XVEC, matrix);
matrix.rotate((float) Math.toRadians(ry), YVEC, matrix);
matrix.rotate((float) Math.toRadians(rz), ZVEC, matrix);
matrix.scale(scale, matrix);
return matrix;
}