Exemple #1
0
        CameraID CameraHandler::CreateCustomCamera()
        {
            Scene::ScenePtr scene = framework_->GetDefaultWorldScene();
            if (!scene)
                return -1;

            Scene::EntityPtr cam_entity = scene->CreateEntity(scene->GetNextFreeId());
            if (!cam_entity.get())
                return -1;

            cam_entity->AddComponent(framework_->GetComponentManager()->CreateComponent(OgreRenderer::EC_OgrePlaceable::TypeNameStatic()));
            cam_entity->AddComponent(framework_->GetComponentManager()->CreateComponent(OgreRenderer::EC_OgreCamera::TypeNameStatic()));
            scene->EmitEntityCreated(cam_entity);
            Foundation::ComponentInterfacePtr component_placable = cam_entity->GetComponent(OgreRenderer::EC_OgrePlaceable::TypeNameStatic());
            OgreRenderer::EC_OgreCamera *ec_camera = cam_entity->GetComponent<OgreRenderer::EC_OgreCamera>().get();
            
            if (!component_placable.get() || !ec_camera)
                return -1;
            ec_camera->SetPlaceable(component_placable);
            
            camera_count_++;
            id_to_cam_entity_[camera_count_] = cam_entity.get();

            return camera_count_;
        }
Exemple #2
0
    void EnvironmentModule::CreateSky()
    {
        sky_ = SkyPtr(new Sky(this));
        Scene::ScenePtr scene = GetFramework()->GetDefaultWorldScene();
        Scene::EntityPtr sky_entity = scene->CreateEntity(GetFramework()->GetDefaultWorldScene()->GetNextFreeId());
        sky_entity->AddComponent(GetFramework()->GetComponentManager()->CreateComponent("EC_OgreSky"));
        scene->EmitEntityCreated(sky_entity);
        sky_->FindCurrentlyActiveSky();

        if (!GetEnvironmentHandler()->IsCaelum())
            sky_->CreateDefaultSky();

        if ( environment_editor_ != 0 )
             environment_editor_->InitSkyTabWindow();
    }
Exemple #3
0
    void EnvironmentModule::CreateTerrain()
    {
        terrain_ = TerrainPtr(new Terrain(this));

        Scene::ScenePtr scene = GetFramework()->GetDefaultWorldScene();
        Scene::EntityPtr entity = scene->CreateEntity(GetFramework()->GetDefaultWorldScene()->GetNextFreeId());
        entity->AddComponent(GetFramework()->GetComponentManager()->CreateComponent("EC_Terrain"));
        scene->EmitEntityCreated(entity);
        terrain_->FindCurrentlyActiveTerrain();
        
        if ( environment_editor_ != 0 )
        {
            environment_editor_->InitTerrainTabWindow();
            environment_editor_->InitTerrainTextureTabWindow();
        }
        
    }