-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObject3D.java
More file actions
43 lines (34 loc) · 1003 Bytes
/
Object3D.java
File metadata and controls
43 lines (34 loc) · 1003 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package world.objects;
import util.RenderingPipeline;
import util.Vec3;
import world.Triangle3D;
public class Object3D {
protected double size;
protected Vec3 position;
protected Vec3 orientation;
protected Triangle3D[] localSpaceTriangles;
public Object3D(Vec3 position, Vec3 orientation, double size) {
this.position = position;
this.orientation = orientation;
this.size = size;
this.initializeLocalSpaceTriangles();
}
public Object3D() {
this(new Vec3(0, 0, 0), new Vec3(0, 0, 0), 1);
}
protected void initializeLocalSpaceTriangles() {
this.localSpaceTriangles = new Triangle3D[0];
}
public Triangle3D[] getTriangles() {
return RenderingPipeline.transformLocalSpace(localSpaceTriangles, this);
}
public Vec3 getPosition() {
return position;
}
public Vec3 getOrientation() {
return orientation;
}
public double getSize() {
return size;
}
}