MCPcopy Create free account
hub / github.com/vispy/vispy / test_example1

Function test_example1

vispy/visuals/shaders/tests/test_function.py:57–82  ·  view source on GitHub ↗

Just a few simple compositions.

()

Source from the content-addressed store, hash-verified

55# Examples
56
57def test_example1():
58 """Just a few simple compositions."""
59 # Get function objects. Generate random name for transforms
60 code = Function(vert_template)
61 t1 = Function(transformScale)
62 t2 = Function(transformZOffset)
63 t3 = Function(transformScale)
64
65 # We need to create a variable in order to use it in two places
66 pos = Variable('attribute vec4 a_position')
67
68 # Compose everything together
69 code['position'] = t1(t2(pos))
70 code['correction'] = t1(pos) # Look, we use t1 again, different sig
71 code['endtransform'] = t3 # function pointer rather than function call
72 code['nlights'] = '4'
73 t1['scale'] = t2
74 t3['scale'] = (3.0, 4.0, 5.0)
75 t2['offset'] = '1.0'
76
77 code2 = Function(frag_template)
78 code2['color'] = Varying('v_position')
79
80 code['gl_PointSize'] = '3.0'
81 code[code2['color']] = pos
82 print(code)
83
84
85def test_example2():

Callers 1

test_function.pyFile · 0.85

Calls 3

FunctionClass · 0.90
VariableClass · 0.90
VaryingClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…