-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
58 lines (47 loc) · 1.38 KB
/
main.py
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
55
56
57
58
from OpenGL.GL import *
from cubemap.cubemap import Cubemap
from sphere.sphere import Sphere
from water.water import Water
from pool.pool import Pool
from window import Window
import callbacks as call
import camera
import glm
LIGHT_POSITION = glm.vec3(-3.0, 3.0, 3.0)
def main():
window = Window(width=camera.width,
height=camera.height,
title='Shallow')
window.set_callbacks()
window.set_cursor()
pool = Pool()
water = Water()
sphere = Sphere()
cubemap = Cubemap()
# Options:
glViewport(0, 0, camera.width, camera.height)
glEnable(GL_MULTISAMPLE)
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LESS)
glFrontFace(GL_CCW)
# DEBUG
# glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
while window.isOpen():
# Check if any events have been activated:
call.poll_events(window.window)
# Render
# |-------------| <- background color
glClearColor(0.0, 0.0, 0.0, 1.0)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
# --- Draw ---
pool.draw(LIGHT_POSITION)
sphere.draw(LIGHT_POSITION)
water.draw(camera.position,
cubemap.id)
if call.skybox:
cubemap.draw()
# ------------
window.update()
del window, pool, water, sphere, cubemap
if __name__ == "__main__":
main()