Example #1
0
def frag_shader(gs_out: GsOut) -> FsOut:
    color = vec4((gs_out.normal.x + 1.0) * 0.5, (gs_out.normal.y + 1.0) * 0.5,
                 (gs_out.normal.z + 1.0) * 0.5, 1.0)

    # Adapted from
    # http://strattonbrazil.blogspot.com/2011/09/single-pass-wireframe-rendering_10.html
    nearest = float(
        min(min(gs_out.altitudes[0], gs_out.altitudes[1]),
            gs_out.altitudes[2]))
    edge_intensity = float(1.0 - exp2(-1.0 * nearest * nearest))

    color *= edge_intensity

    # TODO, dijkstra viz hack
    dista = float(gs_out.color[0])

    if dista < 0:
        color *= vec4(0.3, 0.3, 0.3, 1.0)
    else:
        # color[0] = dista;
        rep = float(0.1)
        fac = float(1.0 / rep)
        color[0] = pow(mod(gs_out.color[0], rep) * fac, 4)

    return FsOut(fs_color=color)
Example #2
0
def frag_shader(gs_out: GsOut) -> FsOut:
    color = vec4((gs_out.normal.x + 1.0) * 0.5,
                 (gs_out.normal.y + 1.0) * 0.5,
                 (gs_out.normal.z + 1.0) * 0.5,
                 1.0)

    # Adapted from
    # http://strattonbrazil.blogspot.com/2011/09/single-pass-wireframe-rendering_10.html
    nearest = float(min(min(gs_out.altitudes[0], gs_out.altitudes[1]),
                        gs_out.altitudes[2]))
    edge_intensity = float(1.0 - exp2(-1.0 * nearest * nearest))

    color *= edge_intensity

    # TODO, dijkstra viz hack
    dista = float(gs_out.color[0])

    if dista < 0:
        color *= vec4(0.3, 0.3, 0.3, 1.0)
    else:
        # color[0] = dista;
        rep = float(0.1)
        fac = float(1.0 / rep)
        color[0] = pow(mod(gs_out.color[0], rep) * fac, 4)

    return FsOut(fs_color=color)
Example #3
0
def frag_shader() -> FsOut:
    return FsOut(color=vec4(1.0, 0.0, 0.0, 1.0))
Example #4
0
def vert_shader(attr: VsIn) -> VsOut:
    return VsOut(gl_position=vec4(-attr.position.x, attr.position.y, 1.0, 1.0))
Example #5
0
 class MyBlock(ShaderInterface):
     var = vec4(noperspective)
Example #6
0
 class MyBlock2(UniformBlock):
     var = vec4()
Example #7
0
def perspective_projection(projection: mat4, camera: mat4,
                           model: mat4, point: vec3) -> vec4:
    return projection * camera * model * vec4(point, 1.0)
Example #8
0
 def frag_shader(self) -> 'MyMaterial.FsOut':
     return MyMaterial.FsOut(color=vec4(1.0, 0.0, 0.0, 1.0))
Example #9
0
class GlGsIn(ShaderInterface):
    gl_position = vec4()
Example #10
0
class FsOut(FragmentShaderOutputBlock):
    fs_color = vec4()
Example #11
0
def perspective_projection(projection: mat4, camera: mat4, model: mat4,
                           point: vec3) -> vec4:
    return projection * camera * model * vec4(point, 1.0)
Example #12
0
class GsOut(ShaderInterface):
    gl_position = vec4()
    altitudes = vec3(noperspective)
    normal = vec3()
    color = vec4()
Example #13
0
class VsOut(ShaderInterface):
    gl_position = vec4()
    normal = vec3()
    color = vec4()
Example #14
0
class VertAttrs(AttributeBlock):
    vert_loc = vec3()
    vert_nor = vec3()
    vert_col = vec4()
Example #15
0
 def frag_shader(self) -> 'MyMaterial.FsOut':
     return MyMaterial.FsOut(color=vec4(1.0, 0.0, 0.0, 1.0))
Example #16
0
 class FsOut(ShaderInterface):
     color = vec4()