-
Notifications
You must be signed in to change notification settings - Fork 0
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
3dd1a79
commit 53036da
Showing
17 changed files
with
242 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "Animation.h" | ||
|
||
namespace Arcane | ||
{ | ||
///////////////////////////////////////////////// | ||
//// Base Animation | ||
///////////////////////////////////////////////// | ||
Animation::Animation() | ||
{ | ||
|
||
} | ||
|
||
void Animation::SetNextKeyFrame() | ||
{ | ||
m_CurrentKeyframe += 1; | ||
|
||
if (m_CurrentKeyframe == m_KeyFrames.size()) | ||
{ | ||
m_CurrentKeyframe = 0; | ||
} | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
//// Base Keyframe | ||
///////////////////////////////////////////////// | ||
KeyFrame::KeyFrame(KeyFrameType type) | ||
{ | ||
m_Type = type; | ||
} | ||
|
||
///////////////////////////////////////////////// | ||
//// 2D Keyframe | ||
///////////////////////////////////////////////// | ||
KeyFrame2D::KeyFrame2D() : KeyFrame(KeyFrameType::TWO_DIMENSIONAL) | ||
{ | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,73 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <map> | ||
#include "Arcane/Assets/Asset.h" | ||
|
||
namespace Arcane | ||
{ | ||
class Animation | ||
enum class KeyFrameType | ||
{ | ||
TWO_DIMENSIONAL, | ||
THREE_DIMENSIONAL | ||
}; | ||
|
||
///////////////////////////////////////////////// | ||
//// Base Animation Classes | ||
///////////////////////////////////////////////// | ||
class KeyFrame | ||
{ | ||
public: | ||
KeyFrame() {} | ||
KeyFrame(KeyFrameType type); | ||
|
||
void SetType(KeyFrameType type) { m_Type = type; } | ||
KeyFrameType GetType() { return m_Type; } | ||
protected: | ||
KeyFrameType m_Type; | ||
}; | ||
|
||
class Animation : public Asset | ||
{ | ||
public: | ||
Animation(); | ||
|
||
KeyFrame* GetKeyFrame(int index) { return m_KeyFrames[index]; } | ||
std::map<int, KeyFrame*> GetKeyFrames() { return m_KeyFrames; } | ||
|
||
void ResetKeyFrameCount() { m_CurrentKeyframe = 0; } | ||
|
||
void AddKeyFrame(int index, KeyFrame* keyFrame) { m_KeyFrames[index] = keyFrame; } | ||
KeyFrame* GetCurrentKeyFrame() { return m_KeyFrames[m_CurrentKeyframe]; } | ||
void SetNextKeyFrame(); | ||
|
||
int CurrentFrameCount = 0; | ||
private: | ||
std::string m_Name; | ||
std::map<int, KeyFrame*> m_KeyFrames; | ||
int m_CurrentKeyframe = 0; | ||
}; | ||
|
||
///////////////////////////////////////////////// | ||
//// 2D KeyFrame | ||
///////////////////////////////////////////////// | ||
class KeyFrame2D : public KeyFrame | ||
{ | ||
public: | ||
KeyFrame2D(); | ||
|
||
void SetKeyFrameLength(float keyFrameLength) { m_KeyFrameLength = keyFrameLength; } | ||
float GetKeyFrameLength() { return m_KeyFrameLength; } | ||
|
||
void SetImageIndexX(float imageIndex) { m_ImageIndexX = imageIndex; } | ||
float GetImageIndexX() { return m_ImageIndexX; } | ||
|
||
void SetImageIndexY(float imageIndex) { m_ImageIndexY = imageIndex; } | ||
float GetImageIndexY() { return m_ImageIndexY; } | ||
private: | ||
float m_KeyFrameLength; | ||
float m_ImageIndexX; | ||
float m_ImageIndexY; | ||
}; | ||
} |
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,18 @@ | ||
#include "AnimationController.h" | ||
|
||
namespace Arcane | ||
{ | ||
AnimationController::AnimationController() | ||
{ | ||
} | ||
|
||
Animation* AnimationController::GetAnimation(std::string animationName) | ||
{ | ||
return m_Animations[animationName]; | ||
} | ||
|
||
Animation* AnimationController::GetCurrentAnimation() | ||
{ | ||
return m_Animations[m_CurrentAnimation]; | ||
} | ||
} |
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,24 @@ | ||
#pragma once | ||
|
||
#include <map> | ||
#include <string> | ||
|
||
#include "Animation.h" | ||
|
||
namespace Arcane | ||
{ | ||
class AnimationController : public Asset | ||
{ | ||
public: | ||
AnimationController(); | ||
|
||
Animation* GetCurrentAnimation(); | ||
Animation* GetAnimation(std::string animationName); | ||
|
||
void SetCurrentAnimation(std::string name) { m_CurrentAnimation = name; } | ||
void AddAnimation(std::string name, Animation* animation) { m_Animations[name] = animation; }; | ||
private: | ||
std::map<std::string, Animation*> m_Animations; | ||
std::string m_CurrentAnimation; | ||
}; | ||
} |
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
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,13 @@ | ||
#include "AnimationPanel.h" | ||
|
||
AnimationPanel::AnimationPanel() | ||
{ | ||
} | ||
|
||
void AnimationPanel::OnImGuiRender() | ||
{ | ||
ImGui::Begin("Animation"); | ||
{ | ||
} | ||
ImGui::End(); | ||
} |
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,13 @@ | ||
#pragma once | ||
|
||
#include <imgui.h> | ||
#include <ImSequencer.h> | ||
|
||
class AnimationPanel | ||
{ | ||
public: | ||
AnimationPanel(); | ||
|
||
void OnImGuiRender(); | ||
private: | ||
}; |
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