-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain2.py
More file actions
44 lines (31 loc) · 1.71 KB
/
Copy pathmain2.py
File metadata and controls
44 lines (31 loc) · 1.71 KB
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
44
from TestPrograms.rit_window import *
from cgI_engine import *
from vertex import *
from clipper import *
from shapes2025 import *
import numpy as np
def default_action (win):
# clear the FB
win.clearFB (0, 0, 0)
myEngine.clearZBuffer (win)
myEngine.defineViewWindow (800, 0, 800, 0)
viewT = myEngine.identity3D()
projectionT = myEngine.ortho3D (-4.0, 4.0, -4.0, 4.0, 4.0, 8.0)
# draw a cube
modelT = myEngine.translate3D (-2.0, 1.5, -6.0) * myEngine.rotateZ (-30.0) * myEngine.rotateY (-15.0) * myEngine.rotateX (-30.0) * myEngine.scale3D (1.5, 1.5, 1.5)
myEngine.drawTriangles3D (win, cube, cube_idx, cube_color, modelT, viewT, projectionT)
# draw a cylinder
modelT = myEngine.translate3D (2.0, 1.5, -6.0) * myEngine.rotateZ (-30.0) * myEngine.rotateY (-15.0) * myEngine.rotateX (-30.0) * myEngine.scale3D (1.5, 1.5, 1.5)
myEngine.drawTriangles3D (win, cylinder, cylinder_idx, cylinder_color, modelT, viewT, projectionT)
# draw a sphere
modelT = myEngine.translate3D (-2.0, -1.5, -6.0) * myEngine.rotateZ (-30.0) * myEngine.rotateY (-15.0) * myEngine.rotateX (-30.0) * myEngine.scale3D (2.0, 2.0, 2.0)
myEngine.drawTriangles3D (win, sphere, sphere_idx, sphere_color, modelT, viewT, projectionT)
# draw a cone
modelT = myEngine.translate3D (2.0, -1.5, -6.0) * myEngine.rotateZ (-30.0) * myEngine.rotateY (-15.0) * myEngine.rotateX (-30.0) * myEngine.scale3D (1.5, 1.5, 1.5)
myEngine.drawTriangles3D (win, cone, cone_idx, cone_color, modelT, viewT, projectionT)
myEngine = CGIengine()
def main():
win = RitWindow(800, 800, "CSCI 610 - Assignment 7 - 3D Objects")
win.doRun (default_action)
if __name__ == "__main__":
main()