Motion trail / afterimage recorder + 2D trajectory drawer. 更多...
#include <AnimTrail.h>
Public 成员函数 | |
| AnimTrail (int capacity=64) | |
| ~AnimTrail ()=default | |
| AnimTrail (const AnimTrail &)=delete | |
| AnimTrail & | operator= (const AnimTrail &)=delete |
| void | setCapacity (int capacity) |
| Max retained samples (ring). Clamped to >= 2. | |
| int | getCapacity () const |
| void | setDuration (float seconds) |
| How long each sample lives (seconds). <= 0 keeps until capacity eviction. | |
| float | getDuration () const |
| void | setMinDistance (float distance) |
| Skip new samples closer than this distance to the newest point (0 = always add). | |
| float | getMinDistance () const |
| void | setWidth (float pixels) |
| float | getWidth () const |
| void | setColor (float r, float g, float b, float a=1.f) |
| Head (newest) color; alpha fades toward 0 along the trail when fade is on. | |
| float | getColorR () const |
| float | getColorG () const |
| float | getColorB () const |
| float | getColorA () const |
| void | setFade (bool enable) |
| bool | getFade () const |
| void | setStyle (const std::string &style) |
| "line" | "points". Invalid → exception. | |
| std::string | getStyle () const |
| void | setDrawScale (float sx, float sy) |
| Applied at draw time: screen = (x,y) * scale + offset. Useful when sampling bone world units into pixel space. | |
| float | getDrawScaleX () const |
| float | getDrawScaleY () const |
| void | setDrawOffset (float ox, float oy) |
| float | getDrawOffsetX () const |
| float | getDrawOffsetY () const |
| void | addPoint (float x, float y) |
| Append a 2D sample (z stored as 0). | |
| void | addPoint3 (float x, float y, float z) |
| Append a 3D sample (draw uses set plane / first two mapped axes via sampleBone). | |
| void | sampleBone (const AnimPose *pose, int boneIndex, const std::string &plane="xy") |
Sample bone world position after pose->computeWorld. plane maps axes to draw (x,y): "xy" | "xz" | "yz". Optional local offset is applied in bone world space (translation only). | |
| void | sampleBoneOffset (const AnimPose *pose, int boneIndex, float ox, float oy, float oz, const std::string &plane="xy") |
| void | clear () |
| void | update (float dt) |
| Age samples by dt; drop expired (when duration > 0). | |
| int | getPointCount () const |
| float | getPointX (int index) const |
| Index 0 = oldest retained sample; count-1 = newest. | |
| float | getPointY (int index) const |
| float | getPointZ (int index) const |
| float | getPointAge (int index) const |
| float | getPointAlpha (int index) const |
| Effective draw alpha in [0, colorA] after fade. | |
| void | draw (graphics::Graphics *gfx) |
| Draw trajectory in 2D pixel/world space via Graphics. | |
详细描述
Motion trail / afterimage recorder + 2D trajectory drawer.
Records timed samples (manual points or bone world positions) and draws a fading path with Graphics::drawSolidRect (same dotted-segment style as Cloth). Script type: AnimTrail.
Typical frame: pose.computeWorld(sk); trail.sampleBone(pose, tipBone); // or addPoint(x, y) trail.update(dt); // eve_render: trail.draw(gfx);
Plane strings for 3D→2D projection: "xy" | "xz" | "yz". Draw styles: "line" (connected segments) | "points" (sample dots only).
在文件 AnimTrail.h 第 31 行定义.
构造及析构函数说明
◆ AnimTrail() [1/2]
|
explicit |
在文件 AnimTrail.cpp 第 15 行定义.
引用了 setCapacity().
◆ ~AnimTrail()
|
default |
◆ AnimTrail() [2/2]
|
delete |
成员函数说明
◆ addPoint()
| void eve::animation::AnimTrail::addPoint | ( | float | x, |
| float | y | ||
| ) |
◆ addPoint3()
| void eve::animation::AnimTrail::addPoint3 | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Append a 3D sample (draw uses set plane / first two mapped axes via sampleBone).
在文件 AnimTrail.cpp 第 78 行定义.
◆ clear()
| void eve::animation::AnimTrail::clear | ( | ) |
在文件 AnimTrail.cpp 第 139 行定义.
◆ draw()
| void eve::animation::AnimTrail::draw | ( | graphics::Graphics * | gfx | ) |
◆ getCapacity()
|
inline |
在文件 AnimTrail.h 第 41 行定义.
◆ getColorA()
|
inline |
在文件 AnimTrail.h 第 59 行定义.
◆ getColorB()
|
inline |
在文件 AnimTrail.h 第 58 行定义.
◆ getColorG()
|
inline |
在文件 AnimTrail.h 第 57 行定义.
◆ getColorR()
|
inline |
在文件 AnimTrail.h 第 56 行定义.
◆ getDrawOffsetX()
|
inline |
在文件 AnimTrail.h 第 76 行定义.
◆ getDrawOffsetY()
|
inline |
在文件 AnimTrail.h 第 77 行定义.
◆ getDrawScaleX()
|
inline |
在文件 AnimTrail.h 第 73 行定义.
◆ getDrawScaleY()
|
inline |
在文件 AnimTrail.h 第 74 行定义.
◆ getDuration()
|
inline |
在文件 AnimTrail.h 第 45 行定义.
◆ getFade()
|
inline |
在文件 AnimTrail.h 第 62 行定义.
◆ getMinDistance()
|
inline |
在文件 AnimTrail.h 第 49 行定义.
◆ getPointAge()
| float eve::animation::AnimTrail::getPointAge | ( | int | index | ) | const |
在文件 AnimTrail.cpp 第 177 行定义.
◆ getPointAlpha()
| float eve::animation::AnimTrail::getPointAlpha | ( | int | index | ) | const |
Effective draw alpha in [0, colorA] after fade.
在文件 AnimTrail.cpp 第 188 行定义.
◆ getPointCount()
|
inline |
在文件 AnimTrail.h 第 98 行定义.
◆ getPointX()
| float eve::animation::AnimTrail::getPointX | ( | int | index | ) | const |
◆ getPointY()
| float eve::animation::AnimTrail::getPointY | ( | int | index | ) | const |
在文件 AnimTrail.cpp 第 167 行定义.
引用了 y.
◆ getPointZ()
| float eve::animation::AnimTrail::getPointZ | ( | int | index | ) | const |
在文件 AnimTrail.cpp 第 172 行定义.
引用了 z.
◆ getStyle()
| std::string eve::animation::AnimTrail::getStyle | ( | ) | const |
在文件 AnimTrail.cpp 第 62 行定义.
◆ getWidth()
|
inline |
在文件 AnimTrail.h 第 52 行定义.
◆ operator=()
◆ sampleBone()
| void eve::animation::AnimTrail::sampleBone | ( | const AnimPose * | pose, |
| int | boneIndex, | ||
| const std::string & | plane = "xy" |
||
| ) |
Sample bone world position after pose->computeWorld. plane maps axes to draw (x,y): "xy" | "xz" | "yz". Optional local offset is applied in bone world space (translation only).
在文件 AnimTrail.cpp 第 101 行定义.
引用了 sampleBoneOffset().
◆ sampleBoneOffset()
| void eve::animation::AnimTrail::sampleBoneOffset | ( | const AnimPose * | pose, |
| int | boneIndex, | ||
| float | ox, | ||
| float | oy, | ||
| float | oz, | ||
| const std::string & | plane = "xy" |
||
| ) |
◆ setCapacity()
| void eve::animation::AnimTrail::setCapacity | ( | int | capacity | ) |
◆ setColor()
| void eve::animation::AnimTrail::setColor | ( | float | r, |
| float | g, | ||
| float | b, | ||
| float | a = 1.f |
||
| ) |
Head (newest) color; alpha fades toward 0 along the trail when fade is on.
在文件 AnimTrail.cpp 第 41 行定义.
◆ setDrawOffset()
| void eve::animation::AnimTrail::setDrawOffset | ( | float | ox, |
| float | oy | ||
| ) |
在文件 AnimTrail.cpp 第 71 行定义.
◆ setDrawScale()
| void eve::animation::AnimTrail::setDrawScale | ( | float | sx, |
| float | sy | ||
| ) |
Applied at draw time: screen = (x,y) * scale + offset. Useful when sampling bone world units into pixel space.
在文件 AnimTrail.cpp 第 66 行定义.
◆ setDuration()
| void eve::animation::AnimTrail::setDuration | ( | float | seconds | ) |
How long each sample lives (seconds). <= 0 keeps until capacity eviction.
在文件 AnimTrail.cpp 第 27 行定义.
◆ setFade()
| void eve::animation::AnimTrail::setFade | ( | bool | enable | ) |
在文件 AnimTrail.cpp 第 48 行定义.
◆ setMinDistance()
| void eve::animation::AnimTrail::setMinDistance | ( | float | distance | ) |
Skip new samples closer than this distance to the newest point (0 = always add).
在文件 AnimTrail.cpp 第 31 行定义.
◆ setStyle()
| void eve::animation::AnimTrail::setStyle | ( | const std::string & | style | ) |
"line" | "points". Invalid → exception.
在文件 AnimTrail.cpp 第 50 行定义.
◆ setWidth()
| void eve::animation::AnimTrail::setWidth | ( | float | pixels | ) |
在文件 AnimTrail.cpp 第 36 行定义.
◆ update()
| void eve::animation::AnimTrail::update | ( | float | dt | ) |
该类的文档由以下文件生成:
- src/modules/animation/AnimTrail.h
- src/modules/animation/AnimTrail.cpp