本文整理汇总了C++中ogre::Camera::setNearClipDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::setNearClipDistance方法的具体用法?C++ Camera::setNearClipDistance怎么用?C++ Camera::setNearClipDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::setNearClipDistance方法的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: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(500,100,500));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例3: 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()));
}
示例4: main
int main(int argc, char* argv[]){
cout << "Test Ogre Program blaha" << endl;
//Relative to where its executed from, not binary location
Ogre::Root *mRoot = new Ogre::Root("configs/plugins.cfg","configs/config.cfg","logs/main.log");
if(!(mRoot->restoreConfig() || mRoot->showConfigDialog())){
delete mRoot;
return -1;
}
// setup resources
// Only add the minimally required resource locations to load up the Ogre head mesh
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs/GLSL", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/scripts", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/textures", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/models", "FileSystem", "General");
//Create the window
Ogre::RenderWindow *mWindow = mRoot->initialise(true, "initial Render Window");
Ogre::SceneManager *sceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera *camera = sceneManager->createCamera("PlayerCam");
camera->setPosition(Ogre::Vector3(0,0,80));
camera->lookAt(Ogre::Vector3(0,0,-300));
camera->setNearClipDistance(5);
Ogre::Viewport* vp = mWindow->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0,0));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre::Entity* ogreHead = sceneManager->createEntity("Head","ogreHead.mesh");
Ogre::SceneNode* headNode = sceneManager->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);
sceneManager->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
//Run the system
bool continueRunning = true;
while(continueRunning){
mRoot->renderOneFrame();
headNode->rotate(Ogre::Vector3(0,1,0),Ogre::Radian(0.005));
if(mWindow->isClosed()){
continueRunning = false;
}
}
delete mRoot;
}
示例5: create_camera
void application::create_camera()
{
cam = scene_mgr->createCamera("PlayerCam");
cam->setPosition(Ogre::Vector3 {0, 0, 80});
cam->lookAt(Ogre::Vector3 {0, 0, -300});
cam->setNearClipDistance(5);
cameraman = new OgreBites::SdkCameraMan(cam);
}
示例6: 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);
}
示例7: createCamera
// funcion que configura la camara
void createCamera(Ogre::RenderWindow* window){
camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(0,60,-100));
camera->lookAt(Ogre::Vector3(0,0,50));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth())/Ogre::Real(viewport->getActualHeight()));
}
示例8: 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);
}
示例9: createOculusCamera
void CameraManager::createOculusCamera(){
Ogre::Camera *cameraLeft = mSceneMgr->createCamera("PlayerCamLeft");
Ogre::Camera *cameraRight = mSceneMgr->createCamera("PlayerCamRight");
cameraLeft->setNearClipDistance(0.5);
cameraRight->setNearClipDistance(0.5);
if(mOculusCamera == 0)
mOculusCamera = new OculusCamera(cameraLeft, cameraRight);
else{
mOculusCamera->setLeftCamera(cameraLeft);
mOculusCamera->setRightCamera(cameraRight);
}
mOculusCamera->setPosition(mNodePosition);
mOculusCamera->yaw(mNodeYaw);
mOculusCamera->pitch(mNodePitch);
mOculusCamera->roll(mNodeRoll);
}
示例10: 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);
}
示例11: 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);
}
}
示例12: createHumanPlayer
Player* PlayerManager::createHumanPlayer(const Ogre::String& name, Ogre::RenderWindow *window, GUI* gui)
{
// TODO: Handle Human Multiplayer, also this code should be somewhere else
Ogre::Camera *camera = mSceneMgr->createCamera("Player1");
camera->setNearClipDistance(NEAR_CLIP_DISTANCE);
Ogre::Viewport *vp = window->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
HumanController* hc = new HumanController(gui);
Player* player = createPlayer(name + "Human", hc, false);
player->attachCamera(camera);
return player;
}
示例13: 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()");
}
示例14: 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));
}
示例15: createSimpleCamera
void CameraManager::createSimpleCamera(){
Ogre::Camera *camera = mSceneMgr->createCamera("PlayerCam");
camera->setNearClipDistance(0.5);
if(mSimpleCamera == NULL)
mSimpleCamera = new SimpleCamera(camera);
else
mSimpleCamera->setCamera(camera);
mSimpleCamera->setPosition(mNodePosition);
mSimpleCamera->yaw(mNodeYaw);
mSimpleCamera->pitch(mNodePitch);
mSimpleCamera->roll(mNodeRoll);
}