-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathparams.py
More file actions
47 lines (39 loc) · 1.48 KB
/
params.py
File metadata and controls
47 lines (39 loc) · 1.48 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
45
46
47
#
# This file consists all the parameters needed to describe the 3D world.
# Defined default values only
# Need to add setters in the later version
#
import numpy as np
import objlib
class Parameters:
def __init__(self):
# Width & height of the output image
self.width = 400
self.height = 300
# Parameters of the scene
self.color_plane0 = 1. * np.ones(3)
self.color_plane1 = 0. * np.ones(3)
self.scene = Scene()
self.scene.add_object(objlib.add_sphere([.75, .1, 1.], .6, [0., 0., 1.]))
self.scene.add_object(objlib.add_sphere([-.75, .1, 2.25], .6, [.5, .223, .5]))
self.scene.add_object(objlib.add_sphere([-2.75, .1, 3.5], .6, [1., .572, .184]))
self.scene.add_object(objlib.add_plane([0., -.5, 0.], [0., 1., 0.],self.color_plane0, self.color_plane1))
# Light info
self.Light = np.array([5., 5., -10.])
self.color_light = np.ones(3)
self.ambient = .05
self.diffuse_c = 1.
self.specular_c = 1.
self.specular_k = 50
self.depth_max = 5
# Camera location & direction
self.Camera = np.array([0., 0.35, -1.])
self.Camera_direction = np.array([0., 0., 0.])
# Screen coordinates: x0, y0, x1, y1.
r = float(self.width) / self.height
self.Screen = (-1., -1. / r + .25, 1., 1. / r + .25)
class Scene:
def __init__(self):
self.objs = []
def add_object(self, obj):
self.objs.append(obj)