-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scene.t
34 lines (27 loc) · 787 Bytes
/
Scene.t
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
local std = require "util/std"
local glm = require "util/glm"
local RBTree = require "util/RBTree"
local Mesh = require "Mesh"
local struct Scene(std.Object) {
backgroundColor: glm.vec4
objects: std.Vector(&Mesh)
}
terra Scene.methods.create()
return Scene {
backgroundColor = glm.vec4.create(0.0, 0.0, 0.0, 0.0);
objects = [std.Vector(&Mesh)].create();
}
end
terra Scene:setBackgroundColor(col: glm.vec4): {}
self.backgroundColor = col
end
terra Scene:setBackgroundColor(col: glm.vec3): {}
self:setBackgroundColor(glm.vec4.create(col, 1.0))
end
terra Scene:addObject(obj: &Mesh)
return self.objects:insert(obj)
end
terra Scene:get(i:uint)
return self.objects:get(i)
end
return Scene