Skip to content

Commit bac2176

Browse files
committed
bring back blend benchmark
1 parent 67760ab commit bac2176

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ add_rengine_example(benchmark_rectangles)
131131
# add_rengine_example(filters)
132132
# add_rengine_example(blur)
133133
# add_rengine_example(shadow)
134-
# add_rengine_example(benchmark_blend)
134+
add_rengine_example(benchmark_blend)
135135
# add_rengine_example(touch)
136136
# add_rengine_example(text)
137137

examples/benchmark_blend.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
#include "rengine.h"
2828
#include "examples.h"
2929

30+
31+
#define STB_TRUETYPE_IMPLEMENTATION
32+
#include <stb_truetype.h>
33+
3034
static int nodeCount = 4;
3135
static bool useTextures = false;
3236

examples/examples.h

+12-10
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ using namespace std;
4141

4242
RENGINE_BEGIN_NAMESPACE
4343

44-
// inline void animation_rotateZ(AnimationManager *manager, TransformNode *node, float duration)
45-
// {
46-
// AnimationClosure<TransformNode, LinearTimingFunction> *anim
47-
// = new AnimationClosure<TransformNode, LinearTimingFunction>(node);
48-
// anim->setDuration(duration);
49-
// anim->setIterations(-1);
50-
// anim->keyFrames.times() << 0 << 1;
51-
// anim->keyFrames.addValues<double, TransformNode_rotateAroundZ>() << 0 << M_PI * 2.0;
52-
// manager->startAnimation(anim);
53-
// }
44+
typedef Animation<TransformNode, float, &TransformNode::setMatrix_rotateAroundZ, &AnimationCurves::linear> Animation_aroundZ_linear;
45+
46+
47+
inline void animation_rotateZ(AnimationManager *manager, TransformNode *node, float duration)
48+
{
49+
auto anim = std::make_shared<Animation_aroundZ_linear>(node);
50+
anim->setDuration(duration);
51+
anim->setIterations(-1);
52+
anim->newKeyFrame(0) = 0;
53+
anim->newKeyFrame(1) = M_PI * 2;
54+
manager->start(anim);
55+
}
5456

5557
inline void rengine_countFps()
5658
{

0 commit comments

Comments
 (0)