-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c4c6c02
commit 70b088a
Showing
12 changed files
with
475 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "KeyFrameCustomProperty.hpp" | ||
#include "../../BlockReader.hpp" | ||
#include "../../CustomProperty.hpp" | ||
#include <cmath> | ||
|
||
using namespace nima; | ||
|
||
void KeyFrameIntProperty::setValue(ActorComponent* component, float value, float mix) | ||
{ | ||
CustomIntProperty* property = reinterpret_cast<CustomIntProperty*>(component); | ||
property->value((int)round(property->value() * (1.0f - mix) + value * mix)); | ||
} | ||
|
||
void KeyFrameFloatProperty::setValue(ActorComponent* component, float value, float mix) | ||
{ | ||
CustomFloatProperty* property = reinterpret_cast<CustomFloatProperty*>(component); | ||
property->value(property->value() * (1.0f - mix) + value * mix); | ||
} | ||
|
||
bool KeyFrameStringProperty::read(BlockReader* reader, ActorComponent* component) | ||
{ | ||
if(!Base::read(reader, component)) | ||
{ | ||
return false; | ||
} | ||
m_Value = reader->readString(); | ||
return true; | ||
} | ||
|
||
void KeyFrameStringProperty::setNext(KeyFrame* frame) | ||
{ | ||
// Intentionally blank, we do not interpolate. | ||
} | ||
|
||
void KeyFrameStringProperty::apply(ActorComponent* component, float mix) | ||
{ | ||
CustomStringProperty* property = reinterpret_cast<CustomStringProperty*>(component); | ||
property->value(m_Value); | ||
} | ||
|
||
void KeyFrameStringProperty::applyInterpolation(ActorComponent* component, float time, KeyFrame* toFrame, float mix) | ||
{ | ||
apply(component, mix); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef _NIMA_KEYFRAMEINTPROPERTY_HPP_ | ||
#define _NIMA_KEYFRAMEINTPROPERTY_HPP_ | ||
|
||
#include "KeyFrameNumeric.hpp" | ||
#include <string> | ||
|
||
namespace nima | ||
{ | ||
class ActorComponent; | ||
|
||
class KeyFrameIntProperty : public KeyFrameInt | ||
{ | ||
protected: | ||
void setValue(ActorComponent* component, float value, float mix) override; | ||
}; | ||
|
||
class KeyFrameFloatProperty : public KeyFrameNumeric | ||
{ | ||
protected: | ||
void setValue(ActorComponent* component, float value, float mix) override; | ||
}; | ||
|
||
class KeyFrameStringProperty : public KeyFrame | ||
{ | ||
typedef KeyFrame Base; | ||
private: | ||
std::string m_Value; | ||
|
||
public: | ||
bool read(BlockReader* reader, ActorComponent* component) override; | ||
void setNext(KeyFrame* frame) override; | ||
void apply(ActorComponent* component, float mix) override; | ||
void applyInterpolation(ActorComponent* component, float time, KeyFrame* toFrame, float mix) override; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.