本文整理汇总了C++中ogre::Camera::setLodBias方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::setLodBias方法的具体用法?C++ Camera::setLodBias怎么用?C++ Camera::setLodBias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::setLodBias方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderTextures
void RenderedTexture::renderTextures()
{
//Set up RTT texture
Ogre::TexturePtr renderTexture;
if (renderTexture.isNull()) {
renderTexture = Ogre::TextureManager::getSingleton().createManual(
getUniqueID("RenderedEntityMaterial"), "EntityRenderer",
Ogre::TEX_TYPE_2D, textureSize, textureSize, 0,
Ogre::PF_A8R8G8B8, Ogre::TU_RENDERTARGET, 0);
}
renderTexture->setNumMipmaps(0);
//Set up render target
Ogre::RenderTexture* renderTarget = renderTexture->getBuffer()->getRenderTarget();
renderTarget->setAutoUpdated(false);
//Set up camera
Ogre::SceneNode* camNode = sceneMgr->getSceneNode("EntityRenderer::cameraNode");
Ogre::Camera* renderCamera = sceneMgr->createCamera(getUniqueID("EntityRendererCam"));
camNode->attachObject(renderCamera);
renderCamera->setLodBias(1000.0f);
Ogre::Viewport* renderViewport = renderTarget->addViewport(renderCamera);
renderViewport->setOverlaysEnabled(false);
renderViewport->setClearEveryFrame(true);
renderViewport->setShadowsEnabled(false);
renderViewport->setBackgroundColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 0.0f));
//Set up scene node
Ogre::SceneNode* node = sceneMgr->getSceneNode("EntityRenderer::renderNode");
Ogre::SceneNode* oldSceneNode = entity->getParentSceneNode();
if (oldSceneNode)
oldSceneNode->detachObject(entity);
node->attachObject(entity);
node->setPosition(-entityCenter);
//Set up camera FOV
const Ogre::Real objDist = entityRadius * 100;
const Ogre::Real nearDist = objDist - (entityRadius + 1);
const Ogre::Real farDist = objDist + (entityRadius + 1);
renderCamera->setAspectRatio(1.0f);
renderCamera->setFOVy(Ogre::Math::ATan(2.0 * entityRadius / objDist));
renderCamera->setNearClipDistance(nearDist);
renderCamera->setFarClipDistance(farDist);
//Disable mipmapping (without this, masked textures look bad)
Ogre::MaterialManager* mm = Ogre::MaterialManager::getSingletonPtr();
Ogre::FilterOptions oldMinFilter = mm->getDefaultTextureFiltering(Ogre::FT_MIN);
Ogre::FilterOptions oldMagFilter = mm->getDefaultTextureFiltering(Ogre::FT_MAG);
Ogre::FilterOptions oldMipFilter = mm->getDefaultTextureFiltering(Ogre::FT_MIP);
mm->setDefaultTextureFiltering(Ogre::FO_POINT, Ogre::FO_LINEAR,Ogre:: FO_NONE);
//Disable fog
Ogre::FogMode oldFogMode = sceneMgr->getFogMode();
Ogre::ColourValue oldFogColor = sceneMgr->getFogColour();
Ogre::Real oldFogDensity = sceneMgr->getFogDensity();
Ogre::Real oldFogStart = sceneMgr->getFogStart();
Ogre::Real oldFogEnd = sceneMgr->getFogEnd();
sceneMgr->setFog(Ogre::FOG_NONE);
// Get current status of the queue mode
Ogre::SceneManager::SpecialCaseRenderQueueMode OldSpecialCaseRenderQueueMode =
sceneMgr->getSpecialCaseRenderQueueMode();
//Only render the entity
sceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_INCLUDE);
sceneMgr->addSpecialCaseRenderQueue(renderQueueGroup);
Ogre::uint8 oldRenderQueueGroup = entity->getRenderQueueGroup();
entity->setRenderQueueGroup(renderQueueGroup);
bool oldVisible = entity->getVisible();
entity->setVisible(true);
float oldMaxDistance = entity->getRenderingDistance();
entity->setRenderingDistance(0);
//Calculate the filename hash used to uniquely identity this render
std::string strKey = entityKey;
char key[32] = {0};
Ogre::uint32 i = 0;
for (std::string::const_iterator it = entityKey.begin(); it != entityKey.end(); ++it) {
key[i] ^= *it;
i = (i+1) % sizeof(key);
}
for (i = 0; i < sizeof(key); ++i)
key[i] = (key[i] % 26) + 'A';
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
GetUserDir().string(), "FileSystem", "BinFolder");
std::string fileNamePNG =
"Rendered." + std::string(key, sizeof(key)) + '.' +
Ogre::StringConverter::toString(textureSize) + ".png";
//Attempt to load the pre-render file if allowed
bool needsRegen = false;
if (!needsRegen) {
try{
texture = Ogre::TextureManager::getSingleton().load(
fileNamePNG, "BinFolder", Ogre::TEX_TYPE_2D, 0);
} catch (...) {
//.........这里部分代码省略.........
示例2: while
//.........这里部分代码省略.........
lightCopy->setSpecularColour(light->getSpecularColour());
lightCopy->setAttenuation(light->getAttenuationRange(), light->getAttenuationConstant(), light->getAttenuationLinear(), light->getAttenuationQuadric());
lightCopy->setPosition(light->getPosition());
lightCopy->setDirection(light->getDirection());
if (lightCopy->getType() == Ogre::Light::LT_SPOTLIGHT)
lightCopy->setSpotlightRange(light->getSpotlightInnerAngle(), light->getSpotlightOuterAngle(), light->getSpotlightFalloff());
lightCopy->setPowerScale(light->getPowerScale());
lightCopy->setCastShadows(light->getCastShadows());
// create a new container for the cloned light
OgreContainer *lightCopyContainer = new OgreContainer(lightCopy);
lightCopy->setUserAny(Ogre::Any(lightCopyContainer));
if (!light->getUserAny().isEmpty()) {
OgreContainer *lightContainer = Ogre::any_cast<OgreContainer *>(light->getUserAny());
if (lightContainer)
QObject::connect(lightContainer, SIGNAL(sceneNodeUpdated()), lightCopyContainer, SLOT(updateLight()));
}
result = dynamic_cast<Ogre::MovableObject *>(lightCopy);
} else if (typeName == "Camera") {
// clone camera
Ogre::Camera *camera = dynamic_cast<Ogre::Camera *>(movableObject);
Ogre::Camera *cameraCopy = sceneManager->createCamera(name.toStdString());
//cameraCopy->setCustomParameter(0, camera->getCustomParameter(0));
cameraCopy->setAspectRatio(camera->getAspectRatio());
cameraCopy->setAutoAspectRatio(camera->getAutoAspectRatio());
//cameraCopy->setAutoTracking(...);
cameraCopy->setCastShadows(camera->getCastsShadows());
//cameraCopy->setCullingFrustum(camera->getCullingFrustum());
//cameraCopy->setCustomParameter(...);
//cameraCopy->setCustomProjectionMatrix(..);
//cameraCopy->setCustomViewMatrix(..);
//cameraCopy->setDebugDisplayEnabled(...);
//cameraCopy->setDefaultQueryFlags(...);
//cameraCopy->setDefaultVisibilityFlags(...);
cameraCopy->setDirection(camera->getDirection());
//cameraCopy->setFixedYawAxis(...);
cameraCopy->setFocalLength(camera->getFocalLength());
cameraCopy->setFOVy(camera->getFOVy());
//Ogre::Real left;
//Ogre::Real right;
//Ogre::Real top;
//Ogre::Real bottom;
//camera->getFrustumExtents(left, right, top, bottom);
//cameraCopy->setFrustumExtents(left, right, top, bottom);
//cameraCopy->setFrustumOffset(camera->getFrustumOffset());
//cameraCopy->setListener(camera->getListener());
cameraCopy->setLodBias(camera->getLodBias());
//cameraCopy->setLodCamera(camera->getLodCamera());
cameraCopy->setNearClipDistance(camera->getNearClipDistance());
cameraCopy->setFarClipDistance(camera->getFarClipDistance());
cameraCopy->setOrientation(camera->getOrientation());
//cameraCopy->setOrthoWindow(...);
//cameraCopy->setOrthoWindowHeight(...);
//cameraCopy->setOrthoWindowWidth(...);
cameraCopy->setPolygonMode(camera->getPolygonMode());
cameraCopy->setPolygonModeOverrideable(camera->getPolygonModeOverrideable());
cameraCopy->setPosition(camera->getPosition());
cameraCopy->setProjectionType(camera->getProjectionType());
cameraCopy->setQueryFlags(camera->getQueryFlags());
cameraCopy->setRenderingDistance(camera->getRenderingDistance());
cameraCopy->setRenderQueueGroup(camera->getRenderQueueGroup());
//cameraCopy->setRenderSystemData(camera->getRenderSystemData());
cameraCopy->setUseIdentityProjection(camera->getUseIdentityProjection());
cameraCopy->setUseIdentityView(camera->getUseIdentityView());
//cameraCopy->setUserAny(camera->getUserAny());
cameraCopy->setUseRenderingDistance(camera->getUseRenderingDistance());
//cameraCopy->setUserObject(camera->getUserObject());
cameraCopy->setVisibilityFlags(camera->getVisibilityFlags());
cameraCopy->setVisible(camera->getVisible());
//cameraCopy->setWindow(...);
if (!movableObject->getUserAny().isEmpty()) {
CameraInfo *sourceCameraInfo = Ogre::any_cast<CameraInfo *>(movableObject->getUserAny());
if (sourceCameraInfo) {
CameraInfo *targetCameraInfo = new CameraInfo();
targetCameraInfo->width = sourceCameraInfo->width;
targetCameraInfo->height = sourceCameraInfo->height;
dynamic_cast<Ogre::MovableObject *>(cameraCopy)->setUserAny(Ogre::Any(targetCameraInfo));
}
}
//// Setup connections for instances
//SceneNode *targetSceneNode = new SceneNode(cameraCopy);
//((Ogre::MovableObject *)cameraCopy)->setUserAny(Ogre::Any(targetSceneNode));
//if (!((Ogre::MovableObject *)camera)->getUserAny().isEmpty()) {
// SceneNode *sourceSceneNode = Ogre::any_cast<SceneNode *>(((Ogre::MovableObject *)camera)->getUserAny());
// if (sourceSceneNode) {
// QObject::connect(sourceSceneNode, SIGNAL(sceneNodeUpdated()), targetSceneNode, SLOT(updateSceneNode()));
// }
//}
result = dynamic_cast<Ogre::MovableObject *>(cameraCopy);
}
if (!result)
Log::error(QString("Could not clone movable object \"%1\" of type \"%2\".").arg(movableObject->getName().c_str()).arg(typeName.c_str()), "OgreTools::cloneMovableObject");
return result;
}
示例3: camera_set_lod_bias
//Ogre::Camera::setLodBias(float)
void camera_set_lod_bias(CameraHandle handle, coiReal factor)
{
Ogre::Camera* camera = static_cast<Ogre::Camera*>(handle);
camera->setLodBias(factor);
}