public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
public SkyBox(String objModel, String textureFile) throws Exception { super(); Mesh skyBoxMesh = OBJLoader.loadMesh(objModel); Texture skyBoxtexture = new Texture(textureFile); skyBoxMesh.setMaterial(new Material(skyBoxtexture, 0.0f)); setMesh(skyBoxMesh); setPosition(0, 0, 0); } }
@Override public void init(Window window) throws Exception { renderer.init(window); //Mesh mesh = OBJLoader.loadMesh("/models/bunny.obj"); Mesh mesh = OBJLoader.loadMesh("/models/cube.obj"); Texture texture = new Texture("/textures/grassblock.png"); mesh.setTexture(texture); GameItem gameItem = new GameItem(mesh); gameItem.setScale(0.5f); gameItem.setPosition(0, 0, -2); gameItems = new GameItem[]{gameItem}; }
@Override public void init(Window window) throws Exception { renderer.init(window); scene = new Scene(); // Setup GameItems float reflectance = 1f; Mesh cubeMesh = OBJLoader.loadMesh("/models/cube.obj"); Material cubeMaterial = new Material(new Vector4f(0, 1, 0, 1), reflectance); cubeMesh.setMaterial(cubeMaterial); cubeGameItem = new GameItem(cubeMesh); cubeGameItem.setPosition(0, 0, 0); cubeGameItem.setScale(0.5f); Mesh quadMesh = OBJLoader.loadMesh("/models/plane.obj"); Material quadMaterial = new Material(new Vector4f(0.0f, 0.0f, 1.0f, 10.0f), reflectance); quadMesh.setMaterial(quadMaterial); GameItem quadGameItem = new GameItem(quadMesh); quadGameItem.setPosition(0, -1, 0); quadGameItem.setScale(2.5f); scene.setGameItems(new GameItem[]{cubeGameItem, quadGameItem}); // Setup Lights setupLights(); camera.getPosition().z = 2; hud = new Hud(""); }
public Hud(String statusText) throws Exception { this.statusTextItem = new TextItem(statusText, FONT_TEXTURE, FONT_COLS, FONT_ROWS); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
@Override public void init(Window window) throws Exception { renderer.init(window); scene = new Scene(); // Setup GameItems float reflectance = 0.65f; Texture normalMap = new Texture("/textures/rock_normals.png"); Mesh quadMesh1 = OBJLoader.loadMesh("/models/quad.obj"); Texture texture = new Texture("/textures/rock.png"); Material quadMaterial1 = new Material(texture, reflectance); quadMesh1.setMaterial(quadMaterial1); GameItem quadGameItem1 = new GameItem(quadMesh1); quadGameItem1.setPosition(-3f, 0, 0); quadGameItem1.setScale(2.0f); quadGameItem1.setRotation(90, 0, 0); Mesh quadMesh2 = OBJLoader.loadMesh("/models/quad.obj"); Material quadMaterial2 = new Material(texture, reflectance); quadMaterial2.setNormalMap(normalMap); quadMesh2.setMaterial(quadMaterial2); GameItem quadGameItem2 = new GameItem(quadMesh2); quadGameItem2.setPosition(3f, 0, 0); quadGameItem2.setScale(2.0f); quadGameItem2.setRotation(90, 0, 0); scene.setGameItems(new GameItem[]{quadGameItem1, quadGameItem2}); // Setup Lights setupLights(); camera.getPosition().y = 5.0f; camera.getRotation().x = 90; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(1, 1, 1, 1)); // Create compass Mesh mesh = OBJLoader.loadMesh("/models/compass.obj"); Material material = new Material(); material.setAmbientColour(new Vector4f(1, 0, 0, 1)); mesh.setMaterial(material); compassItem = new GameItem(mesh); compassItem.setScale(40.0f); // Rotate to transform it to screen coordinates compassItem.setRotation(0f, 0f, 180f); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem, compassItem}; }
@Override public void init(Window window) throws Exception { renderer.init(window); float reflectance = 1f; //Mesh mesh = OBJLoader.loadMesh("/models/bunny.obj"); //Material material = new Material(new Vector3f(0.2f, 0.5f, 0.5f), reflectance); Mesh mesh = OBJLoader.loadMesh("/models/cube.obj"); Texture texture = new Texture("/textures/grassblock.png"); Material material = new Material(texture, reflectance); mesh.setMaterial(material); GameItem gameItem = new GameItem(mesh); gameItem.setScale(0.5f); gameItem.setPosition(0, 0, -2); gameItems = new GameItem[]{gameItem}; ambientLight = new Vector3f(0.3f, 0.3f, 0.3f); Vector3f lightColour = new Vector3f(1, 1, 1); Vector3f lightPosition = new Vector3f(0, 0, 1); float lightIntensity = 1.0f; pointLight = new PointLight(lightColour, lightPosition, lightIntensity); PointLight.Attenuation att = new PointLight.Attenuation(0.0f, 0.0f, 1.0f); pointLight.setAttenuation(att); }