MCPcopy Create free account
hub / github.com/axmolengine/axmol / initQuadRender

Method initQuadRender

extensions/Particle3D/src/Particle3D/Particle3DRender.cpp:195–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195bool 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
234void Particle3DQuadRender::onBeforeDraw()
235{

Callers 2

resetMethod · 0.95
createMethod · 0.80

Calls 10

getInstanceFunction · 0.85
getTextureCacheMethod · 0.80
setTransparentMethod · 0.80
setCullFaceSideMethod · 0.80
emptyMethod · 0.45
addImageMethod · 0.45
getUniformLocationMethod · 0.45
setDepthTestMethod · 0.45
setDepthWriteMethod · 0.45
setCullFaceMethod · 0.45

Tested by

no test coverage detected