| 193 | } |
| 194 | |
| 195 | bool Particle3DQuadRender::initQuadRender(std::string_view texFile) |
| 196 | { |
| 197 | AX_SAFE_RELEASE_NULL(_programState); |
| 198 | |
| 199 | if (!texFile.empty()) |
| 200 | { |
| 201 | auto tex = Director::getInstance()->getTextureCache()->addImage(texFile); |
| 202 | if (tex) |
| 203 | { |
| 204 | _texture = tex; |
| 205 | auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::PARTICLE_TEXTURE_3D); |
| 206 | _programState = new backend::ProgramState(program); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | if (!_programState) |
| 211 | { |
| 212 | auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::PARTICLE_COLOR_3D); |
| 213 | _programState = new backend::ProgramState(program); |
| 214 | } |
| 215 | |
| 216 | auto& pipelineDescriptor = _meshCommand.getPipelineDescriptor(); |
| 217 | pipelineDescriptor.programState = _programState; |
| 218 | |
| 219 | _locColor = _programState->getUniformLocation("u_color"); |
| 220 | _locPMatrix = _programState->getUniformLocation("u_PMatrix"); |
| 221 | _locTexture = _programState->getUniformLocation("u_tex0"); |
| 222 | |
| 223 | _meshCommand.setTransparent(true); |
| 224 | _meshCommand.setSkipBatching(true); |
| 225 | |
| 226 | _stateBlock.setDepthTest(true); |
| 227 | _stateBlock.setDepthWrite(false); |
| 228 | _stateBlock.setCullFaceSide(backend::CullMode::BACK); |
| 229 | _stateBlock.setCullFace(true); |
| 230 | |
| 231 | return true; |
| 232 | } |
| 233 | |
| 234 | void Particle3DQuadRender::onBeforeDraw() |
| 235 | { |
no test coverage detected