MCPcopy
hub / github.com/ManimCommunity/manim / construct

Method construct

example_scenes/opengl.py:367–396  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

365
366class NamedShaderExample(Scene):
367 def construct(self):
368 shader = Shader(self.renderer.context, "manim_coords")
369 shader.set_uniform("u_color", (0.0, 1.0, 0.0, 1.0))
370
371 view_matrix = self.camera.formatted_view_matrix
372 shader.set_uniform("u_model_view_matrix", view_matrix)
373 shader.set_uniform(
374 "u_projection_matrix",
375 opengl.perspective_projection_matrix(),
376 )
377 attributes = np.zeros(
378 6,
379 dtype=[
380 ("in_vert", np.float32, (4,)),
381 ],
382 )
383 attributes["in_vert"] = np.array(
384 [
385 [-1, -1, 0, 1],
386 [-1, 1, 0, 1],
387 [1, 1, 0, 1],
388 [-1, -1, 0, 1],
389 [1, -1, 0, 1],
390 [1, 1, 0, 1],
391 ],
392 )
393 mesh = Mesh(shader, attributes)
394 self.add(mesh)
395
396 self.wait(5)
397
398
399class InteractiveDevelopment(Scene):

Callers

nothing calls this directly

Calls 5

set_uniformMethod · 0.95
ShaderClass · 0.85
MeshClass · 0.85
waitMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected