Exemplo n.º 1
0
OsgScene::OsgScene(gloperate::ResourceManager & resourceManager, const reflectionzeug::Variant & pluginInfo)
: OsgPainter("osgScene", resourceManager, pluginInfo)
, m_dataPath("")
{
    // Get data path
    const reflectionzeug::VariantMap * map = pluginInfo.asMap();
    if (map && map->count("dataPath") > 0) {
        m_dataPath = map->at("dataPath").value<std::string>();
        m_dataPath = iozeug::ensurePathSeparatorEnding(m_dataPath);
    }
}
Exemplo n.º 2
0
CubeScape::CubeScape(gloperate::ResourceManager & resourceManager, const reflectionzeug::Variant & pluginInfo)
: Painter("CubeScape", resourceManager, pluginInfo)
, m_animation(true)
, m_numCubes(25)
, m_dataPath("")
, a_vertex(-1)
, u_transform(-1)
, u_time(-1)
, u_numcubes(-1)
{
    // Get data path
    const reflectionzeug::VariantMap * map = pluginInfo.asMap();
    if (map && map->count("dataPath") > 0) {
        m_dataPath = map->at("dataPath").value<std::string>();
        m_dataPath = iozeug::ensurePathSeparatorEnding(m_dataPath);
    }

    // Setup painter
    m_targetFramebufferCapability = addCapability(new gloperate::TargetFramebufferCapability());
    m_viewportCapability = addCapability(new gloperate::ViewportCapability());
    m_projectionCapability = addCapability(new gloperate::PerspectiveProjectionCapability(m_viewportCapability));
    m_typedRenderTargetCapability = addCapability(new gloperate::TypedRenderTargetCapability());
    m_cameraCapability = addCapability(new gloperate::CameraCapability(glm::vec3(0.0, 2.0, 1.5), glm::vec3(0.0, 0.0, 0.5), glm::vec3(0.0, 1.0, 0.0)));
    m_timeCapability = addCapability(new gloperate::VirtualTimeCapability());
    
    m_timeCapability->setLoopDuration(20.0f * pi<float>());

    m_targetFramebufferCapability->changed.connect([this](){ this->onTargetFramebufferChanged();});

    // Register properties
    addProperty<bool>("Animation", this, &CubeScape::animation, &CubeScape::setAnimation);

    auto * propNumCubes = addProperty<int>("NumCubes", this, &CubeScape::numberOfCubes, &CubeScape::setNumberOfCubes);
    propNumCubes->setOption("minimum", 0);

    // Register scripting functions
    addFunction("randomize", this, &CubeScape::randomize);
}