Page MenuHomePhorge

Screen.cpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

Screen.cpp

#include <echo/Graphics/Scene.h>
#include <echo/GUI/Screen.h>
#include <echo/Graphics/RenderTarget.h>
#include <echo/Graphics/Camera.h>
namespace Echo
{
namespace GUI
{
Screen::Screen() : mUpdateSizeToCamera(true)
{
}
Screen::~Screen()
{
}
void Screen::Accept(SceneRenderableVisitor& visitor)
{
if(mUpdateSizeToCamera)
{
const Camera* camera = visitor.GetCurrentCamera();
if(camera)
{
if(camera->GetProjectionType()==ProjectionTypes::PERSPECTIVE)
{
Scalar distance = GetDerivedPosition().Distance(camera->GetPosition());
// Calculate so that the horizontal view takes up viewWidth units.
Radian halfFOVx = camera->GetFOV() / 2.f;
Scalar width = (Maths::Tan(halfFOVx.ValueRadians()) * distance) * 2.f;
Scalar height = width / camera->GetAspectRatio();
//The SetSize() function takes care of setting to the same size (i.e not causing an update)
SetSize(width,height);
}else
{
SetSize(camera->GetOrthoWindowWidth(),camera->GetOrthoWindowHeight());
}
}
}
SceneEntity::Accept(visitor);
}
}
}

File Metadata

Mime Type
text/x-c++
Expires
Wed, Jan 15, 11:37 PM (6 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72092
Default Alt Text
Screen.cpp (1 KB)

Event Timeline