Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F96992
RenderTargetNotifier.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
RenderTargetNotifier.cpp
View Options
#include
<echo/Graphics/RenderTargetNotifier.h>
#include
<echo/Graphics/RenderTarget.h>
namespace
Echo
{
RenderTargetNotifier
::
RenderTargetNotifier
()
{
}
RenderTargetNotifier
::~
RenderTargetNotifier
()
{
}
bool
RenderTargetNotifier
::
AddRenderTarget
(
const
std
::
string
&
name
,
shared_ptr
<
RenderTarget
>
renderTarget
,
bool
isPrimary
)
{
NamedRenderTargetMap
::
iterator
it
=
mRenderTargets
.
find
(
name
);
if
(
it
!=
mRenderTargets
.
end
())
{
ECHO_LOG_ERROR
(
"RenderTarget already associated with name
\"
"
<<
name
<<
"
\"
"
);
return
false
;
}
if
(
!
mPrimaryRenderTarget
||
isPrimary
)
{
mPrimaryRenderTarget
=
renderTarget
;
}
mRenderTargets
.
insert
(
std
::
make_pair
(
name
,
renderTarget
));
return
true
;
}
shared_ptr
<
RenderTarget
>
RenderTargetNotifier
::
GetRenderTarget
(
const
std
::
string
&
name
)
{
NamedRenderTargetMap
::
iterator
it
=
mRenderTargets
.
find
(
name
);
if
(
it
==
mRenderTargets
.
end
())
{
ECHO_LOG_ERROR
(
"RenderTarget not found where name
\"
"
<<
name
<<
"
\"
"
);
return
shared_ptr
<
RenderTarget
>
();
}
return
it
->
second
;
}
void
RenderTargetNotifier
::
RemoveRenderTarget
(
const
std
::
string
&
name
)
{
NamedRenderTargetMap
::
iterator
it
=
mRenderTargets
.
find
(
name
);
if
(
it
==
mRenderTargets
.
end
())
{
ECHO_LOG_ERROR
(
"RenderTarget not found where name
\"
"
<<
name
<<
"
\"
"
);
return
;
}
mRenderTargets
.
erase
(
it
);
}
void
RenderTargetNotifier
::
RemoveAllRenderTargets
()
{
mRenderTargets
.
clear
();
}
shared_ptr
<
RenderTarget
>
RenderTargetNotifier
::
GetPrimaryRenderTarget
()
const
{
return
mPrimaryRenderTarget
;
}
void
RenderTargetNotifier
::
GraphicsContextLost
()
{
for
(
NamedRenderTargetPair
&
namedRenderTarget
:
mRenderTargets
)
{
if
(
namedRenderTarget
.
second
)
{
namedRenderTarget
.
second
->
ContextLost
();
}
}
}
void
RenderTargetNotifier
::
GraphicsContextRestored
()
{
for
(
NamedRenderTargetPair
&
namedRenderTarget
:
mRenderTargets
)
{
if
(
namedRenderTarget
.
second
)
{
namedRenderTarget
.
second
->
ContextLost
();
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Thu, Dec 5, 6:46 PM (13 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63445
Default Alt Text
RenderTargetNotifier.cpp (2 KB)
Attached To
Mode
rEE Echo 3
Attached
Detach File
Event Timeline
Log In to Comment