Hi
Together with the release of cocos2d-x v3.1, a new multipass rendering framework has been added in our test case, one for Sprite, one for Sprite3D. We want you to give some suggestions and feedbacks for this feature. If you love them and it is useful for our developers, we will move them to the core of cocos2d-x.
This framework will accelerate the speed of implementing these features:
1. If you have a character in game, his HP is very low, you want to show an red outline around him. Or a character has a skill, which will make him blurred.
2. You want to apply a special effect to a sprite, EG, making a grey scale sprite based on a color texture, scale RGB component of the sprite. etc
Test case: testcpp
->Shader-Sprite
.
Code: tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp
The design structure of this framework is:
A new class EffectSprite, subclassed from Sprite, it has interfaces like addEffect(), setEffect()
A base class Effect, and its subclass such as EffectBlur, EffectOutline. etc, which containsGLProgramState
together with some parameters.
When rendering, iterate every effect, and draw sprite multiple times.
Test case: testcpp
->Node: Sprite3D
->Sprite3D with effects
.
Code: tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp
Generally, the framework is similar as EffectSprite/Effect, differences are:
The names are EffectSprite3D/Effect3D.
EffectSprite is rendered using a QuadCommand, but EffectSprite3D is rendered using a CustomCommand.
We appreciate your suggestions and comments for this framework.
Thanks