-
Notifications
You must be signed in to change notification settings - Fork 1
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
c478a1c
commit b09d337
Showing
520 changed files
with
136,954 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
project(skeletallib) | ||
|
||
# Find source files | ||
file(GLOB SOURCES src/*.cpp) | ||
|
||
FIND_PACKAGE(OpenGL) | ||
# Include header files | ||
include_directories(include) | ||
|
||
# Create shared library | ||
add_library(${PROJECT_NAME} STATIC ${SOURCES}) | ||
LINK_DIRECTORIES(${PROJECT_NAME}/lib/*.lib) | ||
TARGET_LINK_LIBRARIES(skeletallib ../lib/SOIL ../lib/assimp-vc142-mtd opengl32 ../lib/glfw3dll ../lib/glew32) | ||
# Install library | ||
install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) | ||
|
||
# Install library headers | ||
file(GLOB HEADERS include/*.h) | ||
install(FILES ${HEADERS} DESTINATION include/${PROJECT_NAME}) |
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,36 @@ | ||
#pragma once | ||
|
||
#include <iostream> | ||
#include <string> | ||
#include <algorithm> | ||
|
||
//define GLEW_STATIC | ||
#include <GL/glew.h> | ||
#include <GLFW/glfw3.h> | ||
#include <glm/glm.hpp> | ||
|
||
using namespace std; | ||
using namespace glm; | ||
|
||
class Animation | ||
{ | ||
public: | ||
string name; //name of the animation | ||
|
||
float startTime; //start time of the animation | ||
float endTime; //end time of the animation | ||
float speed; //speed of the animation | ||
int priority; //priority of the animation | ||
bool loop; //is this animation looped | ||
|
||
Animation(); | ||
Animation(string name, vec2 times, float speed = 0.25, int priority = 10, bool loop = false); | ||
|
||
void setName(string name); | ||
void setTime(vec2 frames); | ||
void setSpeed(float speed); | ||
void setPriority(int priority); | ||
void setLoop(bool loop); | ||
|
||
~Animation(); | ||
}; |
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,55 @@ | ||
#pragma once | ||
|
||
#include <iostream> | ||
#include <vector> | ||
#include <string> | ||
#include <algorithm> | ||
|
||
//#define GLEW_STATIC | ||
#include <GL/glew.h> | ||
#include <GLFW/glfw3.h> | ||
#include <glm/glm.hpp> | ||
#include <glm/gtc/matrix_transform.hpp> | ||
#include <glm/gtx/transform.hpp> | ||
#include <glm/gtc/type_ptr.hpp> | ||
|
||
#include <assimp/Importer.hpp> | ||
#include <assimp/scene.h> | ||
#include <assimp/postprocess.h> | ||
|
||
using namespace std; | ||
using namespace glm; | ||
using namespace Assimp; | ||
|
||
class Bone | ||
{ | ||
public: | ||
string name; //the name of the bone | ||
int id; //bones id in the model | ||
|
||
aiNode* node; //the node this bone is attached to | ||
aiNodeAnim* nodeAnim; //this bone animation node | ||
|
||
Bone* parentBone; //parent bone | ||
mat4 offset; //offset matrix | ||
|
||
//keyframe data. This data is calculated in a particular period of time | ||
vec3 pos; | ||
quat rot; | ||
vec3 scal; | ||
|
||
|
||
Bone(int id, string name, mat4& offset); | ||
|
||
mat4 getParentTransforms(); //calculates the whole transformation matrix starting with the root bone | ||
|
||
vec3 calcInterpolatedPosition(float time); //calculates interpolated position between two keyframes | ||
quat calcInterpolatedRotation(float time); //calculates interpolated rotation between two keyframes | ||
|
||
int findPosition(float time); //finds the index of the keyframe with the value less then time | ||
int findRotation(float time); //same as above | ||
|
||
void updateKeyframeTransform(float time); //updates this bone transformation matrix | ||
|
||
~Bone(); | ||
}; |
Oops, something went wrong.