Merge pull request #513 from sigatrev/ActorFrameTexture

Actor frame texture
This commit is contained in:
Colby Klein
2015-03-18 21:33:17 -07:00
6 changed files with 250 additions and 1 deletions
+2
View File
@@ -244,6 +244,8 @@ public:
*/
virtual unsigned CreateRenderTarget( const RenderTargetParam &, int & /* iTextureWidthOut */, int & /* iTextureHeightOut */ ) { return 0; }
virtual unsigned GetRenderTarget() { return 0; }
/* Set the render target, or 0 to resume rendering to the framebuffer. An active render
* target may not be used as a texture. If bPreserveTexture is true, the contents
* of the texture will be preserved from the previous call; otherwise, cleared. If
+9
View File
@@ -2411,6 +2411,7 @@ void RenderTarget_FramebufferObject::Create( const RenderTargetParam &param, int
glGenRenderbuffersEXT( 1, reinterpret_cast<GLuint*>(&m_iDepthBufferHandle) );
ASSERT( m_iDepthBufferHandle != 0 );
glBindRenderbufferEXT( GL_RENDERBUFFER, m_iDepthBufferHandle );
glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, iTextureWidth, iTextureHeight );
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_iDepthBufferHandle );
}
@@ -2474,6 +2475,14 @@ unsigned RageDisplay_Legacy::CreateRenderTarget( const RenderTargetParam &param,
return iTexture;
}
unsigned RageDisplay_Legacy::GetRenderTarget( )
{
for( map<unsigned, RenderTarget*>::const_iterator it = g_mapRenderTargets.begin( ); it != g_mapRenderTargets.end( ); ++it )
if( it->second == g_pCurrentRenderTarget )
return it->first;
return 0;
}
void RageDisplay_Legacy::SetRenderTarget( unsigned iTexture, bool bPreserveTexture )
{
if (iTexture == 0)
+1
View File
@@ -71,6 +71,7 @@ public:
bool IsEffectModeSupported( EffectMode effect );
bool SupportsRenderToTexture() const;
unsigned CreateRenderTarget( const RenderTargetParam &param, int &iTextureWidthOut, int &iTextureHeightOut );
unsigned GetRenderTarget();
void SetRenderTarget( unsigned iHandle, bool bPreserveTexture );
bool IsZWriteEnabled() const;
bool IsZTestEnabled() const;
+2 -1
View File
@@ -47,6 +47,7 @@ void RageTextureRenderTarget::Destroy()
void RageTextureRenderTarget::BeginRenderingTo( bool bPreserveTexture )
{
m_iPreviousRenderTarget = DISPLAY->GetRenderTarget( );
DISPLAY->SetRenderTarget( m_iTexHandle, bPreserveTexture );
/* We're rendering to a texture, not the framebuffer.
@@ -69,7 +70,7 @@ void RageTextureRenderTarget::FinishRenderingTo()
DISPLAY->CameraPopMatrix();
DISPLAY->PopMatrix();
DISPLAY->SetRenderTarget( 0 );
DISPLAY->SetRenderTarget( m_iPreviousRenderTarget );
}
// lua start
+1
View File
@@ -27,6 +27,7 @@ private:
void Create();
void Destroy();
unsigned m_iTexHandle;
unsigned m_iPreviousRenderTarget;
};
#endif