WIP Load and test animations

This commit is contained in:
Xiao Qi 2023-03-04 00:43:31 +08:00
parent f9ae0c10ce
commit 56693565f4
12 changed files with 61 additions and 13 deletions

View File

@ -1,4 +1,4 @@
Start in Fullscreen: false Start in Fullscreen: false
Starting Scene ID: 86098106 Starting Scene ID: 91478134
Window Size: {x: 1920, y: 1080} Window Size: {x: 1920, y: 1080}
Window Title: SHADE Engine Window Title: SHADE Engine

View File

@ -0,0 +1,8 @@
- VertexShader: 39210065
FragmentShader: 46377769
SubPass: G-Buffer Write
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 64651793
data.alpha: 0
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: default_racoon
ID: 125722190
Type: 7

Binary file not shown.

33
Assets/Scenes/anim.shade Normal file
View File

@ -0,0 +1,33 @@
- EID: 0
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Directional
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 1
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 149723808
Material: 128805346
IsActive: true
Animator Component:
Rig: 80728853
Clip: 80728853
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: anim
ID: 91478134
Type: 5

View File

@ -135,7 +135,7 @@ namespace SHADE
const int BONE_IDX = rig->GetNodeIndex(node); const int BONE_IDX = rig->GetNodeIndex(node);
SHMatrix transformMatrix = node->TransformMatrix; SHMatrix transformMatrix = node->TransformMatrix;
const auto& CHANNELS = currClip->GetChannels(); const auto& CHANNELS = currClip->GetChannels();
if (CHANNELS.size() < BONE_IDX) if (BONE_IDX < CHANNELS.size())
{ {
const auto& CHANNEL = CHANNELS[BONE_IDX]; const auto& CHANNEL = CHANNELS[BONE_IDX];
transformMatrix = SHMatrix::Transform transformMatrix = SHMatrix::Transform

View File

@ -180,7 +180,7 @@ namespace SHADE
SHVec3 scale{ SHVec3::One }, translation{ SHVec3::Zero }; SHVec3 scale{ SHVec3::One }, translation{ SHVec3::Zero };
SHVec4 rotation{ SHVec4::UnitW }; SHVec4 rotation{ SHVec4::UnitW };
SHMatrix matrix{ SHMatrix::Identity }; //SHMatrix matrix{ SHMatrix::Identity };
std::vector<double> carrier; std::vector<double> carrier;
if (flag & NODE_DATA_ROTATION) if (flag & NODE_DATA_ROTATION)
@ -213,17 +213,18 @@ namespace SHADE
translation = GetVec3FromVector(carrier); translation = GetVec3FromVector(carrier);
} }
if (flag & NODE_DATA_MATRIX) //if (flag & NODE_DATA_MATRIX)
{ //{
carrier.resize(NODE_COMPONENT_COUNT_MATRIX); // carrier.resize(NODE_COMPONENT_COUNT_MATRIX);
file.read( // file.read(
reinterpret_cast<char*>(carrier.data()), // reinterpret_cast<char*>(carrier.data()),
sizeof(double) * NODE_COMPONENT_COUNT_MATRIX // sizeof(double) * NODE_COMPONENT_COUNT_MATRIX
); // );
matrix = GetMatrixFromVector(carrier); // matrix = GetMatrixFromVector(carrier);
} //}
auto result{ SHMatrix::Transform(translation, rotation, scale) }; auto const result = SHMatrix::Transform(translation, rotation, scale);
node.transform = result;
} }
} }