From 756024e9f1c91d2e4e2e1c092a0b32a84137a45f Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 4 Mar 2014 15:07:28 +0800 Subject: [PATCH] implement interface setKeepMatrix, setVirtualViewPort --- cocos/2d/CCRenderTexture.cpp | 15 +++++++++++++++ cocos/2d/CCRenderTexture.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCRenderTexture.cpp b/cocos/2d/CCRenderTexture.cpp index 93d7a4599c..ec2e8034b6 100644 --- a/cocos/2d/CCRenderTexture.cpp +++ b/cocos/2d/CCRenderTexture.cpp @@ -301,6 +301,21 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat return ret; } +void RenderTexture::setKeepMatrix(bool keepMatrix) +{ + _keepMatrix = keepMatrix; +} + +void RenderTexture::setVirtualViewPort(const Point& rtBegin, const Rect& fullRect, const Rect& fullViewport) +{ + _rtTextureRect.origin.x = rtBegin.x; + _rtTextureRect.origin.y = rtBegin.y; + + _fullRect = fullRect; + + _fullviewPort = fullViewport; +} + void RenderTexture::beginWithClear(float r, float g, float b, float a) { beginWithClear(r, g, b, a, 0, 0, GL_COLOR_BUFFER_BIT); diff --git a/cocos/2d/CCRenderTexture.h b/cocos/2d/CCRenderTexture.h index 0502f7a7b8..4f6f1dfc95 100644 --- a/cocos/2d/CCRenderTexture.h +++ b/cocos/2d/CCRenderTexture.h @@ -158,7 +158,7 @@ public: virtual void draw(Renderer *renderer, const kmMat4 &transform, bool transformUpdated) override; void setKeepMatrix(bool keepMatrix); - void setVirtualViewPort(Point& rtBegin, Rect& fullRect, Rect& fullViewport); + void setVirtualViewPort(const Point& rtBegin, const Rect& fullRect, const Rect& fullViewport);