Just a few simple compositions.
()
| 55 | # Examples |
| 56 | |
| 57 | def 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 | |
| 85 | def test_example2(): |
no test coverage detected
searching dependent graphs…