本文整理汇总了C++中ogre::Camera::setFarClipDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::setFarClipDistance方法的具体用法?C++ Camera::setFarClipDistance怎么用?C++ Camera::setFarClipDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::setFarClipDistance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
int Hundir::start() {
_root = new Ogre::Root();
if(!_root->restoreConfig()) {
_root->showConfigDialog();
_root->saveConfig();
}
Ogre::RenderWindow* window = _root->initialise(true,"Hundir Example");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* cam = _sceneManager->createCamera("MainCamera");
cam->setPosition(Ogre::Vector3(-10,30,35));
cam->lookAt(Ogre::Vector3(0,0,0));
cam->setNearClipDistance(5);
cam->setFarClipDistance(10000);
Ogre::Viewport* viewport = window->addViewport(cam);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
double width = viewport->getActualWidth();
double height = viewport->getActualHeight();
cam->setAspectRatio(width / height);
loadResources();
createScene();
_framelistener = new MyFrameListener(window, cam, _sceneManager);
_root->addFrameListener(_framelistener);
_root->startRendering();
return 0;
}
示例2: loadMesh
//-------------------------------------------------------------------------------------------
void MagickWidget::loadMesh(Ogre::MeshPtr pMesh)
{
QString directory(OgitorsRoot::getSingletonPtr()->GetProjectOptions()->ProjectDir.c_str());
if(directory.isEmpty())
directory = "./";
QDir(directory).mkpath("entitycache");
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual( "MeshMagickTex",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
512, 512, 0, Ogre::PF_R8G8B8A8 , Ogre::TU_RENDERTARGET );
Ogre::RenderTexture *rttTex = texture->getBuffer()->getRenderTarget();
Ogre::SceneManager *mSceneMgr = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "MeshMagickTexMgr");
Ogre::Light *dirl = mSceneMgr->createLight("DisplayLight");
dirl->setDirection(-1,-1,-1);
dirl->setDiffuseColour(1,1,1);
dirl->setType(Ogre::Light::LT_DIRECTIONAL);
Ogre::Camera* RTTCam = mSceneMgr->createCamera("MeshMagickCam");
RTTCam->setNearClipDistance(0.01F);
RTTCam->setFarClipDistance(0);
RTTCam->setAspectRatio(1);
RTTCam->setFOVy(Ogre::Degree(90));
RTTCam->setPosition(0,0,1);
RTTCam->lookAt(0,0,0);
Ogre::Viewport *v = rttTex->addViewport( RTTCam );
v->setClearEveryFrame( true );
v->setBackgroundColour(Ogre::ColourValue(0,0,0));
Ogre::Entity *mEntity;
mEntity = mSceneMgr->createEntity("scbDisplay", pMesh->getName());
mSceneMgr->getRootSceneNode()->attachObject(mEntity);
Ogre::Vector3 vSize = mEntity->getBoundingBox().getHalfSize();
Ogre::Vector3 vCenter = mEntity->getBoundingBox().getCenter();
vSize += Ogre::Vector3(vSize.z, vSize.z, vSize.z);
float maxsize = std::max(std::max(vSize.x,vSize.y),vSize.z);
vSize = Ogre::Vector3(0, 0, maxsize * 1.15f) + vCenter;
RTTCam->setPosition(vSize.x,vSize.y,vSize.z);
RTTCam->lookAt(vCenter.x,vCenter.y,vCenter.z);
rttTex->update();
Ogre::String imagefile = OgitorsUtils::QualifyPath(directory.toStdString() + "/entitycache/meshmagick.png");
rttTex->writeContentsToFile(imagefile);
mEntity->detachFromParent();
mSceneMgr->destroyEntity(mEntity);
rttTex->removeAllViewports();
Ogre::Root::getSingletonPtr()->destroySceneManager(mSceneMgr);
mDisplayWidget->setImage(QString(imagefile.c_str()));
}
示例3: createCamera
void GraphicsImpl::createCamera()
{
camera = sceneMgr->createCamera("MainCamera");
// Position it at 500 in Z direction
camera->setPosition(Ogre::Vector3(0, 50, 100));
// Look back along -Z
camera->lookAt(Ogre::Vector3(0, -10, 0));
camera->setNearClipDistance(5);
camera->setFarClipDistance(0);
}
示例4: createCamera
void BaseApp::createCamera()
{
Ogre::Camera* cam = mSceneMgr->createCamera("PlayerCam");
cam->setPosition(0,0,0);
cam->lookAt(0,0,0);
//cam->setAutoAspectRatio(true);
cam->setNearClipDistance(1);
cam->setFarClipDistance(10000);
mCameraMan = new OgreBites::SdkCameraMan(cam);
mCameraMan->setTopSpeed(1000);
}
示例5: GenerateRelief
void ReliefApp::GenerateRelief()
{
//Get depth data
Ogre::TexturePtr depthTex = Ogre::TextureManager::getSingleton().createManual(
"DepthTexture", // name
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, // type
512, // width
512, // height
0, // number of mipmaps
//Ogre::PF_B8G8R8A8, // pixel format
Ogre::PF_FLOAT32_R,
Ogre::TU_RENDERTARGET
);
Ogre::RenderTarget* pTarget = depthTex->getBuffer()->getRenderTarget();
Ogre::Camera* pOrthCam = MagicCore::RenderSystem::GetSingleton()->GetMainCamera();
pOrthCam->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
pOrthCam->setOrthoWindow(3, 3);
pOrthCam->setPosition(0, 0, 3);
pOrthCam->lookAt(0, 0, 0);
pOrthCam->setAspectRatio(1.0);
pOrthCam->setNearClipDistance(0.5);
pOrthCam->setFarClipDistance(5);
Ogre::Viewport* pViewport = pTarget->addViewport(pOrthCam);
pViewport->setDimensions(0, 0, 1, 1);
MagicCore::RenderSystem::GetSingleton()->RenderLightMesh3D("RenderMesh", "Depth", mpLightMesh);
MagicCore::RenderSystem::GetSingleton()->Update();
Ogre::Image img;
depthTex->convertToImage(img);
std::vector<double> heightField(512 * 512);
for(int x = 0; x < 512; x++)
{
for(int y = 0; y < 512; y++)
{
heightField.at(x * 512 + y) = (img.getColourAt(x, 511 - y, 0))[1];
}
}
Ogre::TextureManager::getSingleton().remove("DepthTexture");
//
MagicDGP::LightMesh3D* pReliefMesh = MagicDGP::ReliefGeneration::PlaneReliefFromHeightField(heightField, 511, 511);
//MagicDGP::LightMesh3D* pReliefMesh = MagicDGP::ReliefGeneration::CylinderReliefFromHeightField(heightField, 511, 511);
if (pReliefMesh != NULL)
{
delete mpLightMesh;
mpLightMesh = pReliefMesh;
mpLightMesh->UnifyPosition(2);
mpLightMesh->UpdateNormal();
}
MagicCore::RenderSystem::GetSingleton()->SetupCameraDefaultParameter();
MagicCore::RenderSystem::GetSingleton()->RenderLightMesh3D("RenderMesh", "MyCookTorrance", mpLightMesh);
}
示例6: processCamera
void DotSceneLoader::processCamera(rapidxml::xml_node<>* XMLNode,
Ogre::SceneNode *pParent) {
// Process attributes
Ogre::String name = getAttrib(XMLNode, "name");
Ogre::String id = getAttrib(XMLNode, "id");
// Ogre::Real fov = getAttribReal(XMLNode, "fov", 45);
// Ogre::Real aspectRatio = getAttribReal(XMLNode, "aspectRatio", 1.3333);
Ogre::String projectionType = getAttrib(XMLNode, "projectionType",
"perspective");
// Create the camera
Ogre::Camera *pCamera = mSceneMgr->createCamera(name);
// Set the projection type
if (projectionType == "perspective")
pCamera->setProjectionType(Ogre::PT_PERSPECTIVE);
else if (projectionType == "orthographic")
pCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
rapidxml::xml_node<>* pElement;
// Process clipping (?)
pElement = XMLNode->first_node("clipping");
if (pElement) {
Ogre::Real nearDist = getAttribReal(pElement, "near");
if (nearDist > 0)
pCamera->setNearClipDistance(nearDist);
Ogre::Real farDist = getAttribReal(pElement, "far");
pCamera->setFarClipDistance(farDist);
}
// Process position (?)
pElement = XMLNode->first_node("position");
if (pElement)
pCamera->setPosition(parseVector3(pElement));
// Process rotation (?)
pElement = XMLNode->first_node("rotation");
if (pElement)
pCamera->setOrientation(parseQuaternion(pElement));
// construct a scenenode is no parent
if (!pParent) {
Ogre::SceneNode* pNode = mAttachNode->createChildSceneNode(name);
pNode->setPosition(pCamera->getPosition());
pNode->setOrientation(pCamera->getOrientation());
pNode->scale(1, 1, 1);
}
}
示例7: setupScene
static void setupScene()
{
LOGI("------->setupScene()");
Ogre::ConfigFile cf;
cf.load(openAPKFile("resources.cfg"));
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
while (seci.hasMoreElements())
{
Ogre::String sec, type, arch;
sec = seci.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); i++)
{
type = i->first;
arch = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
}
}
Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup(
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
gSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = gSceneMgr->createCamera("MyCam");
Ogre::Entity* pEntity = gSceneMgr->createEntity("SinbadInstance", "Sinbad.mesh");
Ogre::SceneNode* pNode = gSceneMgr->getRootSceneNode()->createChildSceneNode();
pNode->attachObject(pEntity);
Ogre::Light* pDirLight = gSceneMgr->createLight();
pDirLight->setDirection(Ogre::Vector3(0, -1, 0));
pDirLight->setType(Ogre::Light::LT_DIRECTIONAL);
pNode->attachObject(pDirLight);
camera->setNearClipDistance(1.0f);
camera->setFarClipDistance(100000.0f);
camera->setPosition(0, 0, 20.0f);
camera->lookAt(0, 0, 0);
camera->setAutoAspectRatio(true);
Ogre::Viewport* vp = gRenderWnd->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(1, 0, 0));
LOGI("<-------setupScene()");
}
示例8: ZCameraInfo
//We're not sure whether return a reference to a vector is such a great idea.
void
CinematicManager::createPerspectiveCamera(Ogre::Real windowW, Ogre::Real windowH, const Ogre::Vector3 &initialPos,
const Ogre::Quaternion &initialOrient, Control* control)
{
Ogre::Camera* cam = _scnMgr->createCamera(PERSP_CAM_NAME + Ogre::StringConverter::toString(_camCurId));
cam->setNearClipDistance(1.0f);
cam->setFarClipDistance(400.0f);
cam->setPosition(0.0f, 0.0f, 0.0f);
cam->setAspectRatio(windowW / windowH);
Ogre::SceneNode* defaultNode = _scnMgr->createSceneNode();
defaultNode->setPosition(initialPos); //It's in local space.
defaultNode->setOrientation(initialOrient);
defaultNode->attachObject(cam);
_camsVec.push_back(new ZCameraInfo(_camsVec.size(), "PERSPECTIVE", cam->getName(), control, cam));
}
示例9: worldCenter
void
Geometry::setupView() {
Ogre::Camera * mCamera = OgreTrip::getCamera();
// put camera at world center, so that it's difficult to reach the edge
Vector3 worldCenter(
(ENDLESS_PAGE_MAX_X + ENDLESS_PAGE_MIN_X) / 2 * TERRAIN_WORLD_SIZE,
0,
-(ENDLESS_PAGE_MAX_Y + ENDLESS_PAGE_MIN_Y) / 2 * TERRAIN_WORLD_SIZE
);
//mCamera->setPosition(mTerrainPos + worldCenter);
//mCamera->lookAt(mTerrainPos);
mCamera->setNearClipDistance(0.1);
mCamera->setFarClipDistance(8000);
/*
if (OgreTrip::getRoot()->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE)) {
mCamera->setFarClipDistance(0); // enable infinite far clip distance if we can
}*/
}
示例10: start
int MyApp::start() {
_root = new Ogre::Root();
if(!_root->restoreConfig()) {
_root->showConfigDialog();
_root->saveConfig();
}
_pTrackManager = new TrackManager;
_pSoundFXManager = new SoundFXManager;
Ogre::RenderWindow* window = _root->initialise(true,"MyApp Example");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* cam = _sceneManager->createCamera("MainCamera");
cam->setPosition(Ogre::Vector3(7,10.5,8));
cam->lookAt(Ogre::Vector3(0,3.5,0));
cam->setNearClipDistance(5);
cam->setFarClipDistance(10000);
Ogre::Viewport* viewport = window->addViewport(cam);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
double width = viewport->getActualWidth();
double height = viewport->getActualHeight();
cam->setAspectRatio(width / height);
loadResources();
createScene();
createOverlay();
Ogre::SceneNode *node = _sceneManager->getSceneNode("Neptuno");
_framelistener = new MyFrameListener(this, window, cam, node, _overlayManager,
_sceneManager);
_root->addFrameListener(_framelistener);
// Reproducción del track principal...
this->_mainTrack->play();
_root->startRendering();
return 0;
}
示例11: plane
//----------------------------------------------------------------------------------------
ImageConverter::ImageConverter(const size_t& width/*=128*/, const size_t& height/*=128*/)
{
mWidth = width;
mHeight = height;
mResourceManager = Ogre::ResourceGroupManager::getSingletonPtr();
mResourceManager->createResourceGroup("QTImageConverter");
mResourceManager->initialiseResourceGroup("QTImageConverter");
mSceneMgrPtr = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "QTImageConverterSceneManager");
mSceneMgrPtr->setAmbientLight(Ogre::ColourValue(1, 1, 1));
Ogre::TexturePtr rendertexture = Ogre::TextureManager::getSingleton().createManual("RenderTex",
"QTImageConverter", Ogre::TEX_TYPE_2D,
mWidth, mHeight, 1, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);
mRttTex = rendertexture->getBuffer()->getRenderTarget();
// create our plane to set a texture to
Ogre::Plane plane(Ogre::Vector3::UNIT_Z, 0);
Ogre::MeshManager::getSingleton().createPlane("terrain", "QTImageConverter",
plane, 100, 100, 1, 1, true, 1, 1, 1, Ogre::Vector3::UNIT_Y);
// attach the plane to the scene manager and rotate it so the camera can see it
mEntityTerrain = mSceneMgrPtr->createEntity("terrainEntity", "terrain");
Ogre::SceneNode* node = mSceneMgrPtr->getRootSceneNode()->createChildSceneNode();
node->attachObject(mEntityTerrain);
mEntityTerrain->setCastShadows(false);
Ogre::Camera* RTTCam = mSceneMgrPtr->createCamera("QTImageConverterCam");
RTTCam->setNearClipDistance(0.01F);
RTTCam->setFarClipDistance(0);
RTTCam->setAspectRatio(1);
RTTCam->setFOVy(Ogre::Degree(90));
RTTCam->setPosition(0, 0, 50);
RTTCam->lookAt(0, 0, 0);
Ogre::Viewport *v = mRttTex->addViewport(RTTCam);
v->setBackgroundColour(Ogre::ColourValue(1, 1, 1));
v->setClearEveryFrame(true);
}
示例12: make
GameCamera* CameraFactory::make(const rapidjson::Value& jsonobj){
// Create the sphere
Ogre::Camera* camera = game_manager->GetSceneManager()->createCamera(jsonobj["name"].GetString());
SpaceObject*spaceobj=game_manager->getSpaceObject(jsonobj["attached_object"].GetString());
// Set the node's position
Eigen::Vector3f positionVec=spaceobj->position.cast<float>();
camera->setPosition(Ogre::Vector3( static_cast<Ogre::Real*>(positionVec.data()) ));
// Set the node's orientation
Eigen::Quaterniond attitude=spaceobj->attitude;
camera->setOrientation(Ogre::Quaternion(attitude.w(),attitude.x(),attitude.y(),attitude.z() ));
camera->setNearClipDistance(jsonobj["near_clip"].GetDouble());
camera->setFarClipDistance(jsonobj["far_clip"].GetDouble());
GameCamera* gamecamera=new GameCamera(camera,spaceobj);
return gamecamera;
}
示例13:
void
OgreCameraSystem::update(int) {
for (EntityId entityId : m_impl->m_entities.removedEntities()) {
Ogre::Camera* camera = m_impl->m_cameras[entityId];
if (camera) {
Ogre::SceneNode* sceneNode = camera->getParentSceneNode();
sceneNode->detachObject(camera);
m_impl->m_sceneManager->destroyCamera(camera);
}
m_impl->m_cameras.erase(entityId);
}
for (auto& value : m_impl->m_entities.addedEntities()) {
EntityId entityId = value.first;
OgreSceneNodeComponent* sceneNodeComponent = std::get<0>(value.second);
OgreCameraComponent* cameraComponent = std::get<1>(value.second);
Ogre::Camera* camera = m_impl->m_sceneManager->createCamera(
cameraComponent->name()
);
camera->setAutoAspectRatio(true);
cameraComponent->m_camera = camera;
m_impl->m_cameras[entityId] = camera;
sceneNodeComponent->m_sceneNode->attachObject(camera);
}
m_impl->m_entities.clearChanges();
for (auto& value : m_impl->m_entities) {
OgreCameraComponent* cameraComponent = std::get<1>(value.second);
auto& properties = cameraComponent->m_properties;
if (properties.hasChanges()) {
Ogre::Camera* camera = cameraComponent->m_camera;
// Update camera
camera->setPolygonMode(properties.polygonMode);
camera->setFOVy(properties.fovY);
camera->setNearClipDistance(properties.nearClipDistance);
camera->setFarClipDistance(properties.farClipDistance);
// Untouch
properties.untouch();
}
}
}
示例14: frameDraw
void Channel::frameDraw(const eq::uint128_t &frame_id)
{
// Setup OpenGL state (view frustum etc.)
eq::Channel::frameDraw(frame_id);
// Get data
const Config *config = static_cast<Config *>(getConfig());
const Node *node = static_cast<Node *>(getNode());
const InitData &init_data = node->getInitData();
const Pipe *pipe = static_cast<Pipe *>(getPipe());
const FrameData &frame_data = pipe->getFrameData();
Window *window = static_cast<Window *>(getWindow());
Ogre::Camera *cam = pipe->_ogre->getCamera();
// Set the projection matrix
const eq::Frustumf & frustum = getFrustum();
cam->setCustomProjectionMatrix(true, toOgreMatrix(frustum.compute_matrix()));
const eq::Matrix4f eqViewMatrix = getHeadTransform();
// Adjust the view matrix according to equalizer's view matrix
Ogre::Matrix4 ogreViewMatrix = toOgreMatrix(eqViewMatrix);
cam->setCustomViewMatrix(true, ogreViewMatrix);
cam->setNearClipDistance(frustum.near_plane());
cam->setFarClipDistance(frustum.far_plane());
// Set the viewport
eq::PixelViewport winPvp = window->getPixelViewport();
eq::PixelViewport pvp = getPixelViewport();
window->setViewport((float)pvp.x/(float)winPvp.w,
1.0f - (float)(pvp.h + pvp.y)/(float)winPvp.h,
(float)pvp.w/(float)winPvp.w,
(float)pvp.h/(float)winPvp.h);
// Render
window->render();
}
示例15: InitViewport
void OgreApplication::InitViewport(void){
try {
/* Retrieve scene manager and root scene node */
Ogre::SceneManager* scene_manager = ogre_root_->createSceneManager(Ogre::ST_GENERIC, "MySceneManager");
Ogre::SceneNode* root_scene_node = scene_manager->getRootSceneNode();
/* Create camera object */
Ogre::Camera* camera = scene_manager->createCamera("MyCamera");
Ogre::SceneNode* camera_scene_node = root_scene_node->createChildSceneNode("MyCameraNode");
camera_scene_node->attachObject(camera);
camera->setNearClipDistance(camera_near_clip_distance_g);
camera->setFarClipDistance(camera_far_clip_distance_g);
camera->setPosition(camera_position_g);
camera->lookAt(camera_look_at_g);
camera->setFixedYawAxis(true, camera_up_g);
/* Create viewport */
Ogre::Viewport *viewport = ogre_window_->addViewport(camera, viewport_z_order_g, viewport_left_g, viewport_top_g, viewport_width_g, viewport_height_g);
viewport->setAutoUpdated(true);
viewport->setBackgroundColour(viewport_background_color_g);
/* Set aspect ratio */
float ratio = float(viewport->getActualWidth()) / float(viewport->getActualHeight());
camera->setAspectRatio(ratio);
}
catch (Ogre::Exception &e){
throw(OgreAppException(std::string("Ogre::Exception: ") + std::string(e.what())));
}
catch(std::exception &e){
throw(OgreAppException(std::string("std::Exception: ") + std::string(e.what())));
}
}