diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 66a0f0d216..9af61eb005 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -518,8 +518,7 @@ void Sprite3D::removeAllAttachNode() } _attachments.clear(); } - -#ifndef NDEBUG +#if (!defined NDEBUG) || (defined CC_MODEL_VIEWER) //Generate a dummy texture when the texture file is missing static Texture2D * getDummyTexture() { @@ -564,9 +563,8 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) } auto programstate = mesh->getGLProgramState(); auto& meshCommand = mesh->getMeshCommand(); -#ifdef NDEBUG - GLuint textureID = mesh->getTexture() ? mesh->getTexture()->getName() : 0; -#else + +#if (!defined NDEBUG) || (defined CC_MODEL_VIEWER) GLuint textureID = 0; if(mesh->getTexture()) { @@ -577,7 +575,11 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) mesh->setTexture(texture); textureID = texture->getName(); } + +#else + GLuint textureID = mesh->getTexture() ? mesh->getTexture()->getName() : 0; #endif + float globalZ = _globalZOrder; bool isTransparent = (mesh->_isTransparent || color.a < 1.f); if (isTransparent && Camera::getVisitingCamera())