Postprocessing::Postprocessing(gloperate::ResourceManager & resourceManager, const reflectionzeug::Variant & pluginInfo)
: PipelinePainter("Postprocessing", resourceManager, pluginInfo, m_pipeline)
, m_animation(true)
{
    // Setup painter
    auto targetFBO = addCapability(new gloperate::TargetFramebufferCapability());
    auto viewport = addCapability(new gloperate::ViewportCapability());
    auto time = addCapability(new gloperate::VirtualTimeCapability());
    auto camera = addCapability(new gloperate::CameraCapability());
    auto projection = addCapability(new gloperate::PerspectiveProjectionCapability(viewport));
    auto renderTargets = addCapability(new gloperate::TypedRenderTargetCapability());

    m_pipeline.targetFBO.setData(targetFBO);
    m_pipeline.viewport.setData(viewport);
    m_pipeline.time.setData(time);
    m_pipeline.camera.setData(camera);
    m_pipeline.projection.setData(projection);
    m_pipeline.renderTargets.setData(renderTargets);

    targetFBO->changed.connect([this]() { m_pipeline.targetFBO.invalidate(); });
    viewport->changed.connect([this]() { m_pipeline.viewport.invalidate(); });
    time->changed.connect([this]() { m_pipeline.time.invalidate(); });
    
    projection->setZNear(0.1f);
    projection->setZFar(16.f);
    
    time->setLoopDuration(glm::pi<float>() * 2);

    // Register properties
    addProperty<bool>("Animation", this, &Postprocessing::animation, &Postprocessing::setAnimation);
}
Ejemplo n.º 2
0
TextRenderingPainter::TextRenderingPainter(gloperate::ResourceManager & resourceManager, const cpplocate::ModuleInfo & moduleInfo)
: PipelinePainter("TextRendering", resourceManager, moduleInfo, m_pipeline)
{
    // Setup painter
    auto targetFBO = addCapability(new gloperate::TargetFramebufferCapability());
    auto viewport = addCapability(new gloperate::ViewportCapability());
    auto time = addCapability(new gloperate::VirtualTimeCapability());

    m_pipeline.targetFBO.setData(targetFBO);
    m_pipeline.viewport.setData(viewport);
    m_pipeline.time.setData(time);
    m_pipeline.resourceManager.setData(&resourceManager);

    targetFBO->changed.connect([this]() { m_pipeline.targetFBO.invalidate(); });
    viewport->changed.connect([this]() { m_pipeline.viewport.invalidate(); });
    time->changed.connect([this]() { m_pipeline.time.invalidate(); });

    time->setLoopDuration(glm::pi<float>() * 2);

    reflectionzeug::PropertyGroup * fontLoading = addGroup("Font");
    fontLoading->addProperty(createProperty("Filename", m_pipeline.fontFilename));

    reflectionzeug::PropertyGroup * textGeneration = addGroup("Text");
    textGeneration->addProperty(createProperty("Algorithm", m_pipeline.textGenerationAlgorithm));
    textGeneration->addProperty(createProperty("StaticText", m_pipeline.staticText));
    textGeneration->addProperty(createProperty("Length", m_pipeline.length));
    //textGeneration->addProperty(createProperty("Encoding", m_pipeline.encoding));
    textGeneration->addProperty(createProperty("XRepeat", m_pipeline.xRepeat));
    textGeneration->addProperty(createProperty("YRepeat", m_pipeline.yRepeat));
    textGeneration->addProperty(createProperty("JiggleRadius", m_pipeline.jiggleRadius));

    reflectionzeug::PropertyGroup * rendering = addGroup("Rendering");
    rendering->addProperty(createProperty("FontColor", m_pipeline.fontColor));
    rendering->addProperty(createProperty("DistanceThreshold", m_pipeline.distanceThreshold));
}