本文整理汇总了C++中OgreWorldPtr::Renderer方法的典型用法代码示例。如果您正苦于以下问题:C++ OgreWorldPtr::Renderer方法的具体用法?C++ OgreWorldPtr::Renderer怎么用?C++ OgreWorldPtr::Renderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OgreWorldPtr
的用法示例。
在下文中一共展示了OgreWorldPtr::Renderer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
void EC_Hydrax::Create()
{
PROFILE(EC_Hydrax_Create);
SAFE_DELETE(impl);
if (!framework || framework->IsHeadless())
return;
try
{
if (!ParentScene())
{
LogError("EC_Hydrax: no parent scene. Cannot be created.");
return;
}
OgreWorldPtr w = ParentScene()->Subsystem<OgreWorld>();
assert(w);
connect(w->Renderer(), SIGNAL(MainCameraChanged(Entity *)), SLOT(OnActiveCameraChanged(Entity *)), Qt::UniqueConnection);
Entity *mainCamera = w->Renderer()->MainCamera();
if (!mainCamera)
{
// Can't create Hydrax just yet, no main camera set (Hydrax needs a valid camera to initialize).
// This error is benign, and Hydrax will now postpone its initialization to until a camera is set.
// (see OnActiveCameraChanged()).
LogDebug("Cannot create EC_Hydrax: No main camera set!");
return;
}
Ogre::Camera *cam = mainCamera->GetComponent<EC_Camera>()->GetCamera();
impl = new EC_HydraxImpl();
impl->hydrax = new Hydrax::Hydrax(w->OgreSceneManager(), cam, w->Renderer()->MainViewport());
// Using projected grid module by default
Hydrax::Module::ProjectedGrid *module = new Hydrax::Module::ProjectedGrid(impl->hydrax, new Hydrax::Noise::Perlin(),
Ogre::Plane(Ogre::Vector3::UNIT_Y, Ogre::Vector3::ZERO), Hydrax::MaterialManager::NM_VERTEX);
impl->hydrax->setModule(module);
impl->module = module;
// Load all parameters from config file, but position attribute is always authoritative for the position.
RequestConfigAsset();
connect(framework->Frame(), SIGNAL(PostFrameUpdate(float)), SLOT(Update(float)), Qt::UniqueConnection);
}
catch(const Ogre::Exception &e)
{
// Currently if we try to create more than one Hydrax component we end up here due to Ogre internal name collision.
LogError("Could not create EC_Hydrax: " + std::string(e.what()));
}
}
示例2: Create
void EC_SkyX::Create()
{
if (framework->IsHeadless())
return;
if (!ParentScene())
{
LogError("EC_SkyX: Aborting creation, parent scene is null!");
return;
}
// Return if main camera is not set
OgreWorldPtr w = ParentScene()->GetWorld<OgreWorld>();
if (!w || !w->Renderer())
return;
if (!w->Renderer()->MainCamera())
{
connect(w->Renderer(), SIGNAL(MainCameraChanged(Entity*)), this, SLOT(Create()), Qt::UniqueConnection);
return;
}