当前位置: 首页>>代码示例>>C++>>正文


C++ RendererPtr::GetSceneManager方法代码示例

本文整理汇总了C++中RendererPtr::GetSceneManager方法的典型用法代码示例。如果您正苦于以下问题:C++ RendererPtr::GetSceneManager方法的具体用法?C++ RendererPtr::GetSceneManager怎么用?C++ RendererPtr::GetSceneManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RendererPtr的用法示例。


在下文中一共展示了RendererPtr::GetSceneManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InitCaelum

void EC_OgreEnvironment::InitCaelum()
{
    using namespace Caelum;
    
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();   

    caelumComponents_ = CaelumSystem::CAELUM_COMPONENTS_NONE;
    caelumComponents_ = caelumComponents_ |
        CaelumSystem::CAELUM_COMPONENT_SKY_DOME |
        CaelumSystem::CAELUM_COMPONENT_MOON |
        CaelumSystem::CAELUM_COMPONENT_SUN |
        CaelumSystem::CAELUM_COMPONENT_POINT_STARFIELD |
        CaelumSystem::CAELUM_COMPONENT_SCREEN_SPACE_FOG |
        CaelumSystem::CAELUM_COMPONENT_GROUND_FOG;
    // Caelum clouds are hidden, otherwise shadows get messed up.

    caelumSystem_ = new CaelumSystem(renderer->GetRoot().get(),
        renderer->GetSceneManager(), (CaelumSystem::CaelumComponent)caelumComponents_);

    // Flip the Caelum camera and ground node orientations 90 degrees.
    Ogre::Quaternion orientation(Ogre::Degree(90), Ogre::Vector3(1, 0, 0));
    caelumSystem_->getCaelumCameraNode()->setOrientation(orientation);
    caelumSystem_->getCaelumGroundNode()->setOrientation(orientation);

    // We want to manage the fog ourself.
    caelumSystem_->setManageSceneFog(false);

    // Use just one light (the brightest one) at a time.
    caelumSystem_->setEnsureSingleLightSource(true);
    caelumSystem_->setEnsureSingleShadowSource(true);

    caelumSystem_->getMoon()->setDiffuseMultiplier(Ogre::ColourValue(0.25f, 0.25f, 0.25f));
}
开发者ID:caocao,项目名称:naali,代码行数:35,代码来源:EC_OgreEnvironment.cpp

示例2: InitShadows

void EC_OgreEnvironment::InitShadows()
{    
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();   

    float shadowFarDist = 50;
    unsigned short shadowTextureSize = 2048;
    size_t shadowTextureCount = 1;
    Ogre::ColourValue shadowColor(0.6f, 0.6f, 0.6f);

    // This is the default material to use for shadow buffer rendering pass, overridable in script.
    // Note that we use the same single material (vertex program) for each object, so we're relying on
    // that we use Ogre software skinning. Hardware skinning would require us to do different vertex programs
    // for skinned/nonskinned geometry.
    std::string ogreShadowCasterMaterial = "rex/ShadowCaster";

    Ogre::SceneManager* sceneManager = renderer->GetSceneManager();
    sceneManager->setShadowColour(shadowColor);
    sceneManager->setShadowFarDistance(shadowFarDist);

    sceneManager->setShadowTextureSize(shadowTextureSize);
    sceneManager->setShadowTextureCount(shadowTextureCount);

    sceneManager->setShadowTexturePixelFormat(Ogre::PF_FLOAT16_R);
    sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);
    sceneManager->setShadowTextureCasterMaterial(ogreShadowCasterMaterial.c_str());
    sceneManager->setShadowTextureSelfShadow(true);

    Ogre::ShadowCameraSetupPtr shadowCameraSetup = Ogre::ShadowCameraSetupPtr(new Ogre::FocusedShadowCameraSetup());
    sceneManager->setShadowCameraSetup(shadowCameraSetup);

    // If set to true, problems with objects that clip into the ground
    sceneManager->setShadowCasterRenderBackFaces(false);
}
开发者ID:caocao,项目名称:naali,代码行数:35,代码来源:EC_OgreEnvironment.cpp

示例3: CommitChanges

bool EC_OgreCustomObject::CommitChanges(Ogre::ManualObject* object)
{
    if (!object)
        return false;
    
    if (renderer_.expired())
        return false;
    RendererPtr renderer = renderer_.lock();
            
    DestroyEntity();
    
    // If placeable is not set yet, set it manually by searching it from the parent entity
    if (!placeable_)
    {
        Scene::Entity* entity = GetParentEntity();
        if (entity)
        {
            ComponentPtr placeable = entity->GetComponent(EC_Placeable::TypeNameStatic());
            if (placeable)
                placeable_ = placeable;
        }
    }
    
    if (!object->getNumSections())
        return true;
        
    try
    {
        std::string mesh_name = renderer->GetUniqueObjectName("EC_OgreCustomObject_mesh");
        object->convertToMesh(mesh_name);
        object->clear();
    
        Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();

        entity_ = scene_mgr->createEntity(renderer->GetUniqueObjectName("EC_OgreCustomObject_entity"), mesh_name);
        if (entity_)
        {
            AttachEntity();
            entity_->setRenderingDistance(draw_distance_);
            entity_->setCastShadows(cast_shadows_);
            entity_->setUserAny(Ogre::Any(GetParentEntity()));
            // Set UserAny also on subentities
            for (uint i = 0; i < entity_->getNumSubEntities(); ++i)
                entity_->getSubEntity(i)->setUserAny(entity_->getUserAny());
        }
        else
        {
            OgreRenderingModule::LogError("Could not create entity from manualobject mesh");
            return false;
        }
    }   
    catch (Ogre::Exception& e)
    {
        OgreRenderingModule::LogError("Could not convert manualobject to mesh: " + std::string(e.what()));
        return false;
    }
    
    return true;
}
开发者ID:A-K,项目名称:naali,代码行数:59,代码来源:EC_OgreCustomObject.cpp

示例4: GetAmbientLightColor

Color EC_OgreEnvironment::GetAmbientLightColor() const
{
    if (renderer_.expired())
        return Color(0.0f, 0.0f, 0.0f, 0.0f);
    RendererPtr renderer = renderer_.lock();
            
    Ogre::SceneManager *sceneManager = renderer->GetSceneManager();
    return ToCoreColor(sceneManager->getAmbientLight());
}
开发者ID:caocao,项目名称:naali,代码行数:9,代码来源:EC_OgreEnvironment.cpp

示例5: DisableFog

void EC_OgreEnvironment::DisableFog()
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();
    
    Ogre::SceneManager *sceneManager = renderer->GetSceneManager();
    sceneManager->setFog(Ogre::FOG_NONE);
}
开发者ID:caocao,项目名称:naali,代码行数:9,代码来源:EC_OgreEnvironment.cpp

示例6:

 EC_OgreLight::EC_OgreLight(Foundation::ModuleInterface* module) :
     Foundation::ComponentInterface(module->GetFramework()),
     renderer_(checked_static_cast<OgreRenderingModule*>(module)->GetRenderer()),
     light_(0),
     attached_(false)
 {
     RendererPtr renderer = renderer_.lock();               
     Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
     light_ = scene_mgr->createLight(renderer->GetUniqueObjectName());
 }
开发者ID:Manaluusua,项目名称:naali,代码行数:10,代码来源:EC_OgreLight.cpp

示例7: DisableSky

void EC_OgreSky::DisableSky()
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();

    Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
    scene_mgr->setSkyBox(false, "");
    scene_mgr->setSkyDome(false, "");
    scene_mgr->setSkyPlane(false, Ogre::Plane(), "");
    skyEnabled_ = false;
}
开发者ID:Belsepubi,项目名称:naali,代码行数:12,代码来源:EC_OgreSky.cpp

示例8: DetachLight

 EC_OgreLight::~EC_OgreLight()
 {
     if (renderer_.expired())
         return;
     RendererPtr renderer = renderer_.lock();   
     
     if (light_)
     {
         DetachLight();
         Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
         scene_mgr->destroyLight(light_);
         light_ = 0;
     }
 }
开发者ID:Manaluusua,项目名称:naali,代码行数:14,代码来源:EC_OgreLight.cpp

示例9: RemoveMesh

EC_Mesh::~EC_Mesh()
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();

    RemoveMesh();

    if (adjustment_node_)
    {
        Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
        scene_mgr->destroySceneNode(adjustment_node_);
        adjustment_node_ = 0;
    }
}
开发者ID:A-K,项目名称:naali,代码行数:15,代码来源:EC_Mesh.cpp

示例10: CreateSunlight

void EC_OgreEnvironment::CreateSunlight()
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();
    
    Ogre::SceneManager* sceneManager = renderer->GetSceneManager();
    sunlight_ = sceneManager->createLight(renderer->GetUniqueObjectName());
    sunlight_->setType(Ogre::Light::LT_DIRECTIONAL);
    ///\todo Read parameters from config file?
    sunlight_->setDiffuseColour(0.93f, 1, 0.13f);
    sunlight_->setDirection(-1, -1, -1);
    sunlight_->setCastShadows(true);
    SetAmbientLightColor(Color(0.5, 0.5, 0.5, 1));
}
开发者ID:caocao,项目名称:naali,代码行数:15,代码来源:EC_OgreEnvironment.cpp

示例11: SetAmbientLightColor

void EC_OgreEnvironment::SetAmbientLightColor(const Color &color)
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();
    
    Ogre::SceneManager* sceneManager = renderer->GetSceneManager();
    sceneManager->setAmbientLight(ToOgreColor(color));
    
    // Assure that there is "not" None-flag set. 
    if ( override_flags_.testFlag(None))
        override_flags_ &= ~None;
    
    override_flags_|=AmbientLight;
    userAmbientLight_ = ToOgreColor(color);
}
开发者ID:caocao,项目名称:naali,代码行数:16,代码来源:EC_OgreEnvironment.cpp

示例12:

 EC_OgreCamera::EC_OgreCamera(Foundation::ModuleInterface* module) :
     Foundation::ComponentInterface(module->GetFramework()),
     renderer_(checked_static_cast<OgreRenderingModule*>(module)->GetRenderer()),
     attached_(false),
     camera_(0)
 {
     RendererPtr renderer = renderer_.lock();
     Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
     Ogre::Viewport* viewport = renderer->GetViewport();
     camera_ = scene_mgr->createCamera(renderer->GetUniqueObjectName());
     
     // Set default values for the camera
     camera_->setNearClipDistance(0.1f);
     camera_->setFarClipDistance(2000.f);
     
     camera_->setAspectRatio(Ogre::Real(viewport->getActualWidth() / Ogre::Real(viewport->getActualHeight())));
     camera_->setAutoAspectRatio(true);
 }
开发者ID:Chiru,项目名称:naali,代码行数:18,代码来源:EC_OgreCamera.cpp

示例13: DetachCamera

 EC_OgreCamera::~EC_OgreCamera()
 {
     if (renderer_.expired())
         return;
         
     DetachCamera();
                    
     if (camera_)
     {           
         RendererPtr renderer = renderer_.lock();               
      
         if (renderer->GetCurrentCamera() == camera_)
             renderer->SetCurrentCamera(0);
             
         Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();         
         scene_mgr->destroyCamera(camera_);
         camera_ = 0;       
     }
 }
开发者ID:Chiru,项目名称:naali,代码行数:19,代码来源:EC_OgreCamera.cpp

示例14: RemoveAttachmentMesh

void EC_Mesh::RemoveAttachmentMesh(uint index)
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();   
        
    if (!entity_)
        return;
        
    if (index >= attachment_entities_.size())
        return;
    
    Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
    
    if (attachment_entities_[index] && attachment_nodes_[index])
    {
        // See if attached to a tagpoint or an ordinary node
        Ogre::TagPoint* tag = dynamic_cast<Ogre::TagPoint*>(attachment_nodes_[index]);
        if (tag)
        {
            entity_->detachObjectFromBone(attachment_entities_[index]);
        }
        else
        {
            Ogre::SceneNode* scenenode = dynamic_cast<Ogre::SceneNode*>(attachment_nodes_[index]);
            if (scenenode)
            {
                scenenode->detachObject(attachment_entities_[index]);
                scene_mgr->destroySceneNode(scenenode);
            }
        }
        
        attachment_nodes_[index] = 0;
    }
    if (attachment_entities_[index])
    {
        if (attachment_entities_[index]->sharesSkeletonInstance())
            attachment_entities_[index]->stopSharingSkeletonInstance();
        scene_mgr->destroyEntity(attachment_entities_[index]);
        attachment_entities_[index] = 0;
    }
}
开发者ID:A-K,项目名称:naali,代码行数:42,代码来源:EC_Mesh.cpp

示例15: drawDistanceData

EC_Mesh::EC_Mesh(IModule* module) :
    IComponent(module->GetFramework()),
    // Note: we put the opensim haxor adjust right here in the defaults, instead of hardcoding it in code.
    nodeTransformation(this, "Transform", Transform(Vector3df(0,0,0),Vector3df(90,0,180),Vector3df(1,1,1))),
    meshRef(this, "Mesh ref"),
    skeletonRef(this, "Skeleton ref"),
    meshMaterial(this, "Mesh materials"),
    drawDistance(this, "Draw distance", 0.0f),
    castShadows(this, "Cast shadows", false),
    renderer_(checked_static_cast<OgreRenderingModule*>(module)->GetRenderer()),
    entity_(0),
    bone_tagpoint_(0),
    bone_parent_mesh_(0),
    bone_attached_mesh_(0),
    attached_(false),
    attached_to_bone_(false)
{
    static AttributeMetadata drawDistanceData("", "0", "10000");
    drawDistance.SetMetadata(&drawDistanceData);

    static AttributeMetadata materialMetadata;
    materialMetadata.elementType = "assetreference";
    meshMaterial.SetMetadata(&materialMetadata);

    static AttributeMetadata meshRefMetadata;
    AttributeMetadata::ButtonInfoList meshRefButtons;
    meshRefButtons.push_back(AttributeMetadata::ButtonInfo(meshRef.GetName(), "V", "View"));
    meshRefMetadata.buttons = meshRefButtons;
    meshRef.SetMetadata(&meshRefMetadata);

    RendererPtr renderer = renderer_.lock();
    Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
    adjustment_node_ = scene_mgr->createSceneNode(renderer->GetUniqueObjectName("EC_Mesh_adjustment_node"));

    connect(this, SIGNAL(ParentEntitySet()), SLOT(UpdateSignals()));
    connect(this, SIGNAL(AttributeChanged(IAttribute*, AttributeChange::Type)), SLOT(OnAttributeUpdated(IAttribute*)));

    meshAsset = AssetRefListenerPtr(new AssetRefListener());
    connect(meshAsset.get(), SIGNAL(Loaded(AssetPtr)), this, SLOT(OnMeshAssetLoaded(AssetPtr)), Qt::UniqueConnection);
    skeletonAsset = AssetRefListenerPtr(new AssetRefListener());
    connect(skeletonAsset.get(), SIGNAL(Loaded(AssetPtr)), this, SLOT(OnSkeletonAssetLoaded(AssetPtr)), Qt::UniqueConnection);
}
开发者ID:A-K,项目名称:naali,代码行数:42,代码来源:EC_Mesh.cpp


注:本文中的RendererPtr::GetSceneManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。