本文整理汇总了C++中Viewport::getActualWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewport::getActualWidth方法的具体用法?C++ Viewport::getActualWidth怎么用?C++ Viewport::getActualWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewport
的用法示例。
在下文中一共展示了Viewport::getActualWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createListener
CompositorInstance::Listener* HDRLogic::createListener(CompositorInstance* instance)
{
HDRListener* listener = new HDRListener(mApp);
Viewport* vp = instance->getChain()->getViewport();
listener->notifyViewportSize(vp->getActualWidth(), vp->getActualHeight());
listener->mViewportWidth = vp->getActualWidth();
listener->mViewportHeight = vp->getActualHeight();
listener->notifyCompositor(instance);
return listener;
}
示例2: createViewports
void TutorialApplication::createViewports() {
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));
mCamera->setAspectRatio(
Real(vp->getActualWidth() /
Real(vp->getActualHeight())));
}
示例3: initScene
void ShortStory::initScene ()
{
// on crée la fenêtre
mWindow = mRoot->initialise(true, "Short Story");
// on charge les ressources pour de vrai
TextureManager::getSingleton().setDefaultNumMipmaps(5);
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// on crée le scene manager
mSceneMgr = mRoot->createSceneManager("DefaultSceneManager", "Scene Manager");
mSceneMgr->setAmbientLight(ColourValue(1.0f, 1.0f, 1.0f));
// on crée la caméra
mCamera = mSceneMgr->createCamera("PlayerCam");
mCamera->setPosition(Vector3(0, 0, 100));
mCamera->lookAt(Vector3(0, 0, 0));
mCamera->setNearClipDistance(5);
if (mRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
{
mCamera->setFarClipDistance(0); // enable infinite far clip distance if we can
}
else{
mCamera->setFarClipDistance(2000);
}
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0, 0, 0));
mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
示例4: startup
int startup()
{
_root = new Root("plugins_d.cfg");
if (!_root->showConfigDialog()) {
return -1;
}
RenderWindow* window = _root->initialise(true, "Lab 4");
_sceneManager = _root->createSceneManager(ST_GENERIC);
Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(0,0,50));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Viewport *viewPort = window->addViewport(camera);
viewPort->setBackgroundColour(ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Real(viewPort->getActualWidth())/Real(viewPort->getActualHeight()));
loadResources();
createScene();
_listener = new MyFrameListener(window, camera, new CylindricalEffect(_myCube, Ogre::Vector3(2.0, 10.0, 0.0), Ogre::Vector3(0.0, 0.0, 0.1)));
_root->addFrameListener(_listener);
return 0;
}
示例5: execute
virtual void execute(SceneManager *sm, RenderSystem *rs)
{
// Fire listener
instance->_fireNotifyMaterialRender(pass_id, mat);
Rectangle2D * mRectangle=static_cast<Rectangle2D *>(CompositorManager::getSingleton()._getTexturedRectangle2D());
if (mQuadCornerModified)
{
// insure positions are using peculiar render system offsets
RenderSystem* rs = Root::getSingleton().getRenderSystem();
Viewport* vp = rs->_getViewport();
Real hOffset = rs->getHorizontalTexelOffset() / (0.5 * vp->getActualWidth());
Real vOffset = rs->getVerticalTexelOffset() / (0.5 * vp->getActualHeight());
mRectangle->setCorners(mQuadLeft + hOffset, mQuadTop - vOffset, mQuadRight + hOffset, mQuadBottom - vOffset);
}
// Queue passes from mat
Technique::PassIterator i = technique->getPassIterator();
while(i.hasMoreElements())
{
sm->_injectRenderWithPass(
i.getNext(),
mRectangle,
false // don't allow replacement of shadow passes
);
}
}
示例6: getValueImpl
//-----------------------------------------------------------------------
Real DistanceLodStrategyBase::getValueImpl(const MovableObject *movableObject, const Ogre::Camera *camera) const
{
Real squaredDepth = getSquaredDepth(movableObject, camera);
// Check if reference view needs to be taken into account
if (mReferenceViewEnabled)
{
// Reference view only applicable to perspective projection
assert(camera->getProjectionType() == PT_PERSPECTIVE && "Camera projection type must be perspective!");
// Get camera viewport
Viewport *viewport = camera->getViewport();
// Get viewport area
Real viewportArea = static_cast<Real>(viewport->getActualWidth() * viewport->getActualHeight());
// Get projection matrix (this is done to avoid computation of tan(FOV / 2))
const Matrix4& projectionMatrix = camera->getProjectionMatrix();
// Compute bias value (note that this is similar to the method used for PixelCountLodStrategy)
Real biasValue = viewportArea * projectionMatrix[0][0] * projectionMatrix[1][1];
// Scale squared depth appropriately
squaredDepth *= (mReferenceViewValue / biasValue);
}
// Squared depth should never be below 0, so clamp
squaredDepth = std::max(squaredDepth, Real(0));
// Now adjust it by the camera bias and return the computed value
return squaredDepth * camera->_getLodBiasInverse();
}
示例7: System
CEGuiOgreBaseApplication::CEGuiOgreBaseApplication() :
d_ogreRoot(0),
d_renderer(0),
d_initialised(false),
d_frameListener(0),
d_windowEventListener(0)
{
using namespace Ogre;
d_ogreRoot = new Root();
initialiseResources();
if (d_ogreRoot->showConfigDialog())
{
// initialise system according to user options.
d_window = d_ogreRoot->initialise(true);
// Create the scene manager
SceneManager* sm = d_ogreRoot->
createSceneManager(ST_GENERIC, "SampleSceneMgr");
// Create and initialise the camera
d_camera = sm->createCamera("SampleCam");
d_camera->setPosition(Vector3(0,0,500));
d_camera->lookAt(Vector3(0,0,-300));
d_camera->setNearClipDistance(5);
// Create a viewport covering whole window
Viewport* vp = d_window->addViewport(d_camera);
vp->setBackgroundColour(ColourValue(0,0,0));
// Update the camera aspect ratio to that of the viewport
d_camera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
// initialise resources
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// initialise GUI system
d_renderer = new CEGUI::OgreCEGUIRenderer(d_window, RENDER_QUEUE_OVERLAY, false, 0, sm);
new CEGUI::System(d_renderer);
// create frame listener
d_frameListener= new CEGuiDemoFrameListener(this, d_window, d_camera);
d_ogreRoot->addFrameListener(d_frameListener);
// add a listener for OS framework window events (for resizing)
d_windowEventListener = new WndEvtListener(d_renderer);
WindowEventUtilities::addWindowEventListener(d_window,
d_windowEventListener);
d_initialised = true;
}
else
{
// aborted. Clean up and set root to 0 so when app attempts to run it knows what happened here.
delete d_ogreRoot;
d_ogreRoot = 0;
}
}
示例8: getMouseRay
Ray TutorialApplication::getMouseRay() {
const OIS::MouseState s = mMouse->getMouseState();
Viewport *vp = m_SceneMgr->getCurrentViewport();
return mCamera->getCameraToViewportRay(
(Real) s.X.abs / vp->getActualWidth(),
(Real) s.Y.abs / vp->getActualHeight());
}
示例9: createViewports
//-------------------------------------------------------------------------------------
void BaseApplication::createViewports(void) {
// Create one viewport, entire window
Viewport *vp = _window->addViewport();
vp->clear(FBT_COLOUR | FBT_DEPTH, Ogre::ColourValue(0,0,0));
// Alter the camera aspect ratio to match the viewport
_camera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
示例10: createViewports
void BunBunApplication::createViewports(){
// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
示例11: go
void go(void)
{
// OGRE의 메인 루트 오브젝트 생성
#if !defined(_DEBUG)
mRoot = new Root("plugins.cfg", "ogre.cfg", "ogre.log");
#else
mRoot = new Root("plugins_d.cfg", "ogre.cfg", "ogre.log");
#endif
// 초기 시작의 컨피규레이션 설정 - ogre.cfg 이용
if (!mRoot->restoreConfig()) {
if (!mRoot->showConfigDialog()) return;
}
mWindow = mRoot->initialise(true, "Hello Professor : Copyleft Dae-Hyun Lee");
// ESC key를 눌렀을 경우, 오우거 메인 렌더링 루프의 탈출을 처리
size_t windowHnd = 0;
std::ostringstream windowHndStr;
OIS::ParamList pl;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
mInputManager = OIS::InputManager::createInputSystem(pl);
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, false));
mESCListener = new ESCListener(mKeyboard);
mRoot->addFrameListener(mESCListener);
mSceneMgr = mRoot->createSceneManager(ST_GENERIC);
mCamera = mSceneMgr->createCamera("camera");
mCamera->setPosition(0.0f, 200.0f, 300.0f);
mCamera->lookAt(0.0f, 100.0f, 0.00f);
mCamera->setNearClipDistance(5.0f);
mViewport = mWindow->addViewport(mCamera);
mViewport->setBackgroundColour(ColourValue(0.0f,0.0f,0.5f));
mCamera->setAspectRatio(Real(mViewport->getActualWidth()) / Real(mViewport->getActualHeight()));
ResourceGroupManager::getSingleton().addResourceLocation("resource.zip", "Zip");
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
mSceneMgr->setAmbientLight(ColourValue(1.0f, 1.0f, 1.0f));
Entity* daehyunEntity = mSceneMgr->createEntity("Daehyun", "DustinBody.mesh");
SceneNode* daehyunNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
daehyunNode->attachObject(daehyunEntity);
mRoot->startRendering();
mInputManager->destroyInputObject(mKeyboard);
OIS::InputManager::destroyInputSystem(mInputManager);
delete mRoot;
}
示例12: createViewports
void createViewports(void){
// Create one viewport, entire window, and tie it to our camera
vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
示例13: createViewports
virtual void createViewports()
{
// Create one viewport, entire window.
Viewport *vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0, 0.25, 0.5));
// Alter the camera aspect ratio to match the viewport.
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
示例14: createViewports
void Project_Gravity::createViewports(void)
{
std::cout<<"create viewports"<<std::endl;
// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
}
示例15: createViewPort
void Main::createViewPort() {
Viewport *vp = window->addViewport(camera);
vp->setBackgroundColour(ColourValue(0,0,0));
camera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()*1.17));
//camera->setAspectRatio(1.17);
vp->update();
}