Skip to content

Commit c05dbd6

Browse files
committed
set partcile blend function in more elegant way
1 parent c8e75b0 commit c05dbd6

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

cocos/2d/CCParticleBatchNode.cpp

+2-8
Original file line numberDiff line numberDiff line change
@@ -425,21 +425,15 @@ void ParticleBatchNode::draw(Renderer* renderer, const Mat4 & transform, uint32_
425425
if( _textureAtlas->getTotalQuads() == 0 )
426426
return;
427427

428-
_customCommand.init(_globalZOrder);
428+
_customCommand.init(_globalZOrder, _blendFunc);
429429

430430
// Texture is set in TextureAtlas.
431431
const cocos2d::Mat4& projectionMat = Director::getInstance()->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
432432
Mat4 finalMat = projectionMat * transform;
433433
auto& bindGroup = _customCommand.getPipelineDescriptor().bindGroup;
434434
bindGroup.setUniform("u_MVPMatrix", finalMat.m, sizeof(finalMat.m));
435435
bindGroup.setTexture("u_texture", 0, _textureAtlas->getTexture()->getBackendTexture());
436-
437-
//TODO: minggo: don't set blend factor every frame.
438-
auto& blendDescriptor = _customCommand.getPipelineDescriptor().blendDescriptor;
439-
blendDescriptor.blendEnabled = true;
440-
blendDescriptor.sourceRGBBlendFactor = blendDescriptor.sourceAlphaBlendFactor =_blendFunc.src;
441-
blendDescriptor.destinationRGBBlendFactor = blendDescriptor.destinationAlphaBlendFactor =_blendFunc.dst;
442-
436+
443437
if (_textureAtlas->isDirty())
444438
{
445439
const auto& quads = _textureAtlas->getQuads();

0 commit comments

Comments
 (0)