Skip to content

Commit

Permalink
Modified various textures
Browse files Browse the repository at this point in the history
  • Loading branch information
YousefKart committed Mar 28, 2023
1 parent aca9b81 commit 03c9b70
Show file tree
Hide file tree
Showing 13 changed files with 116 additions and 136 deletions.
36 changes: 1 addition & 35 deletions objects/emptyroom.mtl
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,9 @@
newmtl Material.013
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.479768 0.619469 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Bump -bm 1.000000 Tiles29_NRM_3K.jpg

newmtl Material.014
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.510093 0.616853 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Bump -bm 1.000000 Tiles29_NRM_3K.jpg

newmtl Material.015
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Kd 0.421705 0.469708 0.548851
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Bump -bm 1.000000 Tiles29_NRM_3K.jpg

newmtl Material.016
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 DrywallPopcornTexture001_COL_VAR1_3K.jpg
map_Bump -bm 1.000000 DrywallPopcornTexture001_NRM_3K.jpg
map_Kd images/walls.jpg
12 changes: 12 additions & 0 deletions objects/floor.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
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/floor.jpg
18 changes: 18 additions & 0 deletions objects/floor.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Blender 3.4.1
# www.blender.org
mtllib floor.mtl
g Plane.001_Mesh
v -8.169656 -1.545984 9.487365
v 4.913880 -1.545984 9.487365
v -8.169656 -1.545984 -10.168003
v 4.913880 -1.545984 -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.001_Material
usemtl Material
f 2/2/1 3/3/1 1/1/1
f 2/2/1 4/4/1 3/3/1
12 changes: 1 addition & 11 deletions objects/hightable.mtl
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Blender 3.4.1 MTL File: 'hightable.blend'
# www.blender.org

newmtl Material.005
Ns 250.000000
Ka 0.300000 0.300000 0.300000
Kd 0.504844 0.527711 0.373799
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 3

newmtl Material.007
Ns 250.000000
Ka 1.000000 1.000000 1.000000
Expand All @@ -19,4 +9,4 @@ Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd wood.jpg
map_Kd images/wood.jpg
Binary file removed objects/images/Tiles29_COL_VAR1_3K.jpg
Binary file not shown.
Binary file removed objects/images/Tiles29_NRM_3K.jpg
Binary file not shown.
Binary file removed objects/images/WoodQuarteredChiffon001_COL_3K.jpg
Binary file not shown.
Binary file modified objects/images/collision.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added objects/images/floor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added objects/images/walls.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 55 additions & 59 deletions src/Controls.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,57 @@ public void setCursorVisible(JFrame frame, boolean visible) {
}
}

private void pickObject() {
PickTool pickTool = new PickTool(EscapeRoom.sceneBG);
pickTool.setMode(PickTool.GEOMETRY);

int x = canvas.getWidth()/2;
int y = canvas.getHeight()/2; // mouse coordinates
Point3d point3d = new Point3d(), center = new Point3d();
canvas.getPixelLocationInImagePlate(x, y, point3d);// obtain AWT pixel in ImagePlate coordinates
canvas.getCenterEyeInImagePlate(center); // obtain eye's position in IP coordinates

Transform3D transform3D = new Transform3D(); // matrix to relate ImagePlate coordinates~
canvas.getImagePlateToVworld(transform3D); // to Virtual World coordinates
transform3D.transform(point3d); // transform 'point3d' with 'transform3D'
transform3D.transform(center); // transform 'center' with 'transform3D'

Vector3d mouseVec = new Vector3d();
mouseVec.sub(point3d, center);
mouseVec.normalize();
pickTool.setShapeRay(point3d, mouseVec); // send a PickRay for intersection

if (pickTool.pickClosest() != null) {
TransformGroup clickTG = (TransformGroup)pickTool.pickClosest().getNode(PickResult.SHAPE3D).getParent().getParent();

if(clickTG.getName().charAt(0) == '+')
focus(clickTG);
else if(clickTG.getName().charAt(0) == '-')
unfocus(clickTG);

System.out.println(clickTG.getName()); // For debug purposes
}
}

private void focus(TransformGroup focusTG) {
focusedGroup = focusTG;
Transform3D popup = new Transform3D();
popup.setTranslation(new Vector3d(centerPoint.x*0.1, centerPoint.y*0.1, centerPoint.z*0.1));
popup.setRotation(new AxisAngle4d(0, 1, 0, Math.PI - Math.toRadians(Controls.direction())));
popup.setScale(((Transform3D)focusTG.getUserData()).getScale());

focusTG.setTransform(popup);
focusTG.setName("-"+focusTG.getName().substring(1));
EscapeRoom.gameState = EscapeRoom.GameState.FOCUSED;
}

private void unfocus(TransformGroup focusTG) {
focusTG.setTransform((Transform3D)focusTG.getUserData());
focusTG.setName("+"+focusTG.getName().substring(1));
resetMouse();
EscapeRoom.gameState = EscapeRoom.GameState.PLAYING;
}

@Override
public void mouseMoved(MouseEvent e) {
if (!escapeRoom.isPlaying()) {
Expand Down Expand Up @@ -287,74 +338,19 @@ public void keyReleased(KeyEvent e) {
@Override
public void keyTyped(KeyEvent e) {}

private void pickObject() {
PickTool pickTool = new PickTool(EscapeRoom.sceneBG);
pickTool.setMode(PickTool.GEOMETRY);

int x = canvas.getWidth()/2;
int y = canvas.getHeight()/2; // mouse coordinates
Point3d point3d = new Point3d(), center = new Point3d();
canvas.getPixelLocationInImagePlate(x, y, point3d);// obtain AWT pixel in ImagePlate coordinates
canvas.getCenterEyeInImagePlate(center); // obtain eye's position in IP coordinates

Transform3D transform3D = new Transform3D(); // matrix to relate ImagePlate coordinates~
canvas.getImagePlateToVworld(transform3D); // to Virtual World coordinates
transform3D.transform(point3d); // transform 'point3d' with 'transform3D'
transform3D.transform(center); // transform 'center' with 'transform3D'

Vector3d mouseVec = new Vector3d();
mouseVec.sub(point3d, center);
mouseVec.normalize();
pickTool.setShapeRay(point3d, mouseVec); // send a PickRay for intersection

if (pickTool.pickClosest() != null) {
TransformGroup clickTG = (TransformGroup)pickTool.pickClosest().getNode(PickResult.SHAPE3D).getParent().getParent();

if(clickTG.getName().charAt(0) == '+')
focus(clickTG);
else if(clickTG.getName().charAt(0) == '-')
unfocus(clickTG);

System.out.println(clickTG.getName()); // For debug purposes
}
}

private void focus(TransformGroup focusTG) {
focusedGroup = focusTG;
Transform3D popup = new Transform3D();
popup.setTranslation(new Vector3d(centerPoint.x*0.1, centerPoint.y*0.1, centerPoint.z*0.1));
popup.setRotation(new AxisAngle4d(0, 1, 0, Math.PI - Math.toRadians(Controls.direction())));
popup.setScale(((Transform3D)focusTG.getUserData()).getScale());

focusTG.setTransform(popup);
focusTG.setName("-"+focusTG.getName().substring(1));
EscapeRoom.gameState = EscapeRoom.GameState.FOCUSED;
}

private void unfocus(TransformGroup focusTG) {
focusTG.setTransform((Transform3D)focusTG.getUserData());
focusTG.setName("+"+focusTG.getName().substring(1));
resetMouse();
EscapeRoom.gameState = EscapeRoom.GameState.PLAYING;
}

@Override
public void mouseClicked(MouseEvent e) {}

@Override
public void mousePressed(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {}

@Override
public void mouseReleased(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {}

@Override
public void mouseEntered(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {}

@Override
public void mouseExited(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {}

}
2 changes: 1 addition & 1 deletion src/LoadObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static BranchGroup loadObject(String objName) {
e.printStackTrace();
}

for (int i = 0; i < objGroup.numChildren(); i++) {
for (int i = objGroup.numChildren()-1; i >= 0; i--) {
Shape3D shape = (Shape3D) objGroup.getChild(i);
shape.setAppearance(obj_Appearance(objName));
}
Expand Down
58 changes: 28 additions & 30 deletions src/createObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static BranchGroup room() {
1.122));

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

Expand All @@ -59,35 +60,32 @@ public static BranchGroup room() {
roomBG.addChild(createObject("@doorKnob2", new AxisAngle4d(0, 0, 0, 0),
new Vector3d(-0.153, -0.045, -0.352), 0.36));

roomBG.addChild(createObject("!whiteboard", new AxisAngle4d(0, 0, 0, 0),
roomBG.addChild(createObject("+whiteboard", new AxisAngle4d(0, 0, 0, 0),
new Vector3d(-0.1, 0.04, -0.348), 0.344));
roomBG.addChild(createObject("!whiteboardFrame", new AxisAngle4d(0, 0, 0, 0),
roomBG.addChild(createObject("+whiteboardFrame", new AxisAngle4d(0, 0, 0, 0),
new Vector3d(-0.1, 0.04, -0.355), 0.35));

roomBG.addChild(createObject("!whiteboardHolder", new AxisAngle4d(0, 0, 0, 0),
roomBG.addChild(createObject("+whiteboardHolder", new AxisAngle4d(0, 0, 0, 0),
new Vector3d(-0.095, -0.042, -0.343), 0.35));
roomBG.addChild(createObject("+couch", new AxisAngle4d(0, -1, 0, Math.PI / 2),

roomBG.addChild(createObject("!couch", new AxisAngle4d(0, -1, 0, Math.PI / 2),
new Vector3d(0.05, -0.103, -0.648), 0.05));
roomBG.addChild(createObject("+couch", new AxisAngle4d(0, -1, 0, Math.PI / 2),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, -1, 0, Math.PI / 2),
new Vector3d(0.15, -0.103, -0.648), 0.05));
roomBG.addChild(createObject("+couch", new AxisAngle4d(0, -1, 0, Math.PI / 2),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, -1, 0, Math.PI / 2),
new Vector3d(0.25, -0.103, -0.648), 0.05));

roomBG.addChild(createObject("+couch", new AxisAngle4d(0, 1, 0, Math.PI),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, 1, 0, Math.PI),
new Vector3d(0.382, -0.103, -0.62), 0.05));
roomBG.addChild(createObject("+couch", new AxisAngle4d(0, 1, 0, Math.PI),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, 1, 0, Math.PI),
new Vector3d(0.382, -0.103, -0.52), 0.05));

roomBG.addChild(createObject("+couch", new AxisAngle4d(0, 1, 0, Math.PI),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, 1, 0, Math.PI),
new Vector3d(-0.01, -0.103, 0.844), 0.05));
roomBG.addChild(createObject("+couch", new AxisAngle4d(0, 1, 0, Math.PI / 2),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, 1, 0, Math.PI / 2),
new Vector3d(-0.13, -0.103, 0.884), 0.05));
roomBG.addChild(createObject("+couch", new AxisAngle4d(0, 1, 0, Math.PI / 2),
roomBG.addChild(createObject("!couch", new AxisAngle4d(0, 1, 0, Math.PI / 2),
new Vector3d(-0.23, -0.103, 0.884), 0.05));

roomBG.addChild(createObject("!whiteboard", new AxisAngle4d(0, 0, 0, 0),
new Vector3d(-0.1, 0.04, -0.35), 0.35));

roomBG.addChild(bins(0, 0, 0));
roomBG.addChild(tvs(0, 0, 0));
roomBG.addChild(computers(0, 0, 0));
Expand Down Expand Up @@ -284,39 +282,39 @@ public static BranchGroup highStuff(double x, double y, double z) {
public static BranchGroup middleStuff(double x, double y, double z) {
BranchGroup BG = new BranchGroup();

BG.addChild(createObject("+middletable", new AxisAngle4d(0, 1, 0, Math.PI / 2),
BG.addChild(createObject("!middletable", new AxisAngle4d(0, 1, 0, Math.PI / 2),
new Vector3d(0.16 + x, -0.10 + y, -0.2 + z), 0.06));
BG.addChild(createObject("+middletable", new AxisAngle4d(0, 1, 0, Math.PI / 2),
BG.addChild(createObject("!middletable", new AxisAngle4d(0, 1, 0, Math.PI / 2),
new Vector3d(0.16 + x, -0.10 + y, 0.125 + z), 0.06));
BG.addChild(createObject("+middletable", new AxisAngle4d(0, 1, 0, Math.PI / 2),
BG.addChild(createObject("!middletable", new AxisAngle4d(0, 1, 0, Math.PI / 2),
new Vector3d(0.16 + x, -0.10 + y, 0.45 + z), 0.06));

BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * .90),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * .90),
new Vector3d(0.17 + x, -0.09 + y, -0.16 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * .90),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * .90),
new Vector3d(0.17 + x, -0.09 + y, 0.165 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * .90),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * .90),
new Vector3d(0.17 + x, -0.09 + y, 0.49 + z), 0.07));

BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI / 2 * .80),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI / 2 * .80),
new Vector3d(0.13 + x, -0.09 + y, -0.19 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI / 2 * .80),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI / 2 * .80),
new Vector3d(0.13 + x, -0.09 + y, 0.135 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI / 2 * .80),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI / 2 * .80),
new Vector3d(0.13 + x, -0.09 + y, 0.46 + z), 0.07));

BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.90),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.90),
new Vector3d(0.15 + x, -0.09 + y, -0.23 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.90),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.90),
new Vector3d(0.15 + x, -0.09 + y, 0.095 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.90),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.90),
new Vector3d(0.15 + x, -0.09 + y, 0.42 + z), 0.07));

BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.40),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.40),
new Vector3d(0.20 + x, -0.09 + y, -0.21 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.40),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.40),
new Vector3d(0.20 + x, -0.09 + y, 0.115 + z), 0.07));
BG.addChild(createObject("+middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.40),
BG.addChild(createObject("!middlechair", new AxisAngle4d(0, 1, 0, Math.PI * 1.40),
new Vector3d(0.20 + x, -0.09 + y, 0.44 + z), 0.07));

return BG;
Expand Down

0 comments on commit 03c9b70

Please sign in to comment.