Skip to content

Commit 9410c26

Browse files
committed
Include more docs in effect templates
1 parent db8dc7d commit 9410c26

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

demosys/effect_templates/cube_simple/dependencies.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55

66
def local(path):
7-
"""Get the effect package name"""
7+
"""
8+
Prepend the effect package name to a path so resources
9+
can still be loaded when copied into a new effect package.
10+
"""
811
return os.path.join(__name__.split('.')[-2], path)
912

1013

demosys/effect_templates/cube_simple/effects.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ class SimpleCubeEffect(effect.Effect):
88
runnable = True
99

1010
def __init__(self):
11+
# Obtain the shader program using its label
1112
self.program = self.get_program('cube_plain')
13+
# Create a 4x4x4 cube with center in (0, 0, 0)
1214
self.cube = geometry.cube(4.0, 4.0, 4.0)
1315

1416
def draw(self, time, frametime, target):
15-
self.ctx.enable(moderngl.DEPTH_TEST)
17+
# Enable depth testing and face fulling
18+
self.ctx.enable(moderngl.DEPTH_TEST | moderngl.CULL_FACE)
1619

17-
# Rotate and translate
20+
# Rotate and translate (modelview matrix)
1821
m_mv = self.create_transformation(rotation=(time * 1.2, time * 2.1, time * 0.25),
1922
translation=(0.0, 0.0, -8.0))
2023

21-
# Apply the rotation and translation from the system camera
24+
# Uncomment to Apply the rotation and translation from the system camera
2225
# m_mv = matrix44.multiply(m_mv, self.sys_camera.view_matrix)
2326

2427
# Create normal matrix from model-view
2528
m_normal = self.create_normal_matrix(m_mv)
2629

27-
# Draw the cube
30+
# Write to the shader programs uniforms
2831
self.program["m_proj"].write(self.sys_camera.projection.tobytes())
2932
self.program["m_mv"].write(m_mv.astype('f4').tobytes())
3033
self.program["m_normal"].write(m_normal.astype('f4').tobytes())
3134
self.program["time"].value = time
35+
36+
# Render the cube
3237
self.cube.render(self.program)

demosys/effect_templates/raymarching_simple/dependencies.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55

66
def local(path):
7-
"""Get the effect package name"""
7+
"""
8+
Prepend the effect package name to a path so resources
9+
can still be loaded when copied into a new effect package.
10+
"""
811
return os.path.join(__name__.split('.')[-2], path)
912

1013

demosys/project_template/project/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# Window / context properties
1818
WINDOW = {
19-
"class": "demosys.context.pyqt.GLFW_Window",
19+
"class": "demosys.context.pyqt.Window",
2020
"size": (1280, 720),
2121
"aspect_ratio": 16 / 9,
2222
"fullscreen": False,

0 commit comments

Comments
 (0)