Update
This commit is contained in:
parent
b1e5605a64
commit
4abf461bf6
8 changed files with 110 additions and 31 deletions
|
@ -3,7 +3,7 @@ package mrdev023.gamestate;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.lwjgl.glfw.*;
|
||||
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import mrdev023.entity.*;
|
||||
import mrdev023.gameengine.*;
|
||||
|
@ -17,10 +17,10 @@ import mrdev023.utils.*;
|
|||
|
||||
public class MainMenu extends Game implements IGameState{
|
||||
|
||||
public VAO vao,cube;
|
||||
public int time = 0;
|
||||
public static final float speed = 1.0f;
|
||||
public ArrayList<Light> lights;
|
||||
public ArrayList<Mesh> meshs;
|
||||
public TextFont text;
|
||||
|
||||
public void update() {
|
||||
|
@ -66,37 +66,37 @@ public class MainMenu extends Game implements IGameState{
|
|||
}
|
||||
|
||||
public void init() {
|
||||
//Ajout de la lumiere sur la scene
|
||||
lights = new ArrayList<Light>();
|
||||
lights.add(new AmbientLight(new Vector3f(100,100,100),Color4f.WHITE,Color4f.mul(Color4f.WHITE,1.0f)));
|
||||
vao = MeshBuilder.createFloor(400, Color4f.WHITE,Texture.FLOOR);
|
||||
cube = MeshBuilder.createCube(100, Color4f.WHITE,Texture.WOOD);
|
||||
lights.add(new AmbientLight(new Vector3f(100,100,100),Color4f.WHITE,Color4f.WHITE));
|
||||
// lights.add(new AmbientLight(new Vector3f(100,100,100),Color4f.WHITE,Color4f.WHITE));
|
||||
//Ajout des Objets sur la scene
|
||||
meshs = new ArrayList<Mesh>();
|
||||
meshs.add(new Mesh(MeshBuilder.createFloor(400, Color4f.WHITE,Texture.FLOOR),(new Matrix4f()).loadIdentity()));
|
||||
meshs.add(new Mesh(MeshBuilder.createCube(100, Color4f.WHITE,Texture.WOOD),(new Matrix4f()).loadIdentity().tranlate(0, 200, 0)));
|
||||
text = new TextFont("Test", 10, 10, 16, Color4f.WHITE);
|
||||
}
|
||||
|
||||
public void render2D() {
|
||||
text.drawText();
|
||||
|
||||
}
|
||||
|
||||
public void render3D() {
|
||||
for(Light light : lights){
|
||||
light.drawLight();
|
||||
Matrix4f mvp = new Matrix4f();
|
||||
mvp.loadIdentity();
|
||||
Shader.MAIN.uniform("transform", mvp);
|
||||
vao.render3D();
|
||||
mvp.tranlate(0, 200, 0);
|
||||
Shader.MAIN.uniform("transform", mvp);
|
||||
cube.render3D();
|
||||
for(Mesh mesh : meshs){
|
||||
light.drawLight();
|
||||
Shader.MAIN.uniform("transform", mesh.getTransform());
|
||||
mesh.getVao().render3D();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderGUI() {
|
||||
|
||||
text.drawText();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
vao.destroy();
|
||||
cube.destroy();
|
||||
for(Mesh mesh : meshs)mesh.getVao().destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue