-
Notifications
You must be signed in to change notification settings - Fork 0
/
job_test.h
108 lines (97 loc) · 2.98 KB
/
job_test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//motion_matching_system.cpp
#include "ecs.h"
class MotionMatchingSystem
{
struct motion_matching_job
{
struct component_data
{
const motion_matching* MotionMatching;
const anim_goal* AnimGoal;
animation_controller* Controller*;
};
ECS_JOB_FUNCTION(MotionMatching)
{
comopnent_data* ComponentData = (comopnent_data*)Components;
for(int i = 0; i < Count; i++)
{
ComponentData->Controller[i];
ComponentData->MotionMatching[i];
ComponentData->AnimGoal[i];
}
}
};
};
//animation_system.cpp
class AnimationSystem
{
struct component_data
{
const anim_goal* AnimGoal;
animation_controller* Controller*;
};
Memory::tagged_heap_allocator* MatrixPalleteMemory;
archetype_requirement
InitJobRequirements()
{
archetype_requirement Requirements = {};
Requirements.Push({ GetComponentID(MMData), REQUIREMENT_Permission_R });
Requirements.Push({ GetComponentID(COMPONENT_MMData), REQUIREMENT_Permission_R });
Requirements.Push({ GetComponentID(COMPONENT_MMData) });
}
struct matrix_pallete_gen_job
{
float dt;
void PARALLEL_FOR_JOB(BlenAnimJob, anim_controller)
{
BEGIN_TIMED_BLOCK(BlendAnimJob);
for(int i = FirstIndex; i < LastIndex; i++)
{
Anim::animation_controller* AnimController = anim_controllers[i];
MatrixPalleteMemory.Alloc(AnimController->ChannelCount * mat4);
AnimController->GlobalTimeSec += dt;
}
}
};
PARALLEL_FOR_JOB(RootMotionJob, Permission_R anim_controller, Permission_RW root_motion_update)
{
for(int i = FirstIndex; i < LastIndex; i++)
{
const Anim::animation_controller* AnimController = &anim_controllers[i];
Anim::translation_rotation* RootMotionUpdate = &root_motion_updates[i];
RootMotionUpdate = GetRootMotion(AnimController, AnimController->GlobalTimeSec,
AnimController->GlobalTimeSec + dt);
}
}
}
//render_system.cpp
{
PARALLEL_FOR_JOB(MeshInstanceGeneration, MaterialArray, Model)
{
for(int i = FirstIndex; i < LastIndex; i++)
{
const material** Materials = &MaterialArrays[i];
Anim::translation_rotation* RootMotionUpdate = &Models[i];
AnimController->GlobalTimeSec += dt;
}
}
PARALLEL_FOR_JOB(TrajectoryAnimGoalGeneration, AnimController, TrajectoryController, Transform,
AnimGoal)
{
for(int i = FirstIndex; i < LastIndex; i++)
{
const material** Materials = &MaterialArrays[i];
Anim::translation_rotation* RootMotionUpdate = &Models[i];
GenerateAnimGoal();
}
}
PARALLEL_FOR_JOB(ControllerAnimGoalGeneration, InputController, AnimGoal)
{
for(int i = FirstIndex; i < LastIndex; i++)
{
const material** Materials = &MaterialArrays[i];
Anim::translation_rotation* RootMotionUpdate = &Models[i];
AnimController->GlobalTimeSec += dt;
}
}
};