CCCameraBackgroundBrush.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. /****************************************************************************
  2. Copyright (c) 2015-2016 Chukong Technologies Inc.
  3. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  4. http://www.cocos2d-x.org
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights
  8. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the Software is
  10. furnished to do so, subject to the following conditions:
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. ****************************************************************************/
  21. #include "2d/CCCameraBackgroundBrush.h"
  22. #include "2d/CCCamera.h"
  23. #include "base/ccMacros.h"
  24. #include "base/CCConfiguration.h"
  25. #include "base/CCDirector.h"
  26. #include "renderer/ccGLStateCache.h"
  27. #include "renderer/CCGLProgram.h"
  28. #include "renderer/CCGLProgramCache.h"
  29. #include "renderer/CCGLProgramState.h"
  30. #include "renderer/CCRenderer.h"
  31. #include "renderer/CCRenderState.h"
  32. #include "renderer/CCTextureCube.h"
  33. #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
  34. #include "base/CCEventCustom.h"
  35. #include "base/CCEventListenerCustom.h"
  36. #include "base/CCEventType.h"
  37. #include "base/CCEventDispatcher.h"
  38. #endif
  39. NS_CC_BEGIN
  40. CameraBackgroundBrush::CameraBackgroundBrush()
  41. : _glProgramState(nullptr)
  42. {
  43. }
  44. CameraBackgroundBrush::~CameraBackgroundBrush()
  45. {
  46. CC_SAFE_RELEASE(_glProgramState);
  47. }
  48. CameraBackgroundBrush* CameraBackgroundBrush::createNoneBrush()
  49. {
  50. auto ret = new (std::nothrow) CameraBackgroundBrush();
  51. ret->init();
  52. ret->autorelease();
  53. return ret;
  54. }
  55. CameraBackgroundColorBrush* CameraBackgroundBrush::createColorBrush(const Color4F& color, float depth)
  56. {
  57. return CameraBackgroundColorBrush::create(color, depth);
  58. }
  59. CameraBackgroundDepthBrush* CameraBackgroundBrush::createDepthBrush(float depth)
  60. {
  61. return CameraBackgroundDepthBrush::create(depth);
  62. }
  63. 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)
  64. {
  65. return CameraBackgroundSkyBoxBrush::create(positive_x, negative_x, positive_y, negative_y, positive_z, negative_z);
  66. }
  67. //////////////////////////////////////////////////////////////////////////////////////////
  68. CameraBackgroundDepthBrush::CameraBackgroundDepthBrush()
  69. : _depth(0.f)
  70. , _clearColor(GL_FALSE)
  71. , _vao(0)
  72. , _vertexBuffer(0)
  73. , _indexBuffer(0)
  74. {
  75. }
  76. CameraBackgroundDepthBrush::~CameraBackgroundDepthBrush()
  77. {
  78. glDeleteBuffers(1, &_vertexBuffer);
  79. glDeleteBuffers(1, &_indexBuffer);
  80. _vertexBuffer = 0;
  81. _indexBuffer = 0;
  82. if (Configuration::getInstance()->supportsShareableVAO())
  83. {
  84. glDeleteVertexArrays(1, &_vao);
  85. GL::bindVAO(0);
  86. _vao = 0;
  87. }
  88. }
  89. CameraBackgroundDepthBrush* CameraBackgroundDepthBrush::create(float depth)
  90. {
  91. auto ret = new (std::nothrow) CameraBackgroundDepthBrush();
  92. if (nullptr != ret && ret->init())
  93. {
  94. ret->_depth = depth;
  95. ret->autorelease();
  96. }
  97. else
  98. {
  99. CC_SAFE_DELETE(ret);
  100. }
  101. return ret;
  102. }
  103. bool CameraBackgroundDepthBrush::init()
  104. {
  105. auto shader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_CAMERA_CLEAR);
  106. _glProgramState = GLProgramState::getOrCreateWithGLProgram(shader);
  107. _glProgramState->retain();
  108. _quad.bl.vertices = Vec3(-1,-1,0);
  109. _quad.br.vertices = Vec3(1,-1,0);
  110. _quad.tl.vertices = Vec3(-1,1,0);
  111. _quad.tr.vertices = Vec3(1,1,0);
  112. _quad.bl.colors = _quad.br.colors = _quad.tl.colors = _quad.tr.colors = Color4B(0,0,0,1);
  113. _quad.bl.texCoords = Tex2F(0,0);
  114. _quad.br.texCoords = Tex2F(1,0);
  115. _quad.tl.texCoords = Tex2F(0,1);
  116. _quad.tr.texCoords = Tex2F(1,1);
  117. auto supportVAO = Configuration::getInstance()->supportsShareableVAO();
  118. if (supportVAO)
  119. {
  120. glGenVertexArrays(1, &_vao);
  121. GL::bindVAO(_vao);
  122. }
  123. glGenBuffers(1, &_vertexBuffer);
  124. glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
  125. glBufferData(GL_ARRAY_BUFFER, sizeof(_quad), &_quad, GL_STATIC_DRAW);
  126. GLshort indices[6] = {0, 1, 2, 3, 2, 1};
  127. glGenBuffers(1, &_indexBuffer);
  128. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
  129. glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
  130. if (supportVAO)
  131. {
  132. // vertices
  133. glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
  134. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof( V3F_C4B_T2F, vertices));
  135. // colors
  136. glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR);
  137. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof( V3F_C4B_T2F, colors));
  138. // tex coords
  139. glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD);
  140. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof( V3F_C4B_T2F, texCoords));
  141. }
  142. if (supportVAO)
  143. GL::bindVAO(0);
  144. glBindBuffer(GL_ARRAY_BUFFER, 0);
  145. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  146. return true;
  147. }
  148. void CameraBackgroundDepthBrush::drawBackground(Camera* /*camera*/)
  149. {
  150. GLboolean oldDepthTest;
  151. GLint oldDepthFunc;
  152. GLboolean oldDepthMask;
  153. {
  154. glColorMask(_clearColor, _clearColor, _clearColor, _clearColor);
  155. glStencilMask(0);
  156. oldDepthTest = glIsEnabled(GL_DEPTH_TEST);
  157. glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
  158. glGetBooleanv(GL_DEPTH_WRITEMASK, &oldDepthMask);
  159. glDepthMask(GL_TRUE);
  160. glEnable(GL_DEPTH_TEST);
  161. glDepthFunc(GL_ALWAYS);
  162. }
  163. //draw
  164. _glProgramState->setUniformFloat("depth", _depth);
  165. _glProgramState->apply(Mat4::IDENTITY);
  166. auto supportVAO = Configuration::getInstance()->supportsShareableVAO();
  167. if (supportVAO)
  168. GL::bindVAO(_vao);
  169. else
  170. {
  171. glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
  172. GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
  173. // vertices
  174. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof(V3F_C4B_T2F, vertices));
  175. // colors
  176. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof(V3F_C4B_T2F, colors));
  177. // tex coords
  178. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof(V3F_C4B_T2F, texCoords));
  179. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
  180. }
  181. glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
  182. if (supportVAO)
  183. GL::bindVAO(0);
  184. else
  185. {
  186. glBindBuffer(GL_ARRAY_BUFFER, 0);
  187. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  188. }
  189. {
  190. if(GL_FALSE == oldDepthTest)
  191. {
  192. glDisable(GL_DEPTH_TEST);
  193. }
  194. glDepthFunc(oldDepthFunc);
  195. if(GL_FALSE == oldDepthMask)
  196. {
  197. glDepthMask(GL_FALSE);
  198. }
  199. /* IMPORTANT: We only need to update the states that are not restored.
  200. Since we don't know what was the previous value of the mask, we update the RenderState
  201. after setting it.
  202. The other values don't need to be updated since they were restored to their original values
  203. */
  204. glStencilMask(0xFFFFF);
  205. // RenderState::StateBlock::_defaultState->setStencilWrite(0xFFFFF);
  206. /* BUG: RenderState does not support glColorMask yet. */
  207. glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
  208. }
  209. }
  210. //////////////////////////////////////////////////////////////////////////////////////////
  211. CameraBackgroundColorBrush::CameraBackgroundColorBrush()
  212. : _color(0.f, 0.f, 0.f, 0.f)
  213. {
  214. }
  215. CameraBackgroundColorBrush::~CameraBackgroundColorBrush()
  216. {
  217. }
  218. bool CameraBackgroundColorBrush::init()
  219. {
  220. CameraBackgroundDepthBrush::init();
  221. this->_clearColor = GL_TRUE;
  222. return true;
  223. }
  224. void CameraBackgroundColorBrush::drawBackground(Camera* camera)
  225. {
  226. GL::blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED.src, BlendFunc::ALPHA_NON_PREMULTIPLIED.dst);
  227. CameraBackgroundDepthBrush::drawBackground(camera);
  228. }
  229. void CameraBackgroundColorBrush::setColor(const Color4F& color)
  230. {
  231. _quad.bl.colors = _quad.br.colors = _quad.tl.colors = _quad.tr.colors = Color4B(color);
  232. if (_vertexBuffer)
  233. {
  234. glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
  235. glBufferData(GL_ARRAY_BUFFER, sizeof(_quad), &_quad, GL_STATIC_DRAW);
  236. glBindBuffer(GL_ARRAY_BUFFER, 0);
  237. }
  238. }
  239. CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& color, float depth)
  240. {
  241. auto ret = new (std::nothrow) CameraBackgroundColorBrush();
  242. if (nullptr != ret && ret->init())
  243. {
  244. ret->setColor(color);
  245. ret->setDepth(depth);
  246. ret->autorelease();
  247. }
  248. else
  249. {
  250. CC_SAFE_DELETE(ret);
  251. }
  252. return ret;
  253. }
  254. /////////////////////////////////////////////////////////////////////////////////////////////
  255. CameraBackgroundSkyBoxBrush::CameraBackgroundSkyBoxBrush()
  256. : _vao(0)
  257. , _vertexBuffer(0)
  258. , _indexBuffer(0)
  259. , _texture(nullptr)
  260. , _actived(true)
  261. , _textureValid(true)
  262. {
  263. #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
  264. _backToForegroundListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
  265. [this](EventCustom*)
  266. {
  267. initBuffer();
  268. }
  269. );
  270. Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
  271. #endif
  272. }
  273. CameraBackgroundSkyBoxBrush::~CameraBackgroundSkyBoxBrush()
  274. {
  275. CC_SAFE_RELEASE(_texture);
  276. glDeleteBuffers(1, &_vertexBuffer);
  277. glDeleteBuffers(1, &_indexBuffer);
  278. _vertexBuffer = 0;
  279. _indexBuffer = 0;
  280. if (Configuration::getInstance()->supportsShareableVAO())
  281. {
  282. glDeleteVertexArrays(1, &_vao);
  283. GL::bindVAO(0);
  284. _vao = 0;
  285. }
  286. }
  287. CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create(
  288. const std::string& positive_x,
  289. const std::string& negative_x,
  290. const std::string& positive_y,
  291. const std::string& negative_y,
  292. const std::string& positive_z,
  293. const std::string& negative_z
  294. )
  295. {
  296. CameraBackgroundSkyBoxBrush* ret = nullptr;
  297. auto texture = TextureCube::create(positive_x,
  298. negative_x,
  299. positive_y,
  300. negative_y,
  301. positive_z,
  302. negative_z);
  303. if (texture != nullptr)
  304. {
  305. Texture2D::TexParams tRepeatParams;
  306. tRepeatParams.magFilter = GL_LINEAR;
  307. tRepeatParams.minFilter = GL_LINEAR;
  308. tRepeatParams.wrapS = GL_CLAMP_TO_EDGE;
  309. tRepeatParams.wrapT = GL_CLAMP_TO_EDGE;
  310. texture->setTexParameters(tRepeatParams);
  311. ret = new (std::nothrow) CameraBackgroundSkyBoxBrush;
  312. if (nullptr != ret && ret->init())
  313. {
  314. ret->setTexture(texture);
  315. ret->autorelease();
  316. }
  317. else
  318. {
  319. CC_SAFE_DELETE(texture);
  320. CC_SAFE_DELETE(ret);
  321. }
  322. }
  323. return ret;
  324. }
  325. CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create()
  326. {
  327. auto ret = new (std::nothrow) CameraBackgroundSkyBoxBrush();
  328. if (nullptr != ret && ret->init())
  329. {
  330. ret->autorelease();
  331. }
  332. else
  333. {
  334. CC_SAFE_DELETE(ret);
  335. }
  336. return ret;
  337. }
  338. void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera)
  339. {
  340. if (!_actived)
  341. return;
  342. Mat4 cameraModelMat = camera->getNodeToWorldTransform();
  343. Vec4 color(1.f, 1.f, 1.f, 1.f);
  344. _glProgramState->setUniformVec4("u_color", color);
  345. cameraModelMat.m[12] = cameraModelMat.m[13] = cameraModelMat.m[14] = 0;
  346. _glProgramState->setUniformMat4("u_cameraRot", cameraModelMat);
  347. _glProgramState->apply(Mat4::IDENTITY);
  348. glEnable(GL_DEPTH_TEST);
  349. RenderState::StateBlock::_defaultState->setDepthTest(true);
  350. glDepthMask(GL_TRUE);
  351. RenderState::StateBlock::_defaultState->setDepthWrite(true);
  352. glDepthFunc(GL_ALWAYS);
  353. RenderState::StateBlock::_defaultState->setDepthFunction(RenderState::DEPTH_ALWAYS);
  354. glEnable(GL_CULL_FACE);
  355. RenderState::StateBlock::_defaultState->setCullFace(true);
  356. glCullFace(GL_BACK);
  357. RenderState::StateBlock::_defaultState->setCullFaceSide(RenderState::CULL_FACE_SIDE_BACK);
  358. glDisable(GL_BLEND);
  359. RenderState::StateBlock::_defaultState->setBlend(false);
  360. if (Configuration::getInstance()->supportsShareableVAO())
  361. {
  362. GL::bindVAO(_vao);
  363. }
  364. else
  365. {
  366. GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION);
  367. glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
  368. glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(Vec3), nullptr);
  369. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
  370. }
  371. glDrawElements(GL_TRIANGLES, (GLsizei)36, GL_UNSIGNED_BYTE, nullptr);
  372. if (Configuration::getInstance()->supportsShareableVAO())
  373. {
  374. GL::bindVAO(0);
  375. }
  376. else
  377. {
  378. glBindBuffer(GL_ARRAY_BUFFER, 0);
  379. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  380. }
  381. CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8);
  382. CHECK_GL_ERROR_DEBUG();
  383. }
  384. bool CameraBackgroundSkyBoxBrush::init()
  385. {
  386. auto shader = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_SKYBOX);
  387. _glProgramState = GLProgramState::create(shader);
  388. _glProgramState->setVertexAttribPointer(GLProgram::ATTRIBUTE_NAME_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(Vec3), nullptr);
  389. _glProgramState->retain();
  390. initBuffer();
  391. return true;
  392. }
  393. void CameraBackgroundSkyBoxBrush::initBuffer()
  394. {
  395. if (_vertexBuffer)
  396. glDeleteBuffers(1, &_vertexBuffer);
  397. if (_indexBuffer)
  398. glDeleteBuffers(1, &_indexBuffer);
  399. if (Configuration::getInstance()->supportsShareableVAO() && _vao)
  400. {
  401. glDeleteVertexArrays(1, &_vao);
  402. GL::bindVAO(0);
  403. _vao = 0;
  404. }
  405. if (Configuration::getInstance()->supportsShareableVAO())
  406. {
  407. glGenVertexArrays(1, &_vao);
  408. GL::bindVAO(_vao);
  409. }
  410. // init vertex buffer object
  411. Vec3 vexBuf[] =
  412. {
  413. Vec3(1, -1, 1), Vec3(1, 1, 1), Vec3(-1, 1, 1), Vec3(-1, -1, 1),
  414. Vec3(1, -1, -1), Vec3(1, 1, -1), Vec3(-1, 1, -1), Vec3(-1, -1, -1)
  415. };
  416. glGenBuffers(1, &_vertexBuffer);
  417. glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
  418. glBufferData(GL_ARRAY_BUFFER, sizeof(vexBuf), vexBuf, GL_STATIC_DRAW);
  419. // init index buffer object
  420. const unsigned char idxBuf[] = { 2, 1, 0, 3, 2, 0, // font
  421. 1, 5, 4, 1, 4, 0, // right
  422. 4, 5, 6, 4, 6, 7, // back
  423. 7, 6, 2, 7, 2, 3, // left
  424. 2, 6, 5, 2, 5, 1, // up
  425. 3, 0, 4, 3, 4, 7 // down
  426. };
  427. glGenBuffers(1, &_indexBuffer);
  428. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
  429. glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(idxBuf), idxBuf, GL_STATIC_DRAW);
  430. if (Configuration::getInstance()->supportsShareableVAO())
  431. {
  432. glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
  433. _glProgramState->applyAttributes(false);
  434. GL::bindVAO(0);
  435. }
  436. }
  437. void CameraBackgroundSkyBoxBrush::setTexture(TextureCube* texture)
  438. {
  439. CC_SAFE_RETAIN(texture);
  440. CC_SAFE_RELEASE(_texture);
  441. _texture = texture;
  442. _glProgramState->setUniformTexture("u_Env", _texture);
  443. }
  444. bool CameraBackgroundSkyBoxBrush::isActived() const
  445. {
  446. return _actived;
  447. }
  448. void CameraBackgroundSkyBoxBrush::setActived(bool actived)
  449. {
  450. _actived = actived;
  451. }
  452. void CameraBackgroundSkyBoxBrush::setTextureValid(bool valid)
  453. {
  454. _textureValid = valid;
  455. }
  456. bool CameraBackgroundSkyBoxBrush::isValid()
  457. {
  458. return _actived;
  459. }
  460. NS_CC_END