Skip to content

Commit

Permalink
Added error
Browse files Browse the repository at this point in the history
  • Loading branch information
YousefKart committed Mar 27, 2023
1 parent f6307c4 commit 9f4bd8b
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 15 deletions.
12 changes: 12 additions & 0 deletions objects/ceiling.mtl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Blender 3.4.1 MTL File: 'Escape Java.blend'
# www.blender.org

newmtl Material.032
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd images/ceiling.jpg
18 changes: 18 additions & 0 deletions objects/ceiling.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Blender 3.4.1
# www.blender.org
mtllib ceiling.mtl
g Plane_Mesh
v -8.169656 0.910610 9.487365
v 4.913880 0.910610 9.487365
v -8.169656 0.910610 -10.168003
v 4.913880 0.910610 -10.168003
vn -0.0000 -1.0000 -0.0000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 1.000000 1.000000
s 0
g Plane_Material.032
usemtl Material.032
f 3/3/1 2/2/1 1/1/1
f 3/3/1 4/4/1 2/2/1
Binary file added objects/images/ceiling.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/Controls.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ private void move(int xAxis, int zAxis) {
}

escapeRoom.updateViewer();

System.out.println("x - "+camera.x);
System.out.println("y - "+camera.y);
System.out.println("z - "+camera.z);

}

private void turn(boolean verticalAxis, int magnitude) {
Expand Down
20 changes: 10 additions & 10 deletions src/EscapeRoom.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,18 @@ public void updateViewer() {
viewTransform.setTransform(viewTM);
}

public BranchGroup addLights(Color3f clr, int p_num) {
public BranchGroup addLights(Color3f clr) {
BranchGroup lightBG = new BranchGroup();
Point3f atn = new Point3f(0.5f, 0.0f, 0.0f);
PointLight ptLight;
float adjt = 1f;
for (int i = 0; (i < p_num) && (i < 2); i++) {
if (i > 0)
adjt = -1f;
ptLight = new PointLight(clr, new Point3f(3.0f * adjt, 1.0f, 3.0f * adjt), atn);
ptLight.setInfluencingBounds(hundredBS);
lightBG.addChild(ptLight);
}

for(int i = 0; i < 2; i++)
for (int j = 0; j < 4; j++) {
ptLight = new PointLight(clr, new Point3f(-2+i*4, 5, -4+j*2.5f), atn);
ptLight.setInfluencingBounds(hundredBS);
lightBG.addChild(ptLight);
}

return lightBG;
}

Expand All @@ -118,7 +118,7 @@ public BranchGroup createScene() {

scaleTG.addChild(createObjects.room());
sceneBG.addChild(scaleTG);
sceneBG.addChild(addLights(new Color3f(0.6f, 0.6f, 0.6f), 1));
sceneBG.addChild(addLights(new Color3f(0.1f, 0.1f, 0.1f)));
sceneBG.addChild(Sounds.bkgdSound());

return sceneBG;
Expand Down
5 changes: 1 addition & 4 deletions src/MTLFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,9 @@ public MTLFile(String fileName) {
private static Texture getTexture(String fileName) {
TextureLoader loader = new TextureLoader("objects/"+fileName, null);
ImageComponent2D image = loader.getImage(); // load the image
if (image == null)
System.out.println("Cannot load file: " + fileName);

Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight());
texture.setImage(0, image); // set image for the texture

texture.setImage(0, image); // set image for the texture
return texture;
}
}
3 changes: 2 additions & 1 deletion src/createObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static BranchGroup room() {
* + Focusable (eg. clues, puzzles)
* - Focused (shouldn't be used here)
* ! Immovable (eg. room, windows)
*
* @ Interactable (eg. door, trash bin)
* # Equipable (eg. key, tool)
*
Expand All @@ -45,7 +44,9 @@ public static BranchGroup room() {

roomBG.addChild(createObject("!emptyroom", new AxisAngle4d(0, 0, 0, 0), new Vector3d(-0.007, 0, 0.122), 1.122));

roomBG.addChild(createObject("!ceiling", new AxisAngle4d(0, 0, 0, 0), new Vector3d(-0.007, 0, 0.122), 1.122));
roomBG.addChild(createObject("!windows", new AxisAngle4d(0, 0, 0, 0), new Vector3d(0.028, 0.04, 0.118), 0.82));

roomBG.addChild(createObject("@door1", new AxisAngle4d(0, 0, 0, 0), new Vector3d(-0.208, -0.02, 0.937), 0.22));
roomBG.addChild(createObject("@doorKnob1", new AxisAngle4d(0, 0, 0, 0), new Vector3d(-0.153, -0.045, 0.937), 0.18));
roomBG.addChild(createObject("@door2", new AxisAngle4d(0, 0, 0, 0), new Vector3d(-0.21, -0.022, -0.347), 0.36));
Expand Down

0 comments on commit 9f4bd8b

Please sign in to comment.