MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / applyTexture

Method applyTexture

src/Core/Animation/Animator.cpp:14–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12namespace obe::Animation
13{
14 void Animator::applyTexture() const
15 {
16 const Graphics::Texture& texture = this->getTexture();
17 m_target->setTexture(texture);
18
19 if (m_targetScaleMode == AnimatorTargetScaleMode::Fit)
20 {
21 if (m_target->getSize().x >= m_target->getSize().y)
22 {
23 m_target->setSize(Transform::UnitVector(m_target->getSize().x,
24 static_cast<float>(texture.getSize().y)
25 / static_cast<float>(texture.getSize().x)
26 * m_target->getSize().x));
27 }
28 else
29 {
30 m_target->setSize(Transform::UnitVector(
31 static_cast<float>(texture.getSize().x)
32 / static_cast<float>(texture.getSize().y) * m_target->getSize().y,
33 m_target->getSize().y));
34 }
35 }
36 else if (m_targetScaleMode == AnimatorTargetScaleMode::FixedWidth)
37 {
38 m_target->setSize(Transform::UnitVector(m_target->getSize().x,
39 static_cast<float>(texture.getSize().y)
40 / static_cast<float>(texture.getSize().x) * m_target->getSize().x));
41 }
42 else if (m_targetScaleMode == AnimatorTargetScaleMode::FixedHeight)
43 {
44 m_target->setSize(
45 Transform::UnitVector(static_cast<float>(texture.getSize().x)
46 / static_cast<float>(texture.getSize().y) * m_target->getSize().y,
47 m_target->getSize().y));
48 }
49 else if (m_targetScaleMode == AnimatorTargetScaleMode::TextureSize)
50 m_target->useTextureSize();
51 }
52
53 void Animator::clear() noexcept
54 {

Callers 1

updateMethod · 0.95

Calls 6

UnitVectorClass · 0.85
useTextureSizeMethod · 0.80
getTextureMethod · 0.45
setTextureMethod · 0.45
getSizeMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected