Merge branch 'worldgen' of https://github.com/halotroop/Ginger3D into worldgen
commit
e70f21c81c
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue