-
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
Showing
71 changed files
with
1,371 additions
and
181 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,26 +1,26 @@ | ||
{ | ||
"game": { | ||
"maze": { | ||
"directory": "maps", | ||
"procedural": true, | ||
"maze_file": "test/itemRoom.maze" | ||
} | ||
}, | ||
"network": { | ||
"server_ip": "localhost", | ||
"server_port": 2355 | ||
}, | ||
"server": { | ||
"lobby_name": "Hope you're doing well!1", | ||
"lobby_broadcast": true, | ||
"max_players": 5, | ||
"disable_dm": false | ||
}, | ||
"client": { | ||
"default_name": "Conan O'Brien", | ||
"lobby_discovery": true, | ||
"fullscreen": true, | ||
"draw_bboxes": false, | ||
"fps_counter": true | ||
"game": { | ||
"maze": { | ||
"directory": "maps", | ||
"procedural": false, | ||
"maze_file": "test/itemRoom.maze" | ||
} | ||
}, | ||
"network": { | ||
"server_ip": "localhost", | ||
"server_port": 2355 | ||
}, | ||
"server": { | ||
"lobby_name": "Hope you're doing well!1", | ||
"lobby_broadcast": true, | ||
"max_players": 1, | ||
"disable_dm": true | ||
}, | ||
"client": { | ||
"default_name": "Conan O'Brien", | ||
"lobby_discovery": true, | ||
"fullscreen": true, | ||
"draw_bboxes": false, | ||
"fps_counter": true | ||
} | ||
} |
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 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
#include <map> | ||
#include <glm/glm.hpp> | ||
#include <assimp/scene.h> | ||
#include <functional> | ||
#include "client/bone.hpp" | ||
#include "client/model.hpp" | ||
#include "client/util.hpp" | ||
|
||
struct AssimpNodeData { | ||
glm::mat4 transformation; | ||
std::string name; | ||
int numChildren; | ||
std::vector<AssimpNodeData> children; | ||
}; | ||
|
||
class Animation { | ||
public: | ||
Animation() = default; | ||
|
||
Animation(const std::string& animationPath, Model* model); | ||
|
||
~Animation() {} | ||
|
||
Bone* findBone(const std::string& name); | ||
|
||
inline float getTicksPerSecond() { return m_ticksPerSecond; } | ||
inline float getDuration() { return m_duration;} | ||
inline const AssimpNodeData& getRootNode() { return m_rootNode; } | ||
inline const std::map<std::string,BoneInfo>& getBoneIDMap() { return m_boneInfoMap; } | ||
|
||
private: | ||
void readMissingBones(const aiAnimation* animation, Model& model); | ||
|
||
void readHierarchyData(AssimpNodeData& dest, const aiNode* src); | ||
|
||
float m_duration; | ||
int m_ticksPerSecond; | ||
std::vector<Bone> m_bones; | ||
AssimpNodeData m_rootNode; | ||
std::map<std::string, BoneInfo> m_boneInfoMap; | ||
}; |
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,41 @@ | ||
#pragma once | ||
|
||
#include <glm/glm.hpp> | ||
#include <map> | ||
#include <vector> | ||
#include <unordered_map> | ||
#include <utility> | ||
|
||
#include <assimp/scene.h> | ||
#include <assimp/Importer.hpp> | ||
#include "client/animation.hpp" | ||
#include "client/bone.hpp" | ||
#include "shared/game/sharedobject.hpp" | ||
|
||
class AnimationManager | ||
{ | ||
public: | ||
AnimationManager(Animation* animation); | ||
|
||
void updateAnimation(float dt); | ||
|
||
void playAnimation(Animation* pAnimation); | ||
|
||
void calculateBoneTransform(const AssimpNodeData* node, glm::mat4 parentTransform); | ||
|
||
void addAnimation(Animation* anim, ObjectType objType, AnimState animState); | ||
|
||
void setAnimation(EntityID id, ObjectType objType, AnimState animState); | ||
|
||
std::vector<glm::mat4> getFinalBoneMatrices() { return m_finalBoneMatrices; } | ||
|
||
private: | ||
std::vector<glm::mat4> m_finalBoneMatrices; | ||
std::unordered_map<EntityID, std::pair<float, Animation*>> entityAnimMap; | ||
std::unordered_map<ObjectType, std::unordered_map<AnimState, Animation*>> objAnimMap; | ||
Animation* m_currentAnimation; | ||
EntityID currEntity; | ||
float m_currentTime; | ||
float m_deltaTime; | ||
|
||
}; |
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,69 @@ | ||
#pragma once | ||
|
||
/* Container for bone data */ | ||
|
||
#include <vector> | ||
#include <assimp/scene.h> | ||
#include <list> | ||
#include <glm/glm.hpp> | ||
|
||
#define GLM_ENABLE_EXPERIMENTAL | ||
#include <glm/gtx/quaternion.hpp> | ||
#include "client/util.hpp" | ||
|
||
struct keyPosition | ||
{ | ||
glm::vec3 position; | ||
float timeStamp; | ||
}; | ||
|
||
struct keyRotation | ||
{ | ||
glm::quat orientation; | ||
float timeStamp; | ||
}; | ||
|
||
struct keyScale | ||
{ | ||
glm::vec3 scale; | ||
float timeStamp; | ||
}; | ||
|
||
class Bone | ||
{ | ||
public: | ||
Bone(const std::string& name, int ID, const aiNodeAnim* channel); | ||
|
||
void update(float animationTime); | ||
|
||
glm::mat4 getLocalTransform() { return m_localTransform; } | ||
std::string getBoneName() const { return m_name; } | ||
int getBoneID() { return m_ID; } | ||
|
||
int getPositionIndex(float animationTime); | ||
|
||
int getRotationIndex(float animationTime); | ||
|
||
int getScaleIndex(float animationTime); | ||
|
||
private: | ||
|
||
float getScaleFactor(float lastTimeStamp, float nextTimeStamp, float animationTime); | ||
|
||
glm::mat4 interpolatePosition(float animationTime); | ||
|
||
glm::mat4 interpolateRotation(float animationTime); | ||
|
||
glm::mat4 interpolateScaling(float animationTime); | ||
|
||
std::vector<keyPosition> m_positions; | ||
std::vector<keyRotation> m_rotations; | ||
std::vector<keyScale> m_scales; | ||
int m_numPositions; | ||
int m_numRotations; | ||
int m_numScalings; | ||
|
||
glm::mat4 m_localTransform; | ||
std::string m_name; | ||
int m_ID; | ||
}; |
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
Oops, something went wrong.