-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.py
39 lines (29 loc) · 916 Bytes
/
simple.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
from pyglet.graphics.shader import Shader, ShaderProgram
from pyglet.math import Vec3
import pyglet
from sombra_engine.camera import FPSCamera
from sombra_engine.models.obj import OBJLoader
window = pyglet.window.Window()
camera = FPSCamera(
window, position=Vec3(0.0, 0.0, -15.0), pitch=90, yaw=90
)
batch = pyglet.graphics.Batch()
model = None
@window.event
def on_draw():
window.clear()
batch.draw()
def main():
global model
with open('sombra_engine/shaders/default.vert') as f:
vs = Shader(f.read(), 'vertex')
with open('sombra_engine/shaders/solid.frag') as f:
fs = Shader(f.read(), 'fragment')
shader_program = ShaderProgram(vs, fs)
model = OBJLoader.load(
#"tests/data/shoe_box2.obj", "house", shader_program, batch
"tests/data/cube.obj", "house", shader_program, batch
)
pyglet.app.run()
if __name__ == '__main__':
main()