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


C++ RendererPtr类代码示例

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


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

示例1: getRho

void ShowHideAnim::onTimer(qlib::time_value elapsed, AnimMgr *pMgr)
{
  const double rho = getRho(elapsed);
  
  // rend array should be filled here!!
  rendlist_t::const_iterator riter = rendBegin();
  rendlist_t::const_iterator rend = rendEnd();
  for (; riter!=rend; ++riter) {
    RendererPtr pRend = *riter;

    if (m_bHide) {
      // hiding
      setVisible(pRend, true);
      if (m_bFade) 
        pRend->setPropReal("alpha", (1.0-rho)*m_dTgtAlpha);
    }
    else {
      // showing
      MB_DPRINTLN("ShowHideAnim.onTimer> SetVisible TRUE!!!");
      setVisible(pRend, true);
      if (m_bFade) {
        pRend->setPropReal("alpha", rho*m_dTgtAlpha);
	MB_DPRINTLN("ShowHideAnim.onTimer> SetAlpha %f!", rho);
      }
    }

  }
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:28,代码来源:ShowHideAnim.cpp

示例2: 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

示例3: PrepareMesh

Ogre::Mesh* EC_Mesh::PrepareMesh(const std::string& mesh_name, bool clone)
{
    if (!ViewEnabled())
        return 0;
    if (renderer_.expired())
        return 0;
    RendererPtr renderer = renderer_.lock();   
        
    Ogre::MeshManager& mesh_mgr = Ogre::MeshManager::getSingleton();
    Ogre::MeshPtr mesh = mesh_mgr.getByName(SanitateAssetIdForOgre(mesh_name));
    
    // For local meshes, mesh will not get automatically loaded until used in an entity. Load now if necessary
    if (mesh.isNull())
    {
        try
        {
            mesh_mgr.load(mesh_name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
            mesh = mesh_mgr.getByName(mesh_name);
        }
        catch (Ogre::Exception& e)
        {
            LogError("Could not load mesh " + mesh_name + ": " + std::string(e.what()));
            return 0;
        }
    }
    
    // If mesh is still null, must abort
    if (mesh.isNull())
    {
        LogError("Mesh " + mesh_name + " does not exist");
        return 0;
    }
    
    if (clone)
    {
        try
        {
            mesh = mesh->clone(renderer->GetUniqueObjectName("EC_Mesh_clone"));
            mesh->setAutoBuildEdgeLists(false);
            cloned_mesh_name_ = mesh->getName();
        }
        catch (Ogre::Exception& e)
        {
            LogError("Could not clone mesh " + mesh_name + ":" + std::string(e.what()));
            return 0;
        }
    }
    
    if (mesh->hasSkeleton())
    {
        Ogre::SkeletonPtr skeleton = Ogre::SkeletonManager::getSingleton().getByName(mesh->getSkeletonName());
        if (skeleton.isNull() || skeleton->getNumBones() == 0)
        {
            LogDebug("Mesh " + mesh_name + " has a skeleton with 0 bones. Disabling the skeleton.");
            mesh->setSkeletonName("");
        }
    }
    
    return mesh.get();
}
开发者ID:A-K,项目名称:naali,代码行数:60,代码来源:EC_Mesh.cpp

示例4: 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

示例5: SetActive

 void EC_OgreCamera::SetActive()
 {
     if (renderer_.expired())
         return;           
     RendererPtr renderer = renderer_.lock();
     renderer->SetCurrentCamera(camera_);
 }
开发者ID:Chiru,项目名称:naali,代码行数:7,代码来源:EC_OgreCamera.cpp

示例6: IsActive

 bool EC_OgreCamera::IsActive() const
 {
     if (renderer_.expired())
         return false;           
     RendererPtr renderer = renderer_.lock();    
     return renderer->GetCurrentCamera() == camera_;
 }
开发者ID:Chiru,项目名称:naali,代码行数:7,代码来源:EC_OgreCamera.cpp

示例7: 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

示例8: ActiveCamera

	LightPixel::CameraPtr Application::ActiveCamera()
	{
		RendererPtr render = Engine::Instance().RendererInstance();
		CameraPtr  & camera = render->CurFrameBuffer()->GetViewport()->camera;
		//BOOST_ASSERT(camera);

		return camera;
	}
开发者ID:swq0553,项目名称:LightPixel,代码行数:8,代码来源:App.cpp

示例9: Color

Color EC_OgreEnvironment::GetBackgoundColor() const
{
    if (renderer_.expired())
        return Color(0.0f, 0.0f, 0.0f, 0.0f);
    RendererPtr renderer = renderer_.lock();
    
    return ToCoreColor(renderer->GetViewport()->getBackgroundColour());
}
开发者ID:caocao,项目名称:naali,代码行数:8,代码来源:EC_OgreEnvironment.cpp

示例10: SetBackgoundColor

void EC_OgreEnvironment::SetBackgoundColor(const Color &color)
{
    if (renderer_.expired())
        return;
    RendererPtr renderer = renderer_.lock();
    
    renderer->GetViewport()->setBackgroundColour(ToOgreColor(color));
}
开发者ID:caocao,项目名称:naali,代码行数:8,代码来源:EC_OgreEnvironment.cpp

示例11: 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

示例12: Update

	void Application::Update()
	{
		this->UpdateStats();
		this->DoUpdate();

		RendererPtr render = Engine::Instance().RendererInstance();
		render->Refresh();
	
	}
开发者ID:swq0553,项目名称:LightPixel,代码行数:9,代码来源:App.cpp

示例13: onPropInit

void RealPropAnim::onPropInit(AnimMgr *pMgr, qlib::uid_t tgt_uid)
{
  RendererPtr pTgtRend = qsys::SceneManager::getRendererS(tgt_uid);
  if (pTgtRend.isnull()) {
    LOG_DPRINTLN("RealPropAnim.onPropInit> Unknown tgt uid %d", int(tgt_uid));
    return;
  }
  qlib::LVariant var(m_startValue);
  pTgtRend->setProperty(getPropName(), var);
}
开发者ID:CueMol,项目名称:cuemol2,代码行数:10,代码来源:RealPropAnim.cpp

示例14: renderer_

 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

示例15: OnMouseWheel

BOOL CGameEditorView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
    // TODO: 在此添加消息处理程序代码和/或调用默认值
    RendererPtr pRenderer = Project::Instance()->GetRenderer();

    if(pRenderer)
    {
        pRenderer->OnMouseWheel(nFlags, zDelta, pt);
    }
    return CView::OnMouseWheel(nFlags, zDelta, pt);
}
开发者ID:lythm,项目名称:orb3d,代码行数:11,代码来源:GameEditorView.cpp


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