Exemplo n.º 1
0
 def test_prt(self):
     self.eqcode(PRT, cdecorator.transpile(prt))
Exemplo n.º 2
0
 def test_two(self):
     self.eqcode(TWO_ARGS, cdecorator.transpile(two_args))
Exemplo n.º 3
0
 def test_vertex(self):
     self.eqcode(VERTEX, cdecorator.transpile(vertex))
Exemplo n.º 4
0
 def test_fragment(self):
     self.eqcode(FRAGMENT, cdecorator.transpile(fragment))
Exemplo n.º 5
0
 def test_vars(self):
     self.eqcode(VARS, cdecorator.transpile(vars_))
Exemplo n.º 6
0
 def test_fun(self):
     self.eqcode(FUN, cdecorator.transpile(fun))
Exemplo n.º 7
0
 def test_var(self):
     self.eqcode(VAR, cdecorator.transpile(var))
Exemplo n.º 8
0
 def test_varass(self):
     self.eqcode(VARASS, cdecorator.transpile(varass))
Exemplo n.º 9
0
 def test_call(self):
     self.eqcode(CALL, cdecorator.transpile(call))
Exemplo n.º 10
0
 def test_include(self):
     self.eqcode(INCLUDE, cdecorator.transpile(include))
Exemplo n.º 11
0
 def test_transformers(self):
     self.eqcode(TRANSFORMERS, cdecorator.transpile(transformers))
Exemplo n.º 12
0
 def test_math(self):
     self.eqcode(MATH, cdecorator.transpile(math))
Exemplo n.º 13
0
    v_size = 512.0 * p.x / p.w;
    gl_PointSize = v_size + 5.0;
}
"""
def transformers():
    light_position : uniform[vec3]
    position : attribute[vec3]
    color : attribute[vec3]
    radius : attribute[float]

    v_size : varying[float]
    v_color : varying[vec3]
    v_radius : varying[float]
    v_eye_position : varying[vec4]
    v_light_direction : varying[vec3]

    def main(void) -> void:
        v_color = color
        v_radius = radius
        v_eye_position = _(transform.trackball_view)  * _(transform.trackball_model) * vec4(position, 1.0)
        v_light_direction = normalize(light_position)
        gl_Position = _(transform(position))

        p : vec4 = _(transform.trackball_projection) * vec4(radius, radius, v_eye_position.z, v_eye_position.w)
        v_size = 512.0 * p.x / p.w
        gl_PointSize = v_size + 5.0



print(cdecorator.transpile(transformers))