예제 #1
0
def node_factory(request) -> Tuple[type, dict]:
    name, cls = request.param
    params = {}
    if name == "DrawNode":
        params = {"window": N.Window().window, "shader": mock_shader()}
    elif name == "GeometryController":
        params = {"shader": N.Shader().shader, "window_size": N.Window().size}
    elif name == "SampleManager":
        params = {"sampler": MagicMock()}
    return cls, params
예제 #2
0
def add_default_nodes(g: RenderGraph, bpm=120):
    g.add_node(N.Window(), name="window")
    g.add_node(
        N.BpmClock(bpm=bpm),
        name="bpm_clock",
    )
    return g
예제 #3
0
def simple_gan_setup(model_type="biggan-deep-128"):
    g = RenderGraph()
    g.add_node(N.Window(), name="window")
    g.add_node(
        N.BpmClock(bpm=120),
        name="bpm_clock",
    )
    g.add_node(N.ClassPool(), name="class_pool")
    g.add_node(
        N.ClassSampler(class_pool=g["class_pool"].output_class_pool),
        name="class_sampler",
    )
    g.add_node(
        N.SampleManager(
            time=g["bpm_clock"].local_time,
            sampler=g["class_sampler"].sampler,
        ),
        name="class",
    )
    g.add_node(
        N.Biggan(
            class_vector=g["class"].vector0,
            model_type=model_type,
        ),
        name="biggan",
    )
    g.add_node(
        N.Shader(),
        name="shader",
    )
    g.add_node(
        N.GeometryController(
            shader=g["shader"].shader,
            texture=g["biggan"].image,
            window_size=g["window"].size,
        ),
        name="geo",
    )

    g.add_node(
        N.DrawNode(faces=g["geo"].faces,
                   shader=g["shader"].shader,
                   window=g["window"].window),
        name="draw",
    )
    g.set_draw_node("draw")
    return g
예제 #4
0
def debug_graph():
    g = RenderGraph()
    g["window"] = N.Window()
    g["bpm_clock"] = N.BpmClock(bpm=30)
    g["white"] = N.ColorToImage(color=(1, 1, 1))
    g["black"] = N.ColorToImage(color=(0, 0, 0))
    g["output_color"] = N.Interpolate(
        interpolation_value=g["bpm_clock"].local_time,
        input_vector0=g["white"].image,
        input_vector1=g["black"].image,
    )
    g["shader"] = N.Shader()
    g["geo"] = N.GeometryController(
        shader=g["shader"].shader,
        texture=g["output_color"].result,
        mesh="quad",
        window_size=g["window"].size,
    )
    g["draw"] = N.DrawNode(faces=g["geo"].faces,
                           shader=g["shader"].shader,
                           window=g["window"].window)
    g.set_draw_node("draw")
    return g