mirror of https://github.com/axmolengine/axmol.git
Refactor BackGround to Background
This commit is contained in:
parent
3e2001bdb1
commit
350182c1aa
|
@ -3603,10 +3603,10 @@
|
||||||
B6DD2FF61B04825B00E47F5F /* fastlz.c in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA51B04825B00E47F5F /* fastlz.c */; };
|
B6DD2FF61B04825B00E47F5F /* fastlz.c in Sources */ = {isa = PBXBuildFile; fileRef = B6DD2FA51B04825B00E47F5F /* fastlz.c */; };
|
||||||
B6DD2FF71B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; };
|
B6DD2FF71B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; };
|
||||||
B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; };
|
B6DD2FF81B04825B00E47F5F /* fastlz.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD2FA61B04825B00E47F5F /* fastlz.h */; };
|
||||||
B6DD36D51B8564EC0044745A /* CCCameraBackGroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD36D31B8564EC0044745A /* CCCameraBackGroundBrush.cpp */; };
|
B6DD36D51B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */; };
|
||||||
B6DD36D61B8564EC0044745A /* CCCameraBackGroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD36D31B8564EC0044745A /* CCCameraBackGroundBrush.cpp */; };
|
B6DD36D61B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */; };
|
||||||
B6DD36D71B8564EC0044745A /* CCCameraBackGroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD36D41B8564EC0044745A /* CCCameraBackGroundBrush.h */; };
|
B6DD36D71B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */; };
|
||||||
B6DD36D81B8564EC0044745A /* CCCameraBackGroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD36D41B8564EC0044745A /* CCCameraBackGroundBrush.h */; };
|
B6DD36D81B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */ = {isa = PBXBuildFile; fileRef = B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */; };
|
||||||
C50306691B60B583001E6D43 /* CCBoneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306631B60B583001E6D43 /* CCBoneNode.cpp */; };
|
C50306691B60B583001E6D43 /* CCBoneNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306631B60B583001E6D43 /* CCBoneNode.cpp */; };
|
||||||
C503066A1B60B583001E6D43 /* CCBoneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306641B60B583001E6D43 /* CCBoneNode.h */; };
|
C503066A1B60B583001E6D43 /* CCBoneNode.h in Headers */ = {isa = PBXBuildFile; fileRef = C50306641B60B583001E6D43 /* CCBoneNode.h */; };
|
||||||
C503066B1B60B583001E6D43 /* CCSkeletonNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */; };
|
C503066B1B60B583001E6D43 /* CCSkeletonNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */; };
|
||||||
|
@ -5550,8 +5550,8 @@
|
||||||
B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCacheBuilder.h; sourceTree = "<group>"; };
|
B6DD2FA31B04825B00E47F5F /* DetourTileCacheBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetourTileCacheBuilder.h; sourceTree = "<group>"; };
|
||||||
B6DD2FA51B04825B00E47F5F /* fastlz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fastlz.c; sourceTree = "<group>"; };
|
B6DD2FA51B04825B00E47F5F /* fastlz.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fastlz.c; sourceTree = "<group>"; };
|
||||||
B6DD2FA61B04825B00E47F5F /* fastlz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastlz.h; sourceTree = "<group>"; };
|
B6DD2FA61B04825B00E47F5F /* fastlz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fastlz.h; sourceTree = "<group>"; };
|
||||||
B6DD36D31B8564EC0044745A /* CCCameraBackGroundBrush.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCCameraBackGroundBrush.cpp; sourceTree = "<group>"; };
|
B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCCameraBackgroundBrush.cpp; sourceTree = "<group>"; };
|
||||||
B6DD36D41B8564EC0044745A /* CCCameraBackGroundBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCameraBackGroundBrush.h; sourceTree = "<group>"; };
|
B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCameraBackgroundBrush.h; sourceTree = "<group>"; };
|
||||||
C50306631B60B583001E6D43 /* CCBoneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBoneNode.cpp; sourceTree = "<group>"; };
|
C50306631B60B583001E6D43 /* CCBoneNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCBoneNode.cpp; sourceTree = "<group>"; };
|
||||||
C50306641B60B583001E6D43 /* CCBoneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBoneNode.h; sourceTree = "<group>"; };
|
C50306641B60B583001E6D43 /* CCBoneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCBoneNode.h; sourceTree = "<group>"; };
|
||||||
C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSkeletonNode.cpp; sourceTree = "<group>"; };
|
C50306651B60B583001E6D43 /* CCSkeletonNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSkeletonNode.cpp; sourceTree = "<group>"; };
|
||||||
|
@ -7333,8 +7333,8 @@
|
||||||
46A169A11807B037005B8026 /* 2d */ = {
|
46A169A11807B037005B8026 /* 2d */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B6DD36D31B8564EC0044745A /* CCCameraBackGroundBrush.cpp */,
|
B6DD36D31B8564EC0044745A /* CCCameraBackgroundBrush.cpp */,
|
||||||
B6DD36D41B8564EC0044745A /* CCCameraBackGroundBrush.h */,
|
B6DD36D41B8564EC0044745A /* CCCameraBackgroundBrush.h */,
|
||||||
3EACC99C19F5014D00EB3C5E /* CCCamera.cpp */,
|
3EACC99C19F5014D00EB3C5E /* CCCamera.cpp */,
|
||||||
3EACC99D19F5014D00EB3C5E /* CCCamera.h */,
|
3EACC99D19F5014D00EB3C5E /* CCCamera.h */,
|
||||||
3EACC99E19F5014D00EB3C5E /* CCLight.cpp */,
|
3EACC99E19F5014D00EB3C5E /* CCLight.cpp */,
|
||||||
|
@ -9338,7 +9338,7 @@
|
||||||
15AE1BDD19AAE01E00C27E9E /* CCControlUtils.h in Headers */,
|
15AE1BDD19AAE01E00C27E9E /* CCControlUtils.h in Headers */,
|
||||||
B6CAB3271AF9AA1A00B9B856 /* btGImpactBvh.h in Headers */,
|
B6CAB3271AF9AA1A00B9B856 /* btGImpactBvh.h in Headers */,
|
||||||
15AE198D19AAD36E00C27E9E /* CheckBoxReader.h in Headers */,
|
15AE198D19AAD36E00C27E9E /* CheckBoxReader.h in Headers */,
|
||||||
B6DD36D71B8564EC0044745A /* CCCameraBackGroundBrush.h in Headers */,
|
B6DD36D71B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */,
|
||||||
B29A7E0919EE1B7700872B35 /* AttachmentLoader.h in Headers */,
|
B29A7E0919EE1B7700872B35 /* AttachmentLoader.h in Headers */,
|
||||||
1A01C68818F57BE800EFE3A6 /* CCBool.h in Headers */,
|
1A01C68818F57BE800EFE3A6 /* CCBool.h in Headers */,
|
||||||
B29A7E3319EE1B7700872B35 /* SlotData.h in Headers */,
|
B29A7E3319EE1B7700872B35 /* SlotData.h in Headers */,
|
||||||
|
@ -10819,7 +10819,7 @@
|
||||||
B29A7DDA19EE1B7700872B35 /* SkeletonRenderer.h in Headers */,
|
B29A7DDA19EE1B7700872B35 /* SkeletonRenderer.h in Headers */,
|
||||||
15AE194119AAD35100C27E9E /* CCBone.h in Headers */,
|
15AE194119AAD35100C27E9E /* CCBone.h in Headers */,
|
||||||
D0FD035A1A3B51AA00825BB5 /* CCAllocatorStrategyDefault.h in Headers */,
|
D0FD035A1A3B51AA00825BB5 /* CCAllocatorStrategyDefault.h in Headers */,
|
||||||
B6DD36D81B8564EC0044745A /* CCCameraBackGroundBrush.h in Headers */,
|
B6DD36D81B8564EC0044745A /* CCCameraBackgroundBrush.h in Headers */,
|
||||||
50ABBD471925AB0000A911A9 /* CCVertex.h in Headers */,
|
50ABBD471925AB0000A911A9 /* CCVertex.h in Headers */,
|
||||||
B6CAB4D81AF9AA1A00B9B856 /* SpuLocalSupport.h in Headers */,
|
B6CAB4D81AF9AA1A00B9B856 /* SpuLocalSupport.h in Headers */,
|
||||||
B6CAB2921AF9AA1A00B9B856 /* btCollisionShape.h in Headers */,
|
B6CAB2921AF9AA1A00B9B856 /* btCollisionShape.h in Headers */,
|
||||||
|
@ -11051,7 +11051,7 @@
|
||||||
B6CAB2811AF9AA1A00B9B856 /* btBoxShape.cpp in Sources */,
|
B6CAB2811AF9AA1A00B9B856 /* btBoxShape.cpp in Sources */,
|
||||||
50ABBE311925AB6F00A911A9 /* CCConfiguration.cpp in Sources */,
|
50ABBE311925AB6F00A911A9 /* CCConfiguration.cpp in Sources */,
|
||||||
B665E3821AA80A6500DDB1C5 /* CCPUPathFollower.cpp in Sources */,
|
B665E3821AA80A6500DDB1C5 /* CCPUPathFollower.cpp in Sources */,
|
||||||
B6DD36D51B8564EC0044745A /* CCCameraBackGroundBrush.cpp in Sources */,
|
B6DD36D51B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */,
|
||||||
1A01C6A418F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */,
|
1A01C6A418F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */,
|
||||||
15AE1A5D19AAD40300C27E9E /* b2Body.cpp in Sources */,
|
15AE1A5D19AAD40300C27E9E /* b2Body.cpp in Sources */,
|
||||||
15AE1BDA19AAE01E00C27E9E /* CCControlSwitch.cpp in Sources */,
|
15AE1BDA19AAE01E00C27E9E /* CCControlSwitch.cpp in Sources */,
|
||||||
|
@ -12062,7 +12062,7 @@
|
||||||
3EACC9A519F5014D00EB3C5E /* CCLight.cpp in Sources */,
|
3EACC9A519F5014D00EB3C5E /* CCLight.cpp in Sources */,
|
||||||
15AE1B7A19AADA9A00C27E9E /* UIScrollView.cpp in Sources */,
|
15AE1B7A19AADA9A00C27E9E /* UIScrollView.cpp in Sources */,
|
||||||
1A570076180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */,
|
1A570076180BC5A10088DEC7 /* CCActionGrid3D.cpp in Sources */,
|
||||||
B6DD36D61B8564EC0044745A /* CCCameraBackGroundBrush.cpp in Sources */,
|
B6DD36D61B8564EC0044745A /* CCCameraBackgroundBrush.cpp in Sources */,
|
||||||
B6CAB38C1AF9AA1A00B9B856 /* btPolyhedralContactClipping.cpp in Sources */,
|
B6CAB38C1AF9AA1A00B9B856 /* btPolyhedralContactClipping.cpp in Sources */,
|
||||||
B6CAB3A41AF9AA1A00B9B856 /* btConeTwistConstraint.cpp in Sources */,
|
B6CAB3A41AF9AA1A00B9B856 /* btConeTwistConstraint.cpp in Sources */,
|
||||||
15AE19B219AAD39700C27E9E /* SliderReader.cpp in Sources */,
|
15AE19B219AAD39700C27E9E /* SliderReader.cpp in Sources */,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "2d/CCCamera.h"
|
#include "2d/CCCamera.h"
|
||||||
#include "2d/CCCameraBackGroundBrush.h"
|
#include "2d/CCCameraBackgroundBrush.h"
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
#include "platform/CCGLView.h"
|
#include "platform/CCGLView.h"
|
||||||
#include "2d/CCScene.h"
|
#include "2d/CCScene.h"
|
||||||
|
@ -97,7 +97,7 @@ Camera::Camera()
|
||||||
, _fbo(nullptr)
|
, _fbo(nullptr)
|
||||||
{
|
{
|
||||||
_frustum.setClipZ(true);
|
_frustum.setClipZ(true);
|
||||||
_clearBrush = CameraBackGroundBrush::createDepthBrush(1.f);
|
_clearBrush = CameraBackgroundBrush::createDepthBrush(1.f);
|
||||||
_clearBrush->retain();
|
_clearBrush->retain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ void Camera::clearBackground()
|
||||||
{
|
{
|
||||||
if (_clearBrush)
|
if (_clearBrush)
|
||||||
{
|
{
|
||||||
_clearBrush->drawBackGround(this);
|
_clearBrush->drawBackground(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ void Camera::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t par
|
||||||
return Node::visit(renderer, parentTransform, parentFlags);
|
return Node::visit(renderer, parentTransform, parentFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setBackGroundBrush(CameraBackGroundBrush* clearBrush)
|
void Camera::setBackgroundBrush(CameraBackgroundBrush* clearBrush)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(clearBrush);
|
CC_SAFE_RETAIN(clearBrush);
|
||||||
CC_SAFE_RELEASE(_clearBrush);
|
CC_SAFE_RELEASE(_clearBrush);
|
||||||
|
|
|
@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class Scene;
|
class Scene;
|
||||||
class CameraBackGroundBrush;
|
class CameraBackgroundBrush;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note:
|
* Note:
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static Camera* getDefaultCamera();
|
static Camera* getDefaultCamera();
|
||||||
/**
|
/**
|
||||||
Before rendering scene with this camera, the background need to be cleared. It clears the depth buffer with max depth by default. Use setBackGroundBrush to modify the default behavior
|
Before rendering scene with this camera, the background need to be cleared. It clears the depth buffer with max depth by default. Use setBackgroundBrush to modify the default behavior
|
||||||
*/
|
*/
|
||||||
void clearBackground();
|
void clearBackground();
|
||||||
/**
|
/**
|
||||||
|
@ -260,15 +260,15 @@ public:
|
||||||
bool isViewProjectionUpdated() const {return _viewProjectionUpdated;}
|
bool isViewProjectionUpdated() const {return _viewProjectionUpdated;}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the background brush. See CameraBackGroundBrush for more information.
|
* set the background brush. See CameraBackgroundBrush for more information.
|
||||||
* @param clearBrush Brush used to clear the background
|
* @param clearBrush Brush used to clear the background
|
||||||
*/
|
*/
|
||||||
void setBackGroundBrush(CameraBackGroundBrush* clearBrush);
|
void setBackgroundBrush(CameraBackgroundBrush* clearBrush);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get clear brush
|
* Get clear brush
|
||||||
*/
|
*/
|
||||||
CameraBackGroundBrush* getBackGroundBrush() const { return _clearBrush; }
|
CameraBackgroundBrush* getBackgroundBrush() const { return _clearBrush; }
|
||||||
|
|
||||||
virtual void visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
virtual void visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ protected:
|
||||||
int8_t _depth; //camera depth, the depth of camera with CameraFlag::DEFAULT flag is 0 by default, a camera with larger depth is drawn on top of camera with smaller detph
|
int8_t _depth; //camera depth, the depth of camera with CameraFlag::DEFAULT flag is 0 by default, a camera with larger depth is drawn on top of camera with smaller detph
|
||||||
static Camera* _visitingCamera;
|
static Camera* _visitingCamera;
|
||||||
|
|
||||||
CameraBackGroundBrush* _clearBrush; //brush used to clear the back ground
|
CameraBackgroundBrush* _clearBrush; //brush used to clear the back ground
|
||||||
|
|
||||||
experimental::Viewport _viewport;
|
experimental::Viewport _viewport;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "2d/CCCameraBackGroundBrush.h"
|
#include "2d/CCCameraBackgroundBrush.h"
|
||||||
#include "2d/CCCamera.h"
|
#include "2d/CCCamera.h"
|
||||||
#include "base/ccMacros.h"
|
#include "base/ccMacros.h"
|
||||||
#include "base/CCConfiguration.h"
|
#include "base/CCConfiguration.h"
|
||||||
|
@ -44,64 +44,64 @@
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
CameraBackGroundBrush::CameraBackGroundBrush()
|
CameraBackgroundBrush::CameraBackgroundBrush()
|
||||||
: _glProgramState(nullptr)
|
: _glProgramState(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundBrush::~CameraBackGroundBrush()
|
CameraBackgroundBrush::~CameraBackgroundBrush()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_glProgramState);
|
CC_SAFE_RELEASE(_glProgramState);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundBrush* CameraBackGroundBrush::createNoneBrush()
|
CameraBackgroundBrush* CameraBackgroundBrush::createNoneBrush()
|
||||||
{
|
{
|
||||||
auto ret = new (std::nothrow) CameraBackGroundBrush();
|
auto ret = new (std::nothrow) CameraBackgroundBrush();
|
||||||
ret->init();
|
ret->init();
|
||||||
|
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundColorBrush* CameraBackGroundBrush::createColorBrush(const Color4F& color, float depth)
|
CameraBackgroundColorBrush* CameraBackgroundBrush::createColorBrush(const Color4F& color, float depth)
|
||||||
{
|
{
|
||||||
return CameraBackGroundColorBrush::create(color, depth);
|
return CameraBackgroundColorBrush::create(color, depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundDepthBrush* CameraBackGroundBrush::createDepthBrush(float depth)
|
CameraBackgroundDepthBrush* CameraBackgroundBrush::createDepthBrush(float depth)
|
||||||
{
|
{
|
||||||
return CameraBackGroundDepthBrush::create(depth);
|
return CameraBackgroundDepthBrush::create(depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundSkyBoxBrush* CameraBackGroundBrush::createSkyboxBrush(const std::string& positive_x, const std::string& negative_x, const std::string& positive_y, const std::string& negative_y, const std::string& positive_z, const std::string& negative_z)
|
CameraBackgroundSkyBoxBrush* CameraBackgroundBrush::createSkyboxBrush(const std::string& positive_x, const std::string& negative_x, const std::string& positive_y, const std::string& negative_y, const std::string& positive_z, const std::string& negative_z)
|
||||||
{
|
{
|
||||||
return CameraBackGroundSkyBoxBrush::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
|
return CameraBackgroundSkyBoxBrush::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CameraBackGroundDepthBrush::CameraBackGroundDepthBrush()
|
CameraBackgroundDepthBrush::CameraBackgroundDepthBrush()
|
||||||
: _depth(0.f)
|
: _depth(0.f)
|
||||||
, _clearColor(GL_FALSE)
|
, _clearColor(GL_FALSE)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
CameraBackGroundDepthBrush::~CameraBackGroundDepthBrush()
|
CameraBackgroundDepthBrush::~CameraBackgroundDepthBrush()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundDepthBrush* CameraBackGroundDepthBrush::create(float depth)
|
CameraBackgroundDepthBrush* CameraBackgroundDepthBrush::create(float depth)
|
||||||
{
|
{
|
||||||
auto ret = new (std::nothrow) CameraBackGroundDepthBrush();
|
auto ret = new (std::nothrow) CameraBackgroundDepthBrush();
|
||||||
ret->_depth = depth;
|
ret->_depth = depth;
|
||||||
ret->init();
|
ret->init();
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CameraBackGroundDepthBrush::init()
|
bool CameraBackgroundDepthBrush::init()
|
||||||
{
|
{
|
||||||
auto shader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_CAMERA_CLEAR);
|
auto shader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_CAMERA_CLEAR);
|
||||||
_glProgramState = GLProgramState::getOrCreateWithGLProgram(shader);
|
_glProgramState = GLProgramState::getOrCreateWithGLProgram(shader);
|
||||||
|
@ -121,7 +121,7 @@ bool CameraBackGroundDepthBrush::init()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBackGroundDepthBrush::drawBackGround(Camera* camera)
|
void CameraBackgroundDepthBrush::drawBackground(Camera* camera)
|
||||||
{
|
{
|
||||||
GLboolean oldDepthTest;
|
GLboolean oldDepthTest;
|
||||||
GLint oldDepthFunc;
|
GLint oldDepthFunc;
|
||||||
|
@ -192,25 +192,25 @@ void CameraBackGroundDepthBrush::drawBackGround(Camera* camera)
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CameraBackGroundColorBrush::CameraBackGroundColorBrush()
|
CameraBackgroundColorBrush::CameraBackgroundColorBrush()
|
||||||
: _color(0.f, 0.f, 0.f, 0.f)
|
: _color(0.f, 0.f, 0.f, 0.f)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundColorBrush::~CameraBackGroundColorBrush()
|
CameraBackgroundColorBrush::~CameraBackgroundColorBrush()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBackGroundColorBrush::setColor(const Color4F& color)
|
void CameraBackgroundColorBrush::setColor(const Color4F& color)
|
||||||
{
|
{
|
||||||
_quad.bl.colors = _quad.br.colors = _quad.tl.colors = _quad.tr.colors = Color4B(color);
|
_quad.bl.colors = _quad.br.colors = _quad.tl.colors = _quad.tr.colors = Color4B(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundColorBrush* CameraBackGroundColorBrush::create(const Color4F& color, float depth)
|
CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& color, float depth)
|
||||||
{
|
{
|
||||||
auto ret = new (std::nothrow) CameraBackGroundColorBrush();
|
auto ret = new (std::nothrow) CameraBackgroundColorBrush();
|
||||||
ret->init();
|
ret->init();
|
||||||
ret->_clearColor = GL_TRUE;
|
ret->_clearColor = GL_TRUE;
|
||||||
ret->setColor(color);
|
ret->setColor(color);
|
||||||
|
@ -221,7 +221,7 @@ CameraBackGroundColorBrush* CameraBackGroundColorBrush::create(const Color4F& co
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
CameraBackGroundSkyBoxBrush::CameraBackGroundSkyBoxBrush()
|
CameraBackgroundSkyBoxBrush::CameraBackgroundSkyBoxBrush()
|
||||||
: _vao(0)
|
: _vao(0)
|
||||||
, _vertexBuffer(0)
|
, _vertexBuffer(0)
|
||||||
, _indexBuffer(0)
|
, _indexBuffer(0)
|
||||||
|
@ -238,7 +238,7 @@ CameraBackGroundSkyBoxBrush::CameraBackGroundSkyBoxBrush()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundSkyBoxBrush::~CameraBackGroundSkyBoxBrush()
|
CameraBackgroundSkyBoxBrush::~CameraBackgroundSkyBoxBrush()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ CameraBackGroundSkyBoxBrush::~CameraBackGroundSkyBoxBrush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundSkyBoxBrush* CameraBackGroundSkyBoxBrush::create(const std::string& positive_x, const std::string& negative_x, const std::string& positive_y, const std::string& negative_y, const std::string& positive_z, const std::string& negative_z)
|
CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create(const std::string& positive_x, const std::string& negative_x, const std::string& positive_y, const std::string& negative_y, const std::string& positive_z, const std::string& negative_z)
|
||||||
{
|
{
|
||||||
auto texture = TextureCube::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
|
auto texture = TextureCube::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
|
||||||
if (texture == nullptr)
|
if (texture == nullptr)
|
||||||
|
@ -269,7 +269,7 @@ CameraBackGroundSkyBoxBrush* CameraBackGroundSkyBoxBrush::create(const std::stri
|
||||||
tRepeatParams.wrapT = GL_CLAMP_TO_EDGE;
|
tRepeatParams.wrapT = GL_CLAMP_TO_EDGE;
|
||||||
texture->setTexParameters(tRepeatParams);
|
texture->setTexParameters(tRepeatParams);
|
||||||
|
|
||||||
auto ret = new(std::nothrow)CameraBackGroundSkyBoxBrush();
|
auto ret = new(std::nothrow)CameraBackgroundSkyBoxBrush();
|
||||||
|
|
||||||
ret->init();
|
ret->init();
|
||||||
ret->setTexture(texture);
|
ret->setTexture(texture);
|
||||||
|
@ -278,9 +278,9 @@ CameraBackGroundSkyBoxBrush* CameraBackGroundSkyBoxBrush::create(const std::stri
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundSkyBoxBrush* CameraBackGroundSkyBoxBrush::create()
|
CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create()
|
||||||
{
|
{
|
||||||
auto ret = new(std::nothrow)CameraBackGroundSkyBoxBrush();
|
auto ret = new(std::nothrow)CameraBackgroundSkyBoxBrush();
|
||||||
|
|
||||||
ret->init();
|
ret->init();
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ CameraBackGroundSkyBoxBrush* CameraBackGroundSkyBoxBrush::create()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBackGroundSkyBoxBrush::drawBackGround(Camera* camera)
|
void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera)
|
||||||
{
|
{
|
||||||
Mat4 cameraModelMat = camera->getNodeToWorldTransform();
|
Mat4 cameraModelMat = camera->getNodeToWorldTransform();
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ void CameraBackGroundSkyBoxBrush::drawBackGround(Camera* camera)
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CameraBackGroundSkyBoxBrush::init()
|
bool CameraBackgroundSkyBoxBrush::init()
|
||||||
{
|
{
|
||||||
auto shader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_SKYBOX);
|
auto shader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_SKYBOX);
|
||||||
_glProgramState = GLProgramState::create(shader);
|
_glProgramState = GLProgramState::create(shader);
|
||||||
|
@ -354,7 +354,7 @@ bool CameraBackGroundSkyBoxBrush::init()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBackGroundSkyBoxBrush::initBuffer()
|
void CameraBackgroundSkyBoxBrush::initBuffer()
|
||||||
{
|
{
|
||||||
if (_vertexBuffer)
|
if (_vertexBuffer)
|
||||||
glDeleteBuffers(1, &_vertexBuffer);
|
glDeleteBuffers(1, &_vertexBuffer);
|
||||||
|
@ -407,7 +407,7 @@ void CameraBackGroundSkyBoxBrush::initBuffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBackGroundSkyBoxBrush::setTexture(TextureCube* texture)
|
void CameraBackgroundSkyBoxBrush::setTexture(TextureCube* texture)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(texture);
|
CC_SAFE_RETAIN(texture);
|
||||||
CC_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
|
@ -34,9 +34,9 @@
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class CameraBackGroundColorBrush;
|
class CameraBackgroundColorBrush;
|
||||||
class CameraBackGroundDepthBrush;
|
class CameraBackgroundDepthBrush;
|
||||||
class CameraBackGroundSkyBoxBrush;
|
class CameraBackgroundSkyBoxBrush;
|
||||||
|
|
||||||
class GLProgramState;
|
class GLProgramState;
|
||||||
class Camera;
|
class Camera;
|
||||||
|
@ -45,18 +45,18 @@ class Camera;
|
||||||
* Defines a brush to clear the background of camera.
|
* Defines a brush to clear the background of camera.
|
||||||
* There are 4 types of brush. None brush do nothing, Depth brush clear background with given depth, Color brush clear background with given color and depth, Skybox brush clear the background with a skybox. Camera uses depth brush by default.
|
* There are 4 types of brush. None brush do nothing, Depth brush clear background with given depth, Color brush clear background with given color and depth, Skybox brush clear the background with a skybox. Camera uses depth brush by default.
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackGroundBrush : public Ref
|
class CC_DLL CameraBackgroundBrush : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Brush types. There are 4 types of brush. See CameraBackGroundDepthBrush, CameraBackGroundColorBrush, CameraBackGroundSkyBoxBrush for more information.
|
* Brush types. There are 4 types of brush. See CameraBackgroundDepthBrush, CameraBackgroundColorBrush, CameraBackgroundSkyBoxBrush for more information.
|
||||||
*/
|
*/
|
||||||
enum class BrushType
|
enum class BrushType
|
||||||
{
|
{
|
||||||
NONE, //none brush
|
NONE, //none brush
|
||||||
DEPTH, // depth brush. See CameraBackGroundDepthBrush
|
DEPTH, // depth brush. See CameraBackgroundDepthBrush
|
||||||
COLOR, // color brush. See CameraBackGroundColorBrush
|
COLOR, // color brush. See CameraBackgroundColorBrush
|
||||||
SKYBOX, // skybox brush. See CameraBackGroundSkyBoxBrush
|
SKYBOX, // skybox brush. See CameraBackgroundSkyBoxBrush
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,14 +69,14 @@ public:
|
||||||
* Creates a none brush, it does nothing when clear the background
|
* Creates a none brush, it does nothing when clear the background
|
||||||
* @return Created brush.
|
* @return Created brush.
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundBrush* createNoneBrush();
|
static CameraBackgroundBrush* createNoneBrush();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a depth brush, which clears depth buffer with a given depth.
|
* Creates a depth brush, which clears depth buffer with a given depth.
|
||||||
* @param depth Depth used to clear depth buffer
|
* @param depth Depth used to clear depth buffer
|
||||||
* @return Created brush
|
* @return Created brush
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundDepthBrush* createDepthBrush(float depth = 1.f);
|
static CameraBackgroundDepthBrush* createDepthBrush(float depth = 1.f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a color brush
|
* Creates a color brush
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
* @param depth Depth used to clear depth buffer
|
* @param depth Depth used to clear depth buffer
|
||||||
* @return Created brush
|
* @return Created brush
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundColorBrush* createColorBrush(const Color4F& color, float depth);
|
static CameraBackgroundColorBrush* createColorBrush(const Color4F& color, float depth);
|
||||||
|
|
||||||
|
|
||||||
/** Creates a Skybox brush with 6 textures.
|
/** Creates a Skybox brush with 6 textures.
|
||||||
|
@ -96,17 +96,17 @@ public:
|
||||||
@param negative_z texture for the rear side of the texture cube face.
|
@param negative_z texture for the rear side of the texture cube face.
|
||||||
@return A new brush inited with given parameters.
|
@return A new brush inited with given parameters.
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundSkyBoxBrush* createSkyboxBrush(const std::string& positive_x, const std::string& negative_x,
|
static CameraBackgroundSkyBoxBrush* createSkyboxBrush(const std::string& positive_x, const std::string& negative_x,
|
||||||
const std::string& positive_y, const std::string& negative_y,
|
const std::string& positive_y, const std::string& negative_y,
|
||||||
const std::string& positive_z, const std::string& negative_z);
|
const std::string& positive_z, const std::string& negative_z);
|
||||||
/**
|
/**
|
||||||
* draw the background
|
* draw the background
|
||||||
*/
|
*/
|
||||||
virtual void drawBackGround(Camera* camera) {}
|
virtual void drawBackground(Camera* camera) {}
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
CameraBackGroundBrush();
|
CameraBackgroundBrush();
|
||||||
virtual ~CameraBackGroundBrush();
|
virtual ~CameraBackgroundBrush();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool init() { return true; }
|
virtual bool init() { return true; }
|
||||||
|
@ -117,7 +117,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Depth brush clear depth buffer with given depth
|
* Depth brush clear depth buffer with given depth
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackGroundDepthBrush : public CameraBackGroundBrush
|
class CC_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -125,7 +125,7 @@ public:
|
||||||
* @param depth Depth used to clear the depth buffer
|
* @param depth Depth used to clear the depth buffer
|
||||||
* @return Created brush
|
* @return Created brush
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundDepthBrush* create(float depth);
|
static CameraBackgroundDepthBrush* create(float depth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get brush type. Should be BrushType::DEPTH
|
* Get brush type. Should be BrushType::DEPTH
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Draw background
|
* Draw background
|
||||||
*/
|
*/
|
||||||
virtual void drawBackGround(Camera* camera) override;
|
virtual void drawBackground(Camera* camera) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set depth
|
* Set depth
|
||||||
|
@ -145,8 +145,8 @@ public:
|
||||||
void setDepth(float depth) { _depth = depth; }
|
void setDepth(float depth) { _depth = depth; }
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
CameraBackGroundDepthBrush();
|
CameraBackgroundDepthBrush();
|
||||||
virtual ~CameraBackGroundDepthBrush();
|
virtual ~CameraBackgroundDepthBrush();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool init() override;
|
virtual bool init() override;
|
||||||
|
@ -161,7 +161,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Color brush clear buffer with given depth and color
|
* Color brush clear buffer with given depth and color
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackGroundColorBrush : public CameraBackGroundDepthBrush
|
class CC_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +176,7 @@ public:
|
||||||
* @param depth Depth used to clear the depth buffer
|
* @param depth Depth used to clear the depth buffer
|
||||||
* @return Created brush
|
* @return Created brush
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundColorBrush* create(const Color4F& color, float depth);
|
static CameraBackgroundColorBrush* create(const Color4F& color, float depth);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set clear color
|
* Set clear color
|
||||||
|
@ -185,8 +185,8 @@ public:
|
||||||
void setColor(const Color4F& color);
|
void setColor(const Color4F& color);
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
CameraBackGroundColorBrush();
|
CameraBackgroundColorBrush();
|
||||||
virtual ~CameraBackGroundColorBrush();
|
virtual ~CameraBackgroundColorBrush();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ class EventListenerCustom;
|
||||||
/**
|
/**
|
||||||
* Skybox brush clear buffer with a skybox
|
* Skybox brush clear buffer with a skybox
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackGroundSkyBoxBrush : public CameraBackGroundBrush
|
class CC_DLL CameraBackgroundSkyBoxBrush : public CameraBackgroundBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -218,13 +218,13 @@ public:
|
||||||
@param negative_z texture for the rear side of the texture cube face.
|
@param negative_z texture for the rear side of the texture cube face.
|
||||||
@return A new brush inited with given parameters.
|
@return A new brush inited with given parameters.
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundSkyBoxBrush* create(const std::string& positive_x, const std::string& negative_x,
|
static CameraBackgroundSkyBoxBrush* create(const std::string& positive_x, const std::string& negative_x,
|
||||||
const std::string& positive_y, const std::string& negative_y,
|
const std::string& positive_y, const std::string& negative_y,
|
||||||
const std::string& positive_z, const std::string& negative_z);
|
const std::string& positive_z, const std::string& negative_z);
|
||||||
|
|
||||||
/** Creates a Skybox brush with 6 textures.
|
/** Creates a Skybox brush with 6 textures.
|
||||||
*/
|
*/
|
||||||
static CameraBackGroundSkyBoxBrush* create();
|
static CameraBackgroundSkyBoxBrush* create();
|
||||||
/**
|
/**
|
||||||
* Set skybox texutre
|
* Set skybox texutre
|
||||||
* @param texture Skybox texture
|
* @param texture Skybox texture
|
||||||
|
@ -234,11 +234,11 @@ public:
|
||||||
/**
|
/**
|
||||||
* Draw background
|
* Draw background
|
||||||
*/
|
*/
|
||||||
virtual void drawBackGround(Camera* camera) override;
|
virtual void drawBackground(Camera* camera) override;
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
CameraBackGroundSkyBoxBrush();
|
CameraBackgroundSkyBoxBrush();
|
||||||
virtual ~CameraBackGroundSkyBoxBrush();
|
virtual ~CameraBackgroundSkyBoxBrush();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init Skybox.
|
* init Skybox.
|
|
@ -24,7 +24,7 @@ set(COCOS_2D_SRC
|
||||||
2d/CCAnimation.cpp
|
2d/CCAnimation.cpp
|
||||||
2d/CCAtlasNode.cpp
|
2d/CCAtlasNode.cpp
|
||||||
2d/CCCamera.cpp
|
2d/CCCamera.cpp
|
||||||
2d/CCCameraBackGroundBrush.cpp
|
2d/CCCameraBackgroundBrush.cpp
|
||||||
2d/CCClippingNode.cpp
|
2d/CCClippingNode.cpp
|
||||||
2d/CCClippingRectangleNode.cpp
|
2d/CCClippingRectangleNode.cpp
|
||||||
2d/CCComponentContainer.cpp
|
2d/CCComponentContainer.cpp
|
||||||
|
|
|
@ -681,7 +681,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
||||||
<ClCompile Include="CCAtlasNode.cpp" />
|
<ClCompile Include="CCAtlasNode.cpp" />
|
||||||
<ClCompile Include="CCAutoPolygon.cpp" />
|
<ClCompile Include="CCAutoPolygon.cpp" />
|
||||||
<ClCompile Include="CCCamera.cpp" />
|
<ClCompile Include="CCCamera.cpp" />
|
||||||
<ClCompile Include="CCCameraBackGroundBrush.cpp" />
|
<ClCompile Include="CCCameraBackgroundBrush.cpp" />
|
||||||
<ClCompile Include="CCClippingNode.cpp" />
|
<ClCompile Include="CCClippingNode.cpp" />
|
||||||
<ClCompile Include="CCClippingRectangleNode.cpp" />
|
<ClCompile Include="CCClippingRectangleNode.cpp" />
|
||||||
<ClCompile Include="CCComponent.cpp" />
|
<ClCompile Include="CCComponent.cpp" />
|
||||||
|
@ -1297,7 +1297,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
||||||
<ClInclude Include="CCAtlasNode.h" />
|
<ClInclude Include="CCAtlasNode.h" />
|
||||||
<ClInclude Include="CCAutoPolygon.h" />
|
<ClInclude Include="CCAutoPolygon.h" />
|
||||||
<ClInclude Include="CCCamera.h" />
|
<ClInclude Include="CCCamera.h" />
|
||||||
<ClInclude Include="CCCameraBackGroundBrush.h" />
|
<ClInclude Include="CCCameraBackgroundBrush.h" />
|
||||||
<ClInclude Include="CCClippingNode.h" />
|
<ClInclude Include="CCClippingNode.h" />
|
||||||
<ClInclude Include="CCClippingRectangleNode.h" />
|
<ClInclude Include="CCClippingRectangleNode.h" />
|
||||||
<ClInclude Include="CCComponent.h" />
|
<ClInclude Include="CCComponent.h" />
|
||||||
|
|
|
@ -1931,7 +1931,7 @@
|
||||||
<ClCompile Include="..\network\CCDownloaderImpl.cpp">
|
<ClCompile Include="..\network\CCDownloaderImpl.cpp">
|
||||||
<Filter>network\Source Files</Filter>
|
<Filter>network\Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="CCCameraBackGroundBrush.cpp">
|
<ClCompile Include="CCCameraBackgroundBrush.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -3768,7 +3768,7 @@
|
||||||
<ClInclude Include="..\network\CCIDownloaderImpl.h">
|
<ClInclude Include="..\network\CCIDownloaderImpl.h">
|
||||||
<Filter>network\Header Files</Filter>
|
<Filter>network\Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="CCCameraBackGroundBrush.h">
|
<ClInclude Include="CCCameraBackgroundBrush.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -584,7 +584,7 @@
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCAtlasNode.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCAtlasNode.h" />
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCAutoPolygon.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCAutoPolygon.h" />
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCCamera.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCCamera.h" />
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackGroundBrush.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackgroundBrush.h" />
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingNode.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingNode.h" />
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingRectangleNode.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingRectangleNode.h" />
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCComponent.h" />
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCComponent.h" />
|
||||||
|
@ -1179,7 +1179,7 @@
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCAtlasNode.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCAtlasNode.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCAutoPolygon.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCAutoPolygon.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCCamera.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCCamera.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackGroundBrush.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackgroundBrush.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingNode.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingNode.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingRectangleNode.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCClippingRectangleNode.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCComponent.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCComponent.cpp" />
|
||||||
|
|
|
@ -1867,7 +1867,7 @@
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\GameNode3DReader\GameNode3DReader.h">
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\GameNode3DReader\GameNode3DReader.h">
|
||||||
<Filter>cocostudio\reader\WidgetReader\GameNodeDReader</Filter>
|
<Filter>cocostudio\reader\WidgetReader\GameNodeDReader</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackGroundBrush.h">
|
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackgroundBrush.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -3567,7 +3567,7 @@
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\GameNode3DReader\GameNode3DReader.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\editor-support\cocostudio\WidgetReader\GameNode3DReader\GameNode3DReader.cpp">
|
||||||
<Filter>cocostudio\reader\WidgetReader\GameNodeDReader</Filter>
|
<Filter>cocostudio\reader\WidgetReader\GameNodeDReader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackGroundBrush.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\CCCameraBackgroundBrush.cpp">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -35,7 +35,7 @@ cocos2d.cpp \
|
||||||
2d/CCAnimationCache.cpp \
|
2d/CCAnimationCache.cpp \
|
||||||
2d/CCAtlasNode.cpp \
|
2d/CCAtlasNode.cpp \
|
||||||
2d/CCCamera.cpp \
|
2d/CCCamera.cpp \
|
||||||
2d/CCCameraBackGroundBrush.cpp \
|
2d/CCCameraBackgroundBrush.cpp \
|
||||||
2d/CCClippingNode.cpp \
|
2d/CCClippingNode.cpp \
|
||||||
2d/CCClippingRectangleNode.cpp \
|
2d/CCClippingRectangleNode.cpp \
|
||||||
2d/CCComponent.cpp \
|
2d/CCComponent.cpp \
|
||||||
|
|
|
@ -138,7 +138,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
// 2d utils
|
// 2d utils
|
||||||
#include "2d/CCCamera.h"
|
#include "2d/CCCamera.h"
|
||||||
#include "2d/CCCameraBackGroundBrush.h"
|
#include "2d/CCCameraBackgroundBrush.h"
|
||||||
#include "2d/CCGrabber.h"
|
#include "2d/CCGrabber.h"
|
||||||
#include "2d/CCGrid.h"
|
#include "2d/CCGrid.h"
|
||||||
#include "2d/CCLight.h"
|
#include "2d/CCLight.h"
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include "Sprite3DTest.h"
|
#include "Sprite3DTest.h"
|
||||||
#include "DrawNode3D.h"
|
#include "DrawNode3D.h"
|
||||||
#include "2d/CCCameraBackGroundBrush.h"
|
#include "2d/CCCameraBackgroundBrush.h"
|
||||||
|
|
||||||
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
|
#include "extensions/Particle3D/PU/CCPUParticleSystem3D.h"
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ Sprite3DTests::Sprite3DTests()
|
||||||
ADD_TEST_CASE(Sprite3DClippingTest);
|
ADD_TEST_CASE(Sprite3DClippingTest);
|
||||||
ADD_TEST_CASE(Sprite3DTestMeshLight);
|
ADD_TEST_CASE(Sprite3DTestMeshLight);
|
||||||
ADD_TEST_CASE(Animate3DCallbackTest);
|
ADD_TEST_CASE(Animate3DCallbackTest);
|
||||||
ADD_TEST_CASE(CameraBackGroundClearTest);
|
ADD_TEST_CASE(CameraBackgroundClearTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -2723,11 +2723,11 @@ std::string Sprite3DTestMeshLight::subtitle() const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackGroundClearTest::CameraBackGroundClearTest()
|
CameraBackgroundClearTest::CameraBackgroundClearTest()
|
||||||
{
|
{
|
||||||
TTFConfig ttfConfig("fonts/arial.ttf", 20);
|
TTFConfig ttfConfig("fonts/arial.ttf", 20);
|
||||||
auto label1 = Label::createWithTTF(ttfConfig,"Clear Mode");
|
auto label1 = Label::createWithTTF(ttfConfig,"Clear Mode");
|
||||||
auto item1 = MenuItemLabel::create(label1,CC_CALLBACK_1(CameraBackGroundClearTest::switch_CameraClearMode,this) );
|
auto item1 = MenuItemLabel::create(label1,CC_CALLBACK_1(CameraBackgroundClearTest::switch_CameraClearMode,this) );
|
||||||
|
|
||||||
item1->setPosition( Vec2(VisibleRect::left().x+50, VisibleRect::bottom().y+item1->getContentSize().height*4 ) );
|
item1->setPosition( Vec2(VisibleRect::left().x+50, VisibleRect::bottom().y+item1->getContentSize().height*4 ) );
|
||||||
|
|
||||||
|
@ -2752,36 +2752,36 @@ CameraBackGroundClearTest::CameraBackGroundClearTest()
|
||||||
_label->setPosition(s.width / 2.f , VisibleRect::top().y * 0.8f);
|
_label->setPosition(s.width / 2.f , VisibleRect::top().y * 0.8f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBackGroundClearTest::switch_CameraClearMode(cocos2d::Ref* sender)
|
void CameraBackgroundClearTest::switch_CameraClearMode(cocos2d::Ref* sender)
|
||||||
{
|
{
|
||||||
auto type = _camera->getBackGroundBrush()->getBrushType();
|
auto type = _camera->getBackgroundBrush()->getBrushType();
|
||||||
if (type == CameraBackGroundBrush::BrushType::NONE)
|
if (type == CameraBackgroundBrush::BrushType::NONE)
|
||||||
{
|
{
|
||||||
_camera->setBackGroundBrush(CameraBackGroundBrush::createDepthBrush(1.f));
|
_camera->setBackgroundBrush(CameraBackgroundBrush::createDepthBrush(1.f));
|
||||||
_label->setString("Depth Clear Brush");
|
_label->setString("Depth Clear Brush");
|
||||||
}
|
}
|
||||||
else if (type == CameraBackGroundBrush::BrushType::DEPTH)
|
else if (type == CameraBackgroundBrush::BrushType::DEPTH)
|
||||||
{
|
{
|
||||||
_camera->setBackGroundBrush(CameraBackGroundBrush::createColorBrush(Color4F(1.f, 0.f, 0.f, 1.f), 1.f));
|
_camera->setBackgroundBrush(CameraBackgroundBrush::createColorBrush(Color4F(1.f, 0.f, 0.f, 1.f), 1.f));
|
||||||
_label->setString("Color Clear Brush");
|
_label->setString("Color Clear Brush");
|
||||||
}
|
}
|
||||||
else if (type == CameraBackGroundBrush::BrushType::COLOR)
|
else if (type == CameraBackgroundBrush::BrushType::COLOR)
|
||||||
{
|
{
|
||||||
_camera->setBackGroundBrush(CameraBackGroundBrush::createSkyboxBrush("Sprite3DTest/skybox/left.jpg", "Sprite3DTest/skybox/right.jpg","Sprite3DTest/skybox/top.jpg", "Sprite3DTest/skybox/bottom.jpg","Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg"));
|
_camera->setBackgroundBrush(CameraBackgroundBrush::createSkyboxBrush("Sprite3DTest/skybox/left.jpg", "Sprite3DTest/skybox/right.jpg","Sprite3DTest/skybox/top.jpg", "Sprite3DTest/skybox/bottom.jpg","Sprite3DTest/skybox/front.jpg", "Sprite3DTest/skybox/back.jpg"));
|
||||||
_label->setString("Skybox Clear Brush");
|
_label->setString("Skybox Clear Brush");
|
||||||
}
|
}
|
||||||
else if (type == CameraBackGroundBrush::BrushType::SKYBOX)
|
else if (type == CameraBackgroundBrush::BrushType::SKYBOX)
|
||||||
{
|
{
|
||||||
_camera->setBackGroundBrush(CameraBackGroundBrush::createNoneBrush());
|
_camera->setBackgroundBrush(CameraBackgroundBrush::createNoneBrush());
|
||||||
_label->setString("None Clear Brush");
|
_label->setString("None Clear Brush");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CameraBackGroundClearTest::title() const
|
std::string CameraBackgroundClearTest::title() const
|
||||||
{
|
{
|
||||||
return "Camera Background Clear Brush";
|
return "Camera Background Clear Brush";
|
||||||
}
|
}
|
||||||
std::string CameraBackGroundClearTest::subtitle() const
|
std::string CameraBackgroundClearTest::subtitle() const
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -592,11 +592,11 @@ protected:
|
||||||
cocos2d::Sprite3D* _sprite;
|
cocos2d::Sprite3D* _sprite;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CameraBackGroundClearTest : public Sprite3DTestDemo
|
class CameraBackgroundClearTest : public Sprite3DTestDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(CameraBackGroundClearTest);
|
CREATE_FUNC(CameraBackgroundClearTest);
|
||||||
CameraBackGroundClearTest();
|
CameraBackgroundClearTest();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue