Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F123451
Screen.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
Screen.cpp
View Options
#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
Details
Attached
Mime Type
text/x-c++
Expires
Wed, Jan 15, 11:37 PM (12 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72092
Default Alt Text
Screen.cpp (1 KB)
Attached To
Mode
rEE Echo 3
Attached
Detach File
Event Timeline
Log In to Comment