-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.rb
54 lines (46 loc) · 1.47 KB
/
Main.rb
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
48
49
50
51
52
53
54
require './CStack.rb'
require './Draw.rb'
require './Matrix.rb'
require './MatrixUtils.rb'
require './Utils.rb'
require './Screen.rb'
include Math
##TAU!!!!
$TAU = PI*2
# Changeable
$RESOLUTION = 500 # All images are squares
$DEBUGGING = false
$BACKGROUND_COLOR = [225, 225, 225] # [r, g, b]
$DRAW_COLOR = [200, 200, 200] # for 2D drawing
$INFILE = "script.mdl"
$OUTFILE = "image.ppm"
$TEMPFILE = "temmmmp.ppm" # Used as temp storage for displaying
$COMPYLED_CODE_LOC = "__COMPYLED_CODE__"
$OUTPUT_FOLDER = "anim/"
$OBJ_FOLDER = "obj/"
$STEP = 20 # Number of iterations needed to to finish a parametric
$FRAMES = nil
$BASENAME = nil
# Static
$SCREEN = Screen.new($RESOLUTION)
$COORDSYS = CStack.new()
$RC = $DRAW_COLOR[0]; $GC = $DRAW_COLOR[1]; $BC = $DRAW_COLOR[2]
$AMBIENT_LIGHT = [150, 150, 150] #[r, g, b] (Default, if unspecified in mdl)
$POINT_LIGHTS = []
$CONSTANTS = {}
$Ka = [0.3, 0.3, 0.3] #Constant of ambient (Default, if unspecified in mdl)
$Kd = [0.5, 0.5, 0.5] #Constant of diffuse (Default, if unspecified in mdl)
$Ks = [0.5, 0.5, 0.5] #Constant of specular (Default, if unspecified in mdl)
$VIEW = [0, 0, 1]
$ANIMATION = nil #Boolean representing whether output will be an animation (as opposed to a still image)
$KNOBFRAMES = nil
##=================== MAIN ==========================
### Take in script file
if ARGV[0]
$INFILE = ARGV[0]
else
puts "Please specify a file: (leave blank for \"script.mdl\")"
got = gets.chomp
$INFILE = got if got != ""
end
Utils.parse_file()