本文整理汇总了C++中ogre::Camera::setOrthoWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::setOrthoWindow方法的具体用法?C++ Camera::setOrthoWindow怎么用?C++ Camera::setOrthoWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::setOrthoWindow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: ZCameraInfo
void
CinematicManager::createOrthoCamera(Ogre::Real windowW, Ogre::Real windowH, const Ogre::Vector3 &initialPos,
const Ogre::Quaternion &initialOrient, Control* control)
{
Ogre::Camera* cam = _scnMgr->createCamera(ORTHO_CAM_NAME + Ogre::StringConverter::toString(_camCurId));
cam->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
cam->setOrthoWindow(100, 50);
cam->setNearClipDistance(1);
cam->setPosition(0.0f, 0.0f, 0.0f);
//cam->setFarClipDistance(100.0f);
cam->setFOVy(Ogre::Radian(Ogre::Math::PI / 2.0f));
Ogre::SceneNode* defaultNode = _scnMgr->createSceneNode();
defaultNode->setPosition(initialPos);
defaultNode->setOrientation(initialOrient);
defaultNode->attachObject(cam);
_camsVec.push_back(new ZCameraInfo(_camsVec.size(), "ORTHOGRAPHIC", cam->getName(), control, cam));
}
示例3: createTriangleScene
/**
* This is the most basic "triangle" example, done as a Scene in Ogre.
*/
Ogre::SceneManager* createTriangleScene() {
Ogre::SceneManager* scene = mRoot->createSceneManager(Ogre::ST_GENERIC);
// Configure camera (~ view & projection transforms, i.e. gluLookAt + glOrtho)
Ogre::Camera* camera = scene->createCamera("MainCamera"); // We can use an arbitrary name here
camera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
camera->setOrthoWindow(2, 2); // ~ glOrtho(-1, 1, -1, 1)
camera->setAspectRatio((float) mWindow->getWidth() / mWindow->getHeight());
camera->setNearClipDistance(0.5);
camera->setPosition(Ogre::Vector3(0,0,1)); // Move camera away from (0, 0, 0), otherwise the triangle at z=0 will be clipped
// Now add some geometry to the scene
Ogre::ManualObject* triangle = scene->createManualObject("Triangle");
// ~ glBegin, glVertex, glEnd
// "BaseWhiteNoLighting" is a built-in name for a basic non-lit material
triangle->begin("BaseWhiteNoLighting", Ogre::RenderOperation::OT_TRIANGLE_LIST);
triangle->position(0, 0.5, 0); // ~ glVertex.
// Contrary to OpenGL we *first* must create the vertex
triangle->colour(Ogre::ColourValue::Red); // .. and then provide its attributes such as color (~ glColor)
triangle->position(-0.5, -0.5, 0);
triangle->colour(Ogre::ColourValue::Green);
triangle->position(0.5, -0.5, 0);
triangle->colour(Ogre::ColourValue::Blue);
triangle->end();
// Add the created triangle object to the scene graph
// For this we create a SceneNode object, which will combine information about
// the object's geometry with its modeling transform
// (see frameRenderingQueued to understand how to rotate the triangle by changing this transform)
scene->getRootSceneNode()->createChildSceneNode("Triangle")->attachObject(triangle);
// Exercise 1: Create new object, add vertices, attach the object to a new SceneNode
// ...
return scene;
}