Merge branch 'main' into PlayerController
This commit is contained in:
commit
1b581aeb44
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Cinematics
|
||||||
|
ID: 197932678
|
||||||
|
Type: 11
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2419,7 +2419,7 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 0, z: 0}
|
Translate: {x: 0, y: 0, z: 0}
|
||||||
Rotate: {x: -7.50001717, y: 1.39999998, z: -3.50001717}
|
Rotate: {x: -1.48352981, y: 1.39999998, z: -3.50001717}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
|
@ -6858,8 +6858,8 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 2.13981342, y: 0.0490087792, z: -1.96055627}
|
Translate: {x: 2.13981342, y: 0.0490087792, z: -1.86932743}
|
||||||
Rotate: {x: 0, y: -1.53675354, z: 0}
|
Rotate: {x: -0, y: -1.53675354, z: 0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
|
@ -8225,3 +8225,23 @@
|
||||||
Clicked: false
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
|
- EID: 503
|
||||||
|
Name: DirectionalLight
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: -0.407547206, y: 3.60323787, z: 2.62217617}
|
||||||
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
|
IsActive: true
|
||||||
|
Light Component:
|
||||||
|
Position: {x: 0.300000012, y: 0, z: 0}
|
||||||
|
Type: Directional
|
||||||
|
Direction: {x: -1.15900004, y: 4.79300022, z: -0.994000018}
|
||||||
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
|
Layer: 4294967295
|
||||||
|
Strength: 0.800000012
|
||||||
|
Casting Shadows: true
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
|
@ -25,6 +25,10 @@ namespace SHADE.Test
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
Animator = GetComponent<Animator>();
|
Animator = GetComponent<Animator>();
|
||||||
|
|
||||||
|
Animator.OnClipStartedPlaying.RegisterAction((_) => Debug.Log("Start Playing"));
|
||||||
|
Animator.OnClipPaused.RegisterAction((_) => Debug.Log("Pause"));
|
||||||
|
Animator.OnClipFinished.RegisterAction((_) => Debug.Log("Finished"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -61,6 +65,15 @@ namespace SHADE.Test
|
||||||
AnimationSystem.TimeScale = AnimationSystem.TimeScale > 0.0f ? 0.0f
|
AnimationSystem.TimeScale = AnimationSystem.TimeScale > 0.0f ? 0.0f
|
||||||
: AnimationSystem.DefaultTimeScale;
|
: AnimationSystem.DefaultTimeScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyUp(Input.KeyCode.P))
|
||||||
|
{
|
||||||
|
if (Animator.IsPlaying)
|
||||||
|
Animator.Pause();
|
||||||
|
else
|
||||||
|
Animator.Play();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
|
|
||||||
public class CutsceneEnd : Script
|
public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,17 @@ public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
initCutscene4();
|
initCutscene4();
|
||||||
initCutscene5();
|
initCutscene5();
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
|
||||||
|
|
||||||
|
//Cutscene 4 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene4Run"] = Audio.CreateAudioClip("event:/Cinematics/4/1_run");
|
||||||
|
|
||||||
|
|
||||||
|
//Cutscene 5 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene5Yay"] = Audio.CreateAudioClip("event:/Cinematics/5/2_yay");
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -70,6 +81,11 @@ public class CutsceneEnd : Script
|
||||||
skip = true;
|
skip = true;
|
||||||
oldDuration = duration;
|
oldDuration = duration;
|
||||||
duration = skipDuration;
|
duration = skipDuration;
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene4Run"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene5Yay"].Stop(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
|
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
|
||||||
|
@ -90,6 +106,11 @@ public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
if (canvas4.IsActiveSelf)
|
if (canvas4.IsActiveSelf)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene4Run"].Play();
|
||||||
|
}
|
||||||
if (showPic4a)
|
if (showPic4a)
|
||||||
{
|
{
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
|
@ -116,6 +137,10 @@ public class CutsceneEnd : Script
|
||||||
|
|
||||||
if (showPic4b)
|
if (showPic4b)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
|
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
|
||||||
|
@ -140,6 +165,10 @@ public class CutsceneEnd : Script
|
||||||
|
|
||||||
if (showPic4c)
|
if (showPic4c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
|
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
|
||||||
|
@ -171,6 +200,10 @@ public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
if (showPic5a)
|
if (showPic5a)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
|
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
|
||||||
|
@ -195,6 +228,11 @@ public class CutsceneEnd : Script
|
||||||
|
|
||||||
if (showPic5b)
|
if (showPic5b)
|
||||||
{
|
{
|
||||||
|
if (time == 0)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene5Yay"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);
|
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
|
|
||||||
public class CutsceneIntro : Script
|
public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,24 @@ public class CutsceneIntro : Script
|
||||||
initCutscene1();
|
initCutscene1();
|
||||||
initCutscene2();
|
initCutscene2();
|
||||||
initCutscene3();
|
initCutscene3();
|
||||||
|
|
||||||
|
//Cutscene BGM
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
|
||||||
|
|
||||||
|
//Cutscene 2 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Stomach"] = Audio.CreateAudioClip("event:/Cinematics/2/1_stomach");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Alert"] = Audio.CreateAudioClip("event:/Cinematics/2/2_alert");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/2/3_sparkle");
|
||||||
|
|
||||||
|
//Cutscene 3 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Jump"] = Audio.CreateAudioClip("event:/Cinematics/3/1_jump");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/3/2_sparkle");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Carry"] = Audio.CreateAudioClip("event:/Cinematics/3/3_carry");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Throw"] = Audio.CreateAudioClip("event:/Cinematics/3/4_throw");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Yay"] = Audio.CreateAudioClip("event:/Cinematics/3/5_yay");
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -98,6 +116,16 @@ public class CutsceneIntro : Script
|
||||||
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
|
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
|
||||||
{
|
{
|
||||||
skip = true;
|
skip = true;
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Stomach"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Alert"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Jump"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Carry"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Throw"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Yay"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
|
||||||
|
|
||||||
oldDuration = duration;
|
oldDuration = duration;
|
||||||
duration = skipDuration;
|
duration = skipDuration;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +156,10 @@ public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
if (canvas1.IsActiveSelf)
|
if (canvas1.IsActiveSelf)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (showPic1a)
|
if (showPic1a)
|
||||||
{
|
{
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
|
@ -154,6 +186,10 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic1b)
|
if (showPic1b)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
|
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
|
||||||
|
@ -178,6 +214,10 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic1c)
|
if (showPic1c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
|
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
|
||||||
|
@ -209,6 +249,11 @@ public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
if (showPic2a)
|
if (showPic2a)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Stomach"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
|
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
|
||||||
|
@ -233,6 +278,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic2b)
|
if (showPic2b)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Alert"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
|
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
|
||||||
|
@ -257,6 +307,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic2c)
|
if (showPic2c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
|
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
|
||||||
|
@ -288,6 +343,11 @@ public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
if (showPic3a)
|
if (showPic3a)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Jump"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
|
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
|
||||||
|
@ -312,6 +372,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3b)
|
if (showPic3b)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
|
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
|
||||||
|
@ -336,6 +401,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3c)
|
if (showPic3c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Carry"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
|
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
|
||||||
|
@ -360,6 +430,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3d)
|
if (showPic3d)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Throw"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
|
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
|
||||||
|
@ -384,6 +459,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3e)
|
if (showPic3e)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Yay"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);
|
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);
|
||||||
|
|
|
@ -31,7 +31,6 @@ namespace SHADE_Scripting.UI
|
||||||
if (mv != null)
|
if (mv != null)
|
||||||
{
|
{
|
||||||
mv.ScaledValue = Settings.masterVolume;
|
mv.ScaledValue = Settings.masterVolume;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (sfx != null)
|
if (sfx != null)
|
||||||
{
|
{
|
||||||
|
@ -68,19 +67,19 @@ namespace SHADE_Scripting.UI
|
||||||
|
|
||||||
if (mv != null)
|
if (mv != null)
|
||||||
{
|
{
|
||||||
Settings.masterVolume = mv.ScaledValue * 0.01f;
|
Settings.masterVolume = mv.ScaledValue;
|
||||||
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume);
|
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume * 0.01f);
|
||||||
}
|
}
|
||||||
if (sfx != null)
|
if (sfx != null)
|
||||||
{
|
{
|
||||||
Settings.sfxVolume = sfx.ScaledValue;
|
Settings.sfxVolume = sfx.ScaledValue;
|
||||||
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume);
|
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume * 0.01f);
|
||||||
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume);
|
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume * 0.01f);
|
||||||
}
|
}
|
||||||
if (bgm != null)
|
if (bgm != null)
|
||||||
{
|
{
|
||||||
Settings.bgmVolume = bgm.ScaledValue;
|
Settings.bgmVolume = bgm.ScaledValue;
|
||||||
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume);
|
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume * 0.01f);
|
||||||
}
|
}
|
||||||
if (fov != null)
|
if (fov != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#version 450
|
||||||
|
#extension GL_KHR_vulkan_glsl : enable
|
||||||
|
|
||||||
|
//#include "ShaderDescriptorDefinitions.glsl"
|
||||||
|
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 aVertexPos;
|
||||||
|
layout(location = 4) in mat4 worldTransform;
|
||||||
|
layout(location = 9) in uvec4 aBoneIndices;
|
||||||
|
layout(location = 10) in vec4 aBoneWeights;
|
||||||
|
layout(location = 11) in uint firstBoneIndex;
|
||||||
|
|
||||||
|
layout(set = 1, binding = 0) uniform CameraData
|
||||||
|
{
|
||||||
|
vec4 position;
|
||||||
|
mat4 vpMat;
|
||||||
|
mat4 viewMat;
|
||||||
|
mat4 projMat;
|
||||||
|
} cameraData;
|
||||||
|
|
||||||
|
layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices
|
||||||
|
{
|
||||||
|
mat4 data[];
|
||||||
|
} BoneMatrices;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// // Compute bone matrix
|
||||||
|
mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3];
|
||||||
|
|
||||||
|
// clip space for rendering
|
||||||
|
// gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
||||||
|
gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f);
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: ShadowMapAnim_VS
|
||||||
|
ID: 39393999
|
||||||
|
Type: 2
|
|
@ -7,9 +7,6 @@ layout(location = 2) in vec3 aNormal;
|
||||||
layout(location = 3) in vec3 aTangent;
|
layout(location = 3) in vec3 aTangent;
|
||||||
layout(location = 4) in mat4 worldTransform;
|
layout(location = 4) in mat4 worldTransform;
|
||||||
layout(location = 8) in uvec2 integerData;
|
layout(location = 8) in uvec2 integerData;
|
||||||
layout(location = 9) in uvec4 aBoneIndices;
|
|
||||||
layout(location = 10) in vec4 aBoneWeights;
|
|
||||||
layout(location = 11) in uint firstBoneIndex;
|
|
||||||
|
|
||||||
layout(location = 0) out struct
|
layout(location = 0) out struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,12 @@ layout(set = 1, binding = 0) uniform CameraData
|
||||||
mat4 projMat;
|
mat4 projMat;
|
||||||
} cameraData;
|
} cameraData;
|
||||||
|
|
||||||
|
layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices
|
||||||
|
{
|
||||||
|
mat4 data[];
|
||||||
|
} BoneMatrices;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Out2.materialIndex = gl_InstanceIndex;
|
Out2.materialIndex = gl_InstanceIndex;
|
||||||
|
@ -63,6 +69,13 @@ void main()
|
||||||
Out.normal.rgb = transposeInv * aNormal.rgb;
|
Out.normal.rgb = transposeInv * aNormal.rgb;
|
||||||
Out.normal.rgb = normalize (Out.normal.rgb);
|
Out.normal.rgb = normalize (Out.normal.rgb);
|
||||||
|
|
||||||
|
// Compute bone matrix
|
||||||
|
mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3];
|
||||||
|
|
||||||
// clip space for rendering
|
// clip space for rendering
|
||||||
gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f);
|
||||||
|
// gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
||||||
}
|
}
|
Binary file not shown.
|
@ -31,8 +31,7 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const float SECS_PER_TICK = 1.0f / static_cast<float>(rawAnim->GetTicksPerSecond());
|
const float SECS_PER_TICK = 1.0f / static_cast<float>(rawAnim->GetTicksPerSecond());
|
||||||
const int ONE_PAST_LAST_FRAME = lastFrame + 1;
|
duration = static_cast<float>(lastFrame - firstFrame) * SECS_PER_TICK;
|
||||||
duration = static_cast<float>(ONE_PAST_LAST_FRAME - firstFrame) * SECS_PER_TICK;
|
|
||||||
startTimeStamp = static_cast<float>(firstFrame) * SECS_PER_TICK;
|
startTimeStamp = static_cast<float>(firstFrame) * SECS_PER_TICK;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "SHAnimationSystem.h"
|
#include "SHAnimationSystem.h"
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
#include "SHAnimationClip.h"
|
#include "SHAnimationClip.h"
|
||||||
|
#include "Events/SHEventManager.hpp"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -55,7 +56,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Lifecycle Functions */
|
/* Lifecycle Functions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void SHAnimationController::Update(InstanceData& instData, float dt)
|
void SHAnimationController::Update(EntityID eid, InstanceData& instData, float dt)
|
||||||
{
|
{
|
||||||
// Is there a valid node
|
// Is there a valid node
|
||||||
if (!instData.CurrentNode)
|
if (!instData.CurrentNode)
|
||||||
|
@ -72,6 +73,7 @@ namespace SHADE
|
||||||
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp() + instData.CurrentNode->Clip->GetTotalDuration();
|
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp() + instData.CurrentNode->Clip->GetTotalDuration();
|
||||||
|
|
||||||
// Go to next state
|
// Go to next state
|
||||||
|
Handle<SHAnimationClip> originalClip = instData.CurrentNode->Clip;
|
||||||
bool stateChanged = false;
|
bool stateChanged = false;
|
||||||
for (const auto& transition : instData.CurrentNode->Transitions)
|
for (const auto& transition : instData.CurrentNode->Transitions)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +109,29 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle if there is no next state, we repeat
|
// Handle if there is no next state, we repeat
|
||||||
if (!stateChanged)
|
if (stateChanged)
|
||||||
|
{
|
||||||
|
// Raise events
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::FinishedEvent
|
||||||
|
{
|
||||||
|
eid,
|
||||||
|
originalClip
|
||||||
|
},
|
||||||
|
SH_ANIMATION_FINISHED_EVENT
|
||||||
|
);
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::PlayEvent
|
||||||
|
{
|
||||||
|
eid,
|
||||||
|
instData.CurrentNode ? instData.CurrentNode->Clip : Handle<SHAnimationClip>()
|
||||||
|
},
|
||||||
|
SH_ANIMATIONS_PLAY_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp();
|
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
#include "Resource/SHHandle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
#include "ECS_Base/SHECSMacros.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -162,7 +163,12 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs a single update for the animation controller.
|
/// Runs a single update for the animation controller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Update(InstanceData& instData, float dt);
|
/// <param name="eid">
|
||||||
|
/// EntityID of the entity that this animation controller is updating.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="instData">Instance data that stores the current state.</param>
|
||||||
|
/// <param name="dt">Frame time.</param>
|
||||||
|
void Update(EntityID eid, InstanceData& instData, float dt);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
|
|
@ -19,6 +19,11 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Forward Declaration */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
class SHAnimationClip;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -29,7 +34,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions - System Routines */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for updating the playback of all animator components and computing
|
/// Responsible for updating the playback of all animator components and computing
|
||||||
|
@ -42,6 +47,40 @@ namespace SHADE
|
||||||
void Execute(double dt) noexcept override final;
|
void Execute(double dt) noexcept override final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Type Definitions - Event Data */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Event data for the SH_ANIMATIONS_PLAY_EVENT event which is raised on the frame
|
||||||
|
/// that an animation has started playing.
|
||||||
|
/// </summary>
|
||||||
|
struct PlayEvent
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
Handle<SHAnimationClip> PlayingClip;
|
||||||
|
float CurrentTimeStamp;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Event data for the SH_ANIMATIONS_PAUSED_EVENT event which is raised on the frame
|
||||||
|
/// that an animation is paused.
|
||||||
|
/// </summary>
|
||||||
|
struct PausedEvent
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
Handle<SHAnimationClip> PausedClip;
|
||||||
|
float PauseTimeStamp;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Event data for the SH_ANIMATIONS_FINISHED_EVENT event which is raised on the
|
||||||
|
/// frame that an animation has finished playing. This will not be called for any
|
||||||
|
/// animation that loops.
|
||||||
|
/// </summary>
|
||||||
|
struct FinishedEvent
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
Handle<SHAnimationClip> FinishedClip;
|
||||||
|
};
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Constants */
|
/* Constants */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -25,6 +25,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||||
#include "Tools/SHDebugDraw.h"
|
#include "Tools/SHDebugDraw.h"
|
||||||
|
#include "Events/SHEventManager.hpp"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -35,6 +36,8 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
playOnce = false;
|
playOnce = false;
|
||||||
|
|
||||||
|
raisePlayEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHAnimatorComponent::Play(Handle<SHAnimationClip> clip)
|
void SHAnimatorComponent::Play(Handle<SHAnimationClip> clip)
|
||||||
|
@ -91,11 +94,13 @@ namespace SHADE
|
||||||
|
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
currPlaybackTime = 0.0f;
|
currPlaybackTime = 0.0f;
|
||||||
|
raisePlayEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHAnimatorComponent::Pause()
|
void SHAnimatorComponent::Pause()
|
||||||
{
|
{
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
|
raisePauseEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHAnimatorComponent::Stop()
|
void SHAnimatorComponent::Stop()
|
||||||
|
@ -119,9 +124,13 @@ namespace SHADE
|
||||||
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
|
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
|
||||||
|
|
||||||
// Do not do anything if is not playing or there's nothing to animate
|
// Do not do anything if is not playing or there's nothing to animate
|
||||||
if (!isPlaying || !rig || !rig->GetRootNode())
|
if (!rig || !rig->GetRootNode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// We want to still display a paused pose, so we only prevent progression
|
||||||
|
if (!isPlaying)
|
||||||
|
dt = 0.0f;
|
||||||
|
|
||||||
// Update the animation controller if any, this will set the currClip
|
// Update the animation controller if any, this will set the currClip
|
||||||
if (animController)
|
if (animController)
|
||||||
{
|
{
|
||||||
|
@ -211,6 +220,19 @@ namespace SHADE
|
||||||
return animController->SetTrigger(animInstanceData, paramName);
|
return animController->SetTrigger(animInstanceData, paramName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Getter Functions */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
Handle<SHAnimationClip> SHAnimatorComponent::GetCurrentClip() const noexcept
|
||||||
|
{
|
||||||
|
if (animController)
|
||||||
|
{
|
||||||
|
return animInstanceData.CurrentNode ? animInstanceData.CurrentNode->Clip : Handle<SHAnimationClip>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return currClip;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Helper Functions - Update */
|
/* Helper Functions - Update */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -221,7 +243,7 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update the animation controller
|
// Update the animation controller
|
||||||
animController->Update(animInstanceData, dt);
|
animController->Update(GetEID(), animInstanceData, dt);
|
||||||
|
|
||||||
// Get current clip
|
// Get current clip
|
||||||
currClip = animInstanceData.CurrentNode->Clip;
|
currClip = animInstanceData.CurrentNode->Clip;
|
||||||
|
@ -241,6 +263,7 @@ namespace SHADE
|
||||||
playOnce = false;
|
playOnce = false;
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
currPlaybackTime = currClip->GetStartTimeStamp() + currClip->GetTotalDuration();
|
currPlaybackTime = currClip->GetStartTimeStamp() + currClip->GetTotalDuration();
|
||||||
|
raiseFinishEvent();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -251,7 +274,7 @@ namespace SHADE
|
||||||
void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime)
|
void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime)
|
||||||
{
|
{
|
||||||
// Nothing to animate
|
// Nothing to animate
|
||||||
if (!clip || !isPlaying || !rig || !rig->GetRootNode())
|
if (!clip || !rig || !rig->GetRootNode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check that we have animation data
|
// Check that we have animation data
|
||||||
|
@ -299,6 +322,50 @@ namespace SHADE
|
||||||
updatePoseWithClip(poseTime, rawAnimData, child, transformMatrix);
|
updatePoseWithClip(poseTime, rawAnimData, child, transformMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Helper Functions - Event */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
void SHAnimatorComponent::raisePlayEvent()
|
||||||
|
{
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::PlayEvent
|
||||||
|
{
|
||||||
|
GetEID(),
|
||||||
|
GetCurrentClip(),
|
||||||
|
GetCurrentClipPlaybackTime()
|
||||||
|
},
|
||||||
|
SH_ANIMATIONS_PLAY_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHAnimatorComponent::raisePauseEvent()
|
||||||
|
{
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::PausedEvent
|
||||||
|
{
|
||||||
|
GetEID(),
|
||||||
|
GetCurrentClip(),
|
||||||
|
GetCurrentClipPlaybackTime()
|
||||||
|
},
|
||||||
|
SH_ANIMATIONS_PAUSED_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHAnimatorComponent::raiseFinishEvent()
|
||||||
|
{
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::FinishedEvent
|
||||||
|
{
|
||||||
|
GetEID(),
|
||||||
|
GetCurrentClip()
|
||||||
|
},
|
||||||
|
SH_ANIMATION_FINISHED_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -24,6 +24,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Math/SHQuaternion.h"
|
#include "Math/SHQuaternion.h"
|
||||||
#include "SHRawAnimation.h"
|
#include "SHRawAnimation.h"
|
||||||
#include "SHAnimationController.h"
|
#include "SHAnimationController.h"
|
||||||
|
#include "SHAnimationSystem.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -166,6 +167,20 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returnsHandle to the currently set animtion controller.</returns>
|
/// <returnsHandle to the currently set animtion controller.</returns>
|
||||||
Handle<SHAnimationController> GetAnimationController() const noexcept { return animController; }
|
Handle<SHAnimationController> GetAnimationController() const noexcept { return animController; }
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the currently playing clip. If there is an Animation Controller, it
|
||||||
|
/// will be retrieved from it. Otherwise, the currently assigned Animation Clip is provided.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Handle to the currently playing Animation Clip if any.</returns>
|
||||||
|
Handle<SHAnimationClip> GetCurrentClip() const noexcept;
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the current timestamp of the currently playing clip. This is relative
|
||||||
|
/// to the start frame of the Animation Clip. This function will retrieve the correct
|
||||||
|
/// playback time depending on the current playback mode (Animation Controller or
|
||||||
|
/// Manual).
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Time in seconds of the current timestamp of the current clip.</returns>
|
||||||
|
float GetCurrentClipPlaybackTime() const noexcept { return animController ? animInstanceData.ClipPlaybackTime : currPlaybackTime; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -201,6 +216,10 @@ namespace SHADE
|
||||||
void updatePoseWithClip(float poseTime, Handle<SHRawAnimation> rawAnimData, Handle<SHRigNode> node, const SHMatrix& parentMatrix);
|
void updatePoseWithClip(float poseTime, Handle<SHRawAnimation> rawAnimData, Handle<SHRigNode> node, const SHMatrix& parentMatrix);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, float poseTime);
|
T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, float poseTime);
|
||||||
|
// Event Functions
|
||||||
|
void raisePlayEvent();
|
||||||
|
void raisePauseEvent();
|
||||||
|
void raiseFinishEvent();
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* RTTR */
|
/* RTTR */
|
||||||
|
|
|
@ -115,6 +115,7 @@ namespace SHADE
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
|
||||||
|
LoadBank((AUDIO_FOLDER_PATH + "Cinematics.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,16 @@ namespace SHADE
|
||||||
camera->dirtyView = true;
|
camera->dirtyView = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
camera->offset = offset;
|
||||||
|
|
||||||
|
SHVec3 tOffset = pivot.GetTargetOffset();
|
||||||
|
|
||||||
|
|
||||||
|
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(pivot.GetYaw()));
|
||||||
|
|
||||||
|
|
||||||
|
if (pivot.lookAtCameraOrigin)
|
||||||
|
CameraLookAt(*camera, camera->position + pivot.GetTargetOffset());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,7 +260,7 @@ namespace SHADE
|
||||||
if (camera.isActive == false)
|
if (camera.isActive == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && &camera != &editorCamera)
|
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && SHComponentManager::HasComponent<SHCameraArmComponent>(camera.GetEID()) == false && &camera != &editorCamera)
|
||||||
{
|
{
|
||||||
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
|
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
|
||||||
SHVec3 rotation = transform->GetWorldRotation();
|
SHVec3 rotation = transform->GetWorldRotation();
|
||||||
|
@ -273,14 +283,14 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
camera.offset = arm->GetOffset();
|
camera.offset = arm->GetOffset();
|
||||||
|
|
||||||
SHVec3 tOffset = arm->GetTargetOffset();
|
/*SHVec3 tOffset = arm->GetTargetOffset();
|
||||||
|
|
||||||
|
|
||||||
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
|
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
|
||||||
|
|
||||||
|
|
||||||
if (arm->lookAtCameraOrigin)
|
if (arm->lookAtCameraOrigin)
|
||||||
CameraLookAt(camera, camera.position + tOffset);
|
CameraLookAt(camera, camera.position + arm->GetTargetOffset());*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,6 @@ constexpr SHEventIdentifier SH_BUTTON_HOVER_ENTER_EVENT { 22 };
|
||||||
constexpr SHEventIdentifier SH_BUTTON_HOVER_EXIT_EVENT { 23 };
|
constexpr SHEventIdentifier SH_BUTTON_HOVER_EXIT_EVENT { 23 };
|
||||||
constexpr SHEventIdentifier SH_ASSET_COMPILE_EVENT { 24 };
|
constexpr SHEventIdentifier SH_ASSET_COMPILE_EVENT { 24 };
|
||||||
constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_DELETE_EVENT { 25 };
|
constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_DELETE_EVENT { 25 };
|
||||||
|
constexpr SHEventIdentifier SH_ANIMATIONS_PAUSED_EVENT { 26 };
|
||||||
|
constexpr SHEventIdentifier SH_ANIMATIONS_PLAY_EVENT { 27 };
|
||||||
|
constexpr SHEventIdentifier SH_ANIMATION_FINISHED_EVENT { 28 };
|
||||||
|
|
|
@ -726,6 +726,22 @@ namespace SHADE
|
||||||
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0);
|
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsAnimated())
|
||||||
|
{
|
||||||
|
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM);
|
||||||
|
if (instanceDataDescSet[frameIndex])
|
||||||
|
{
|
||||||
|
cmdBuffer->BindDescriptorSet
|
||||||
|
(
|
||||||
|
instanceDataDescSet[frameIndex],
|
||||||
|
SH_PIPELINE_TYPE::GRAPHICS,
|
||||||
|
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH),
|
||||||
|
dynamicOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||||
if (instanceDataDescSet[frameIndex])
|
if (instanceDataDescSet[frameIndex])
|
||||||
{
|
{
|
||||||
|
@ -737,6 +753,8 @@ namespace SHADE
|
||||||
dynamicOffset
|
dynamicOffset
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
|
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
|
||||||
cmdBuffer->EndLabeledSegment();
|
cmdBuffer->EndLabeledSegment();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||||
|
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -108,11 +109,19 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHSuperBatch::Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline /*= true*/) noexcept
|
void SHSuperBatch::Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline /*= true*/, Handle<SHVkPipeline> nonAnimPipeline/* = {}*/, Handle<SHVkPipeline> animPipeline/* = {}*/) noexcept
|
||||||
{
|
{
|
||||||
// Build all batches
|
// Build all batches
|
||||||
for (auto& batch : batches)
|
for (auto& batch : batches)
|
||||||
{
|
{
|
||||||
|
if (!bindBatchPipeline)
|
||||||
|
{
|
||||||
|
if (batch.IsAnimated())
|
||||||
|
cmdBuffer->BindPipeline(animPipeline);
|
||||||
|
else
|
||||||
|
cmdBuffer->BindPipeline(nonAnimPipeline);
|
||||||
|
}
|
||||||
|
|
||||||
batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline);
|
batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace SHADE
|
||||||
void Clear() noexcept;
|
void Clear() noexcept;
|
||||||
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||||
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||||
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline = true) noexcept;
|
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline = true, Handle<SHVkPipeline> nonAnimPipeline = {}, Handle<SHVkPipeline> animPipeline = {}) noexcept;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Getter Functions */
|
/* Getter Functions */
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace SHADE
|
||||||
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::predefinedLayouts;
|
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::predefinedLayouts;
|
||||||
SHVertexInputState SHGraphicsPredefinedData::defaultVertexInputState;
|
SHVertexInputState SHGraphicsPredefinedData::defaultVertexInputState;
|
||||||
SHVertexInputState SHGraphicsPredefinedData::shadowMapVertexInputState;
|
SHVertexInputState SHGraphicsPredefinedData::shadowMapVertexInputState;
|
||||||
|
SHVertexInputState SHGraphicsPredefinedData::shadowMapAnimVertexInputState;
|
||||||
|
|
||||||
std::vector<SHGraphicsPredefinedData::PerSystem> SHGraphicsPredefinedData::perSystemData;
|
std::vector<SHGraphicsPredefinedData::PerSystem> SHGraphicsPredefinedData::perSystemData;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ namespace SHADE
|
||||||
{SHPredefinedDescriptorTypes::STATIC_DATA, 0},
|
{SHPredefinedDescriptorTypes::STATIC_DATA, 0},
|
||||||
{SHPredefinedDescriptorTypes::CAMERA, 1},
|
{SHPredefinedDescriptorTypes::CAMERA, 1},
|
||||||
{SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH, 2},
|
{SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH, 2},
|
||||||
|
{SHPredefinedDescriptorTypes::RENDER_GRAPH_RESOURCE, 3},
|
||||||
});
|
});
|
||||||
|
|
||||||
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings
|
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings
|
||||||
|
@ -333,6 +335,17 @@ namespace SHADE
|
||||||
|
|
||||||
shadowMapVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D)});
|
shadowMapVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D)});
|
||||||
shadowMapVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
shadowMapVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
||||||
|
|
||||||
|
shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) });
|
||||||
|
shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
||||||
|
shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::UINT32_4D) }, 6, 9); // Attribute bone indices at index 5
|
||||||
|
shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_4D) }, 7, 10); // Attribute bone weights at index 6
|
||||||
|
shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::UINT32_1D) }, 8, 11); // Instance bone matrix first index at index 7
|
||||||
|
|
||||||
|
|
||||||
|
//shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) });
|
||||||
|
//shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHGraphicsPredefinedData::Init(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
void SHGraphicsPredefinedData::Init(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||||
|
@ -368,6 +381,11 @@ namespace SHADE
|
||||||
return shadowMapVertexInputState;
|
return shadowMapVertexInputState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHVertexInputState const& SHGraphicsPredefinedData::GetShadowMapAnimViState(void) noexcept
|
||||||
|
{
|
||||||
|
return shadowMapAnimVertexInputState;
|
||||||
|
}
|
||||||
|
|
||||||
SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetSystemData(SystemType systemType) noexcept
|
SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetSystemData(SystemType systemType) noexcept
|
||||||
{
|
{
|
||||||
return perSystemData[static_cast<uint32_t>(systemType)];
|
return perSystemData[static_cast<uint32_t>(systemType)];
|
||||||
|
|
|
@ -67,6 +67,9 @@ namespace SHADE
|
||||||
//! vertex input state for shadow mapping
|
//! vertex input state for shadow mapping
|
||||||
static SHVertexInputState shadowMapVertexInputState;
|
static SHVertexInputState shadowMapVertexInputState;
|
||||||
|
|
||||||
|
//! vertex input state for shadow mapping
|
||||||
|
static SHVertexInputState shadowMapAnimVertexInputState;
|
||||||
|
|
||||||
//! Predefined data for each type of system
|
//! Predefined data for each type of system
|
||||||
static std::vector<PerSystem> perSystemData;
|
static std::vector<PerSystem> perSystemData;
|
||||||
|
|
||||||
|
@ -101,6 +104,7 @@ namespace SHADE
|
||||||
static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept;
|
static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept;
|
||||||
static SHVertexInputState const& GetDefaultViState (void) noexcept;
|
static SHVertexInputState const& GetDefaultViState (void) noexcept;
|
||||||
static SHVertexInputState const& GetShadowMapViState (void) noexcept;
|
static SHVertexInputState const& GetShadowMapViState (void) noexcept;
|
||||||
|
static SHVertexInputState const& GetShadowMapAnimViState (void) noexcept;
|
||||||
static PerSystem const& GetSystemData (SystemType systemType) noexcept;
|
static PerSystem const& GetSystemData (SystemType systemType) noexcept;
|
||||||
static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept;
|
static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept;
|
||||||
//static PerSystem const& GetBatchingSystemData(void) noexcept;
|
//static PerSystem const& GetBatchingSystemData(void) noexcept;
|
||||||
|
|
|
@ -128,8 +128,9 @@ namespace SHADE
|
||||||
|
|
||||||
SHFreetypeInstance::Init();
|
SHFreetypeInstance::Init();
|
||||||
|
|
||||||
SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_VS.glsl", false);
|
||||||
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMapAnim_VS.glsl", false);
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
||||||
|
@ -159,6 +160,7 @@ namespace SHADE
|
||||||
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS);
|
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS);
|
||||||
static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS);
|
static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS);
|
||||||
static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
|
static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
|
||||||
|
static constexpr AssetID SHADOW_MAP_ANIM_VS = 39393999; shadowMapAnimVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_ANIM_VS);
|
||||||
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
|
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
|
||||||
static constexpr AssetID TRAJECTORY_VS = 41042628; trajectoryVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_VS);
|
static constexpr AssetID TRAJECTORY_VS = 41042628; trajectoryVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_VS);
|
||||||
static constexpr AssetID TRAJECTORY_FS = 45635685; trajectoryFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_FS);
|
static constexpr AssetID TRAJECTORY_FS = 45635685; trajectoryFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_FS);
|
||||||
|
@ -919,10 +921,19 @@ namespace SHADE
|
||||||
SHGraphicsPredefinedData::SystemType::BATCHING,
|
SHGraphicsPredefinedData::SystemType::BATCHING,
|
||||||
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
|
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
|
||||||
);
|
);
|
||||||
|
|
||||||
|
tempLibrary.CreateGraphicsPipelines
|
||||||
|
(
|
||||||
|
{ shadowMapAnimVS, shadowMapFS }, shadowMapNode->GetRenderpass(), shadowMapDrawSubpass,
|
||||||
|
SHGraphicsPredefinedData::SystemType::BATCHING_ANIM,
|
||||||
|
SHGraphicsPredefinedData::GetShadowMapAnimViState(), rasterState
|
||||||
|
);
|
||||||
|
|
||||||
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS, shadowMapDrawSubpass });
|
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS, shadowMapDrawSubpass });
|
||||||
|
shadowMapAnimPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapAnimVS, shadowMapFS, shadowMapDrawSubpass });
|
||||||
}
|
}
|
||||||
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteSubpass, shadowMapPipeline); // set companion subpass and pipeline
|
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteSubpass, shadowMapPipeline, shadowMapAnimPipeline); // set companion subpass and pipeline
|
||||||
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteVfxSubpass, shadowMapPipeline); // set companion subpass and pipeline
|
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteVfxSubpass, shadowMapPipeline, shadowMapAnimPipeline); // set companion subpass and pipeline
|
||||||
|
|
||||||
// add the shadow map and the blurred version to the lighting system
|
// add the shadow map and the blurred version to the lighting system
|
||||||
uint32_t const NEW_SHADOW_MAP_INDEX = lightingSubSystem->AddShadowMap(renderGraph->GetRenderGraphResource(shadowMapBlurredResourceName), EVENT_DATA->lightEntity);
|
uint32_t const NEW_SHADOW_MAP_INDEX = lightingSubSystem->AddShadowMap(renderGraph->GetRenderGraphResource(shadowMapBlurredResourceName), EVENT_DATA->lightEntity);
|
||||||
|
|
|
@ -479,6 +479,7 @@ namespace SHADE
|
||||||
Handle<SHVkShaderModule> renderToSwapchainVS;
|
Handle<SHVkShaderModule> renderToSwapchainVS;
|
||||||
Handle<SHVkShaderModule> renderToSwapchainFS;
|
Handle<SHVkShaderModule> renderToSwapchainFS;
|
||||||
Handle<SHVkShaderModule> shadowMapVS;
|
Handle<SHVkShaderModule> shadowMapVS;
|
||||||
|
Handle<SHVkShaderModule> shadowMapAnimVS;
|
||||||
Handle<SHVkShaderModule> shadowMapFS;
|
Handle<SHVkShaderModule> shadowMapFS;
|
||||||
Handle<SHVkShaderModule> trajectoryVS;
|
Handle<SHVkShaderModule> trajectoryVS;
|
||||||
Handle<SHVkShaderModule> trajectoryFS;
|
Handle<SHVkShaderModule> trajectoryFS;
|
||||||
|
@ -499,6 +500,7 @@ namespace SHADE
|
||||||
Handle<SHVkPipeline> debugDrawFilledPipeline;
|
Handle<SHVkPipeline> debugDrawFilledPipeline;
|
||||||
Handle<SHVkPipeline> debugDrawFilledDepthPipeline;
|
Handle<SHVkPipeline> debugDrawFilledDepthPipeline;
|
||||||
Handle<SHVkPipeline> shadowMapPipeline; // initialized only when a shadow map is needed
|
Handle<SHVkPipeline> shadowMapPipeline; // initialized only when a shadow map is needed
|
||||||
|
Handle<SHVkPipeline> shadowMapAnimPipeline; // initialized only when a shadow map is needed
|
||||||
|
|
||||||
Handle<SHVkDescriptorSetGroup> genericAndTextureDescSet;
|
Handle<SHVkDescriptorSetGroup> genericAndTextureDescSet;
|
||||||
|
|
||||||
|
|
|
@ -497,7 +497,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// get target node
|
// get target node
|
||||||
auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter);
|
auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter) + 1;
|
||||||
|
|
||||||
auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>(), true));
|
auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>(), true));
|
||||||
ReindexNodes ();
|
ReindexNodes ();
|
||||||
|
|
|
@ -280,8 +280,8 @@ namespace SHADE
|
||||||
for (auto& companion : companionSubpasses)
|
for (auto& companion : companionSubpasses)
|
||||||
{
|
{
|
||||||
// if not bind pipeline for companion and and execute draw command
|
// if not bind pipeline for companion and and execute draw command
|
||||||
commandBuffer->BindPipeline(companion.pipeline);
|
//commandBuffer->BindPipeline(companion.nonAnimPipeline);
|
||||||
companion.subpass->superBatch->Draw(commandBuffer, frameIndex, false);
|
companion.subpass->superBatch->Draw(commandBuffer, frameIndex, false, companion.nonAnimPipeline, companion.animPipeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -496,7 +496,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
if (!dummyPipelineLayout)
|
if (!dummyPipelineLayout)
|
||||||
{
|
{
|
||||||
auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING);
|
auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM);
|
||||||
std::vector newLayouts = batchingSystemData.descSetLayouts;
|
std::vector newLayouts = batchingSystemData.descSetLayouts;
|
||||||
if (inputDescriptorLayout)
|
if (inputDescriptorLayout)
|
||||||
{
|
{
|
||||||
|
@ -528,9 +528,9 @@ namespace SHADE
|
||||||
subpassIndex = index;
|
subpassIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHSubpass::AddCompanionSubpass(Handle<SHSubpass> companion, Handle<SHVkPipeline> pipeline) noexcept
|
void SHSubpass::AddCompanionSubpass(Handle<SHSubpass> companion, Handle<SHVkPipeline> nonAnimPipeline, Handle<SHVkPipeline> animPipeline) noexcept
|
||||||
{
|
{
|
||||||
companionSubpasses.push_back(CompanionSubpass{companion, pipeline});
|
companionSubpasses.push_back(CompanionSubpass{companion, nonAnimPipeline, animPipeline});
|
||||||
//companionSubpass.companion = companion;
|
//companionSubpass.companion = companion;
|
||||||
//companionSubpass.pipeline = pipeline;
|
//companionSubpass.pipeline = pipeline;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,11 @@ namespace SHADE
|
||||||
// subpass whose data will be borrowed to draw
|
// subpass whose data will be borrowed to draw
|
||||||
Handle<SHSubpass> subpass;
|
Handle<SHSubpass> subpass;
|
||||||
|
|
||||||
// Pipeline that will be used for all the draw calls from all batches of the companion subpass
|
// Pipeline that will be used for all the draw calls from all batches (that render without animation data) of the companion subpass
|
||||||
Handle<SHVkPipeline> pipeline;
|
Handle<SHVkPipeline> nonAnimPipeline;
|
||||||
|
|
||||||
|
// Pipeline that will be used for all the draw calls from all batches (that render with animation data) of the companion subpass
|
||||||
|
Handle<SHVkPipeline> animPipeline;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -167,7 +170,7 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* PUBLIC SETTERS AND GETTERS */
|
/* PUBLIC SETTERS AND GETTERS */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
void AddCompanionSubpass (Handle<SHSubpass> companion, Handle<SHVkPipeline> pipeline) noexcept;
|
void AddCompanionSubpass (Handle<SHSubpass> companion, Handle<SHVkPipeline> nonAnimPipeline, Handle<SHVkPipeline> animPipeline) noexcept;
|
||||||
|
|
||||||
Handle<SHRenderGraphNode> GetParentNode(void) const noexcept;
|
Handle<SHRenderGraphNode> GetParentNode(void) const noexcept;
|
||||||
SHSubPassIndex GetIndex() const noexcept;
|
SHSubPassIndex GetIndex() const noexcept;
|
||||||
|
|
|
@ -34,6 +34,8 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "UI/Events/SHButtonClickEvent.h"
|
#include "UI/Events/SHButtonClickEvent.h"
|
||||||
#include "UI/SHUIComponent.h"
|
#include "UI/SHUIComponent.h"
|
||||||
#include "Editor/EditorWindow/MenuBar/SHEditorMenuBar.h"
|
#include "Editor/EditorWindow/MenuBar/SHEditorMenuBar.h"
|
||||||
|
#include "Animation/SHAnimatorComponent.h"
|
||||||
|
#include "Resource/SHResourceManager.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -412,6 +414,49 @@ namespace SHADE
|
||||||
return eventData->handle;
|
return eventData->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHEventHandle SHScriptEngine::onAnimatorRemoved(SHEventPtr eventPtr)
|
||||||
|
{
|
||||||
|
auto eventData = reinterpret_cast<const SHEventSpec<SHComponentRemovedEvent>*>(eventPtr.get());
|
||||||
|
if (eventData->data->removedComponentType == ComponentFamily::GetID<SHAnimatorComponent>())
|
||||||
|
csAnimatorOnRemoved(eventData->data->eid);
|
||||||
|
return eventData->handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHEventHandle SHScriptEngine::onAnimatorClipStartedPlaying(SHEventPtr eventPtr)
|
||||||
|
{
|
||||||
|
auto eventData = reinterpret_cast<const SHEventSpec<SHAnimationSystem::PlayEvent>*>(eventPtr.get());
|
||||||
|
csAnimatorOnClipStartPlaying
|
||||||
|
(
|
||||||
|
eventData->data->Entity,
|
||||||
|
SHResourceManager::GetAssetID(eventData->data->PlayingClip).value_or(INVALID_ASSET_ID),
|
||||||
|
eventData->data->CurrentTimeStamp
|
||||||
|
);
|
||||||
|
return eventData->handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHEventHandle SHScriptEngine::onAnimatorClipPaused(SHEventPtr eventPtr)
|
||||||
|
{
|
||||||
|
auto eventData = reinterpret_cast<const SHEventSpec<SHAnimationSystem::PausedEvent>*>(eventPtr.get());
|
||||||
|
csAnimatorOnClipPaused
|
||||||
|
(
|
||||||
|
eventData->data->Entity,
|
||||||
|
SHResourceManager::GetAssetID(eventData->data->PausedClip).value_or(INVALID_ASSET_ID),
|
||||||
|
eventData->data->PauseTimeStamp
|
||||||
|
);
|
||||||
|
return eventData->handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
SHEventHandle SHScriptEngine::onAnimatorClipFinished(SHEventPtr eventPtr)
|
||||||
|
{
|
||||||
|
auto eventData = reinterpret_cast<const SHEventSpec<SHAnimationSystem::FinishedEvent>*>(eventPtr.get());
|
||||||
|
csAnimatorOnClipFinished
|
||||||
|
(
|
||||||
|
eventData->data->Entity,
|
||||||
|
SHResourceManager::GetAssetID(eventData->data->FinishedClip).value_or(INVALID_ASSET_ID)
|
||||||
|
);
|
||||||
|
return eventData->handle;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Helper Functions */
|
/* Helper Functions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -578,6 +623,30 @@ namespace SHADE
|
||||||
DEFAULT_CSHARP_NAMESPACE + ".UIElement",
|
DEFAULT_CSHARP_NAMESPACE + ".UIElement",
|
||||||
"OnHoverExited"
|
"OnHoverExited"
|
||||||
);
|
);
|
||||||
|
csAnimatorOnRemoved = dotNet.GetFunctionPtr<CsEventRelayFuncPtr>
|
||||||
|
(
|
||||||
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
|
DEFAULT_CSHARP_NAMESPACE + ".Animator",
|
||||||
|
"OnComponentRemoved"
|
||||||
|
);
|
||||||
|
csAnimatorOnClipStartPlaying = dotNet.GetFunctionPtr<CsEventRelayAnimTimeFuncPtr>
|
||||||
|
(
|
||||||
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
|
DEFAULT_CSHARP_NAMESPACE + ".Animator",
|
||||||
|
"RaiseOnClipStartedPlaying"
|
||||||
|
);
|
||||||
|
csAnimatorOnClipPaused = dotNet.GetFunctionPtr<CsEventRelayAnimTimeFuncPtr>
|
||||||
|
(
|
||||||
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
|
DEFAULT_CSHARP_NAMESPACE + ".Animator",
|
||||||
|
"RaiseOnClipPaused"
|
||||||
|
);
|
||||||
|
csAnimatorOnClipFinished = dotNet.GetFunctionPtr<CsEventRelayAnimFuncPtr>
|
||||||
|
(
|
||||||
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
|
DEFAULT_CSHARP_NAMESPACE + ".Animator",
|
||||||
|
"RaiseOnClipFinished"
|
||||||
|
);
|
||||||
csEditorRenderScripts = dotNet.GetFunctionPtr<CsScriptEditorFuncPtr>
|
csEditorRenderScripts = dotNet.GetFunctionPtr<CsScriptEditorFuncPtr>
|
||||||
(
|
(
|
||||||
DEFAULT_CSHARP_LIB_NAME,
|
DEFAULT_CSHARP_LIB_NAME,
|
||||||
|
@ -663,6 +732,28 @@ namespace SHADE
|
||||||
};
|
};
|
||||||
SHEventManager::SubscribeTo(SH_BUTTON_HOVER_EXIT_EVENT, std::dynamic_pointer_cast<SHEventReceiver>(hoverExitedUIElementEventReceiver));
|
SHEventManager::SubscribeTo(SH_BUTTON_HOVER_EXIT_EVENT, std::dynamic_pointer_cast<SHEventReceiver>(hoverExitedUIElementEventReceiver));
|
||||||
|
|
||||||
|
/* Animator */
|
||||||
|
std::shared_ptr<SHEventReceiverSpec<SHScriptEngine>> removedAnimatorEventReceiver
|
||||||
|
{
|
||||||
|
std::make_shared<SHEventReceiverSpec<SHScriptEngine>>(this, &SHScriptEngine::onAnimatorRemoved)
|
||||||
|
};
|
||||||
|
SHEventManager::SubscribeTo(SH_COMPONENT_REMOVED_EVENT, std::dynamic_pointer_cast<SHEventReceiver>(removedAnimatorEventReceiver));
|
||||||
|
std::shared_ptr<SHEventReceiverSpec<SHScriptEngine>> animStartedPlayingEventReceiver
|
||||||
|
{
|
||||||
|
std::make_shared<SHEventReceiverSpec<SHScriptEngine>>(this, &SHScriptEngine::onAnimatorClipStartedPlaying)
|
||||||
|
};
|
||||||
|
SHEventManager::SubscribeTo(SH_ANIMATIONS_PLAY_EVENT, std::dynamic_pointer_cast<SHEventReceiver>(animStartedPlayingEventReceiver));
|
||||||
|
std::shared_ptr<SHEventReceiverSpec<SHScriptEngine>> animPausedEventReceiver
|
||||||
|
{
|
||||||
|
std::make_shared<SHEventReceiverSpec<SHScriptEngine>>(this, &SHScriptEngine::onAnimatorClipPaused)
|
||||||
|
};
|
||||||
|
SHEventManager::SubscribeTo(SH_ANIMATIONS_PAUSED_EVENT, std::dynamic_pointer_cast<SHEventReceiver>(animPausedEventReceiver));
|
||||||
|
std::shared_ptr<SHEventReceiverSpec<SHScriptEngine>> animFinishedEventReceiver
|
||||||
|
{
|
||||||
|
std::make_shared<SHEventReceiverSpec<SHScriptEngine>>(this, &SHScriptEngine::onAnimatorClipFinished)
|
||||||
|
};
|
||||||
|
SHEventManager::SubscribeTo(SH_ANIMATION_FINISHED_EVENT, std::dynamic_pointer_cast<SHEventReceiver>(animFinishedEventReceiver));
|
||||||
|
|
||||||
/* SceneGraph */
|
/* SceneGraph */
|
||||||
// Register for SceneNode child added event
|
// Register for SceneNode child added event
|
||||||
std::shared_ptr<SHEventReceiverSpec<SHScriptEngine>> addChildEventReceiver
|
std::shared_ptr<SHEventReceiverSpec<SHScriptEngine>> addChildEventReceiver
|
||||||
|
|
|
@ -24,6 +24,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "ECS_Base/System/SHSystemRoutine.h"
|
#include "ECS_Base/System/SHSystemRoutine.h"
|
||||||
#include "Events/SHEventDefines.h"
|
#include "Events/SHEventDefines.h"
|
||||||
#include "Events/SHEvent.h"
|
#include "Events/SHEvent.h"
|
||||||
|
#include "Assets/SHAssetMacros.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -251,6 +252,8 @@ namespace SHADE
|
||||||
using CsScriptDeserialiseYamlFuncPtr = bool(*)(EntityID, const void*);
|
using CsScriptDeserialiseYamlFuncPtr = bool(*)(EntityID, const void*);
|
||||||
using CsScriptEditorFuncPtr = void(*)(EntityID);
|
using CsScriptEditorFuncPtr = void(*)(EntityID);
|
||||||
using CsEventRelayFuncPtr = void(*)(EntityID);
|
using CsEventRelayFuncPtr = void(*)(EntityID);
|
||||||
|
using CsEventRelayAnimFuncPtr = void(*)(EntityID, AssetID);
|
||||||
|
using CsEventRelayAnimTimeFuncPtr = void(*)(EntityID, AssetID, float);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Constants */
|
/* Constants */
|
||||||
|
@ -295,6 +298,12 @@ namespace SHADE
|
||||||
CsEventRelayFuncPtr csUIElementOnReleased = nullptr;
|
CsEventRelayFuncPtr csUIElementOnReleased = nullptr;
|
||||||
CsEventRelayFuncPtr csUIElementOnHoverEntered = nullptr;
|
CsEventRelayFuncPtr csUIElementOnHoverEntered = nullptr;
|
||||||
CsEventRelayFuncPtr csUIElementOnHoverExited = nullptr;
|
CsEventRelayFuncPtr csUIElementOnHoverExited = nullptr;
|
||||||
|
CsEventRelayFuncPtr csAnimatorOnRemoved = nullptr;
|
||||||
|
CsEventRelayAnimTimeFuncPtr csAnimatorOnClipStartPlaying = nullptr;
|
||||||
|
CsEventRelayAnimTimeFuncPtr csAnimatorOnClipPaused = nullptr;
|
||||||
|
CsEventRelayAnimFuncPtr csAnimatorOnClipFinished = nullptr;
|
||||||
|
|
||||||
|
|
||||||
// - Editor
|
// - Editor
|
||||||
CsScriptEditorFuncPtr csEditorRenderScripts = nullptr;
|
CsScriptEditorFuncPtr csEditorRenderScripts = nullptr;
|
||||||
CsFuncPtr csEditorUndo = nullptr;
|
CsFuncPtr csEditorUndo = nullptr;
|
||||||
|
@ -315,6 +324,10 @@ namespace SHADE
|
||||||
SHEventHandle onSceneNodeChildrenAdded(SHEventPtr eventPtr);
|
SHEventHandle onSceneNodeChildrenAdded(SHEventPtr eventPtr);
|
||||||
SHEventHandle onSceneNodeChildrenRemoved(SHEventPtr eventPtr);
|
SHEventHandle onSceneNodeChildrenRemoved(SHEventPtr eventPtr);
|
||||||
SHEventHandle onSceneDestroyed(SHEventPtr eventPtr);
|
SHEventHandle onSceneDestroyed(SHEventPtr eventPtr);
|
||||||
|
SHEventHandle onAnimatorRemoved(SHEventPtr eventPtr);
|
||||||
|
SHEventHandle onAnimatorClipStartedPlaying(SHEventPtr eventPtr);
|
||||||
|
SHEventHandle onAnimatorClipPaused(SHEventPtr eventPtr);
|
||||||
|
SHEventHandle onAnimatorClipFinished(SHEventPtr eventPtr);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Helper Functions */
|
/* Helper Functions */
|
||||||
|
|
|
@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Animator.hxx"
|
#include "Animator.hxx"
|
||||||
#include "Assets/NativeAsset.hxx"
|
#include "Assets/NativeAsset.hxx"
|
||||||
#include "Utility/Convert.hxx"
|
#include "Utility/Convert.hxx"
|
||||||
|
#include "Utility/Debug.hxx"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -69,6 +70,65 @@ namespace SHADE
|
||||||
return Convert::ToCLI(CURR_NODE->Name);
|
return Convert::ToCLI(CURR_NODE->Name);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
bool Animator::IsPlaying::get()
|
||||||
|
{
|
||||||
|
return GetNativeComponent()->IsPlaying();
|
||||||
|
}
|
||||||
|
float Animator::CurrentClipPlaybackTime::get()
|
||||||
|
{
|
||||||
|
return GetNativeComponent()->GetCurrentClipPlaybackTime();
|
||||||
|
}
|
||||||
|
CallbackEvent<ClipStartPlayingEventData>^ Animator::OnClipStartedPlaying::get()
|
||||||
|
{
|
||||||
|
// Create map if it wasn't before
|
||||||
|
if (onClipStartPlayingEventMap == nullptr)
|
||||||
|
{
|
||||||
|
onClipStartPlayingEventMap = gcnew System::Collections::Generic::Dictionary<Entity, CallbackEvent<ClipStartPlayingEventData>^>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create event if it wasn't before
|
||||||
|
if (!onClipStartPlayingEventMap->ContainsKey(owner.EntityId))
|
||||||
|
{
|
||||||
|
onClipStartPlayingEventMap->Add(owner.EntityId, gcnew CallbackEvent<ClipStartPlayingEventData>());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the event
|
||||||
|
return onClipStartPlayingEventMap[owner.EntityId];
|
||||||
|
}
|
||||||
|
CallbackEvent<ClipPausedEventData>^ Animator::OnClipPaused::get()
|
||||||
|
{
|
||||||
|
// Create map if it wasn't before
|
||||||
|
if (onClipPausedEventMap == nullptr)
|
||||||
|
{
|
||||||
|
onClipPausedEventMap = gcnew System::Collections::Generic::Dictionary<Entity, CallbackEvent<ClipPausedEventData>^>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create event if it wasn't before
|
||||||
|
if (!onClipPausedEventMap->ContainsKey(owner.EntityId))
|
||||||
|
{
|
||||||
|
onClipPausedEventMap->Add(owner.EntityId, gcnew CallbackEvent<ClipPausedEventData>());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the event
|
||||||
|
return onClipPausedEventMap[owner.EntityId];
|
||||||
|
}
|
||||||
|
CallbackEvent<ClipFinishedEventData>^ Animator::OnClipFinished::get()
|
||||||
|
{
|
||||||
|
// Create map if it wasn't before
|
||||||
|
if (onClipFinishedEventMap == nullptr)
|
||||||
|
{
|
||||||
|
onClipFinishedEventMap = gcnew System::Collections::Generic::Dictionary<Entity, CallbackEvent<ClipFinishedEventData>^>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create event if it wasn't before
|
||||||
|
if (!onClipFinishedEventMap->ContainsKey(owner.EntityId))
|
||||||
|
{
|
||||||
|
onClipFinishedEventMap->Add(owner.EntityId, gcnew CallbackEvent<ClipFinishedEventData>());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the event
|
||||||
|
return onClipFinishedEventMap[owner.EntityId];
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
@ -156,4 +216,82 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
return GetBoolParameter(paramName);
|
return GetBoolParameter(paramName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Static Clear Functions */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
void Animator::ClearStaticEventData()
|
||||||
|
{
|
||||||
|
if (onClipStartPlayingEventMap != nullptr)
|
||||||
|
onClipStartPlayingEventMap->Clear();
|
||||||
|
if (onClipPausedEventMap != nullptr)
|
||||||
|
onClipPausedEventMap->Clear();
|
||||||
|
if (onClipFinishedEventMap != nullptr)
|
||||||
|
onClipFinishedEventMap->Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Event Handling Functions */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
void Animator::OnComponentRemoved(EntityID entity)
|
||||||
|
{
|
||||||
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
|
// Remove the event if it contained an event
|
||||||
|
if (onClipStartPlayingEventMap != nullptr && onClipStartPlayingEventMap->ContainsKey(entity))
|
||||||
|
{
|
||||||
|
onClipStartPlayingEventMap->Remove(entity);
|
||||||
|
}
|
||||||
|
if (onClipPausedEventMap != nullptr && onClipPausedEventMap->ContainsKey(entity))
|
||||||
|
{
|
||||||
|
onClipPausedEventMap->Remove(entity);
|
||||||
|
}
|
||||||
|
if (onClipFinishedEventMap != nullptr && onClipFinishedEventMap->ContainsKey(entity))
|
||||||
|
{
|
||||||
|
onClipFinishedEventMap->Remove(entity);
|
||||||
|
}
|
||||||
|
SAFE_NATIVE_CALL_END("Animator.OnComponentRemoved")
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animator::RaiseOnClipStartedPlaying(EntityID entity, AssetID animAssetId, float currTimeStamp)
|
||||||
|
{
|
||||||
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
|
// Remove the event if it contained an event
|
||||||
|
if (onClipStartPlayingEventMap != nullptr && onClipStartPlayingEventMap->ContainsKey(entity))
|
||||||
|
{
|
||||||
|
ClipStartPlayingEventData data;
|
||||||
|
data.PlayingClip = AnimationClipAsset(animAssetId);
|
||||||
|
data.CurrentTimeStamp = currTimeStamp;
|
||||||
|
onClipStartPlayingEventMap[entity]->Invoke(data);
|
||||||
|
}
|
||||||
|
SAFE_NATIVE_CALL_END("Animator.OnClipStartedPlaying")
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animator::RaiseOnClipPaused(EntityID entity, AssetID animAssetId, float currTimeStamp)
|
||||||
|
{
|
||||||
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
|
// Remove the event if it contained an event
|
||||||
|
if (onClipPausedEventMap != nullptr && onClipPausedEventMap->ContainsKey(entity))
|
||||||
|
{
|
||||||
|
ClipPausedEventData data;
|
||||||
|
data.PausedClip = AnimationClipAsset(animAssetId);
|
||||||
|
data.PauseTimeStamp = currTimeStamp;
|
||||||
|
onClipPausedEventMap[entity]->Invoke(data);
|
||||||
|
}
|
||||||
|
SAFE_NATIVE_CALL_END("Animator.OnClipPaused")
|
||||||
|
}
|
||||||
|
|
||||||
|
void Animator::RaiseOnClipFinished(EntityID entity, AssetID animAssetId)
|
||||||
|
{
|
||||||
|
|
||||||
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
|
// Remove the event if it contained an event
|
||||||
|
if (onClipFinishedEventMap != nullptr && onClipFinishedEventMap->ContainsKey(entity))
|
||||||
|
{
|
||||||
|
ClipFinishedEventData data;
|
||||||
|
data.FinishedClip = AnimationClipAsset(animAssetId);
|
||||||
|
onClipFinishedEventMap[entity]->Invoke(data);
|
||||||
|
}
|
||||||
|
SAFE_NATIVE_CALL_END("Animator.OnClipFinished")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,47 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Simple struct that holds event data for the Animator.OnClipStartedPlaying event.
|
||||||
|
/// </summary>
|
||||||
|
public value struct ClipStartPlayingEventData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Animation Clip that started playing.
|
||||||
|
/// </summary>
|
||||||
|
AnimationClipAsset PlayingClip;
|
||||||
|
/// <summary>
|
||||||
|
/// Timestamp that the Animation Clip started playing at. This is relative to
|
||||||
|
/// the first frame of the Animation Clip.
|
||||||
|
/// </summary>
|
||||||
|
float CurrentTimeStamp;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Simple struct that holds event data for the Animator.OnClipPaused event.
|
||||||
|
/// </summary>
|
||||||
|
public value struct ClipPausedEventData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Animation Clip that was paused.
|
||||||
|
/// </summary>
|
||||||
|
AnimationClipAsset PausedClip;
|
||||||
|
/// <summary>
|
||||||
|
/// Timestamp that the Animation Clip was paused at. This is relative to
|
||||||
|
/// the first frame of the Animation Clip.
|
||||||
|
/// </summary>
|
||||||
|
float PauseTimeStamp;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Simple struct that holds event data for the Animator.OnClipFinished event.
|
||||||
|
/// </summary>
|
||||||
|
public value struct ClipFinishedEventData
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Animation Clip that just finished.
|
||||||
|
/// </summary>
|
||||||
|
AnimationClipAsset FinishedClip;
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// CLR version of the SHADE Engine's SHAnimatorComponent.
|
/// CLR version of the SHADE Engine's SHAnimatorComponent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -70,6 +111,45 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
System::String^ get();
|
System::String^ get();
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Whether an animation is currently playing.
|
||||||
|
/// </summary>
|
||||||
|
property bool IsPlaying
|
||||||
|
{
|
||||||
|
bool get();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the current timestamp of the currently playing clip. This is
|
||||||
|
/// relative to the start frame of the Animation Clip. This will retrieve the
|
||||||
|
/// correct playback time depending on the current playback mode
|
||||||
|
/// (Animation Controller or via direct Animation Clip).
|
||||||
|
/// </summary>
|
||||||
|
property float CurrentClipPlaybackTime
|
||||||
|
{
|
||||||
|
float get();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Event which is raised on the frame that an animation has started playing.
|
||||||
|
/// </summary>
|
||||||
|
property CallbackEvent<ClipStartPlayingEventData>^ OnClipStartedPlaying
|
||||||
|
{
|
||||||
|
CallbackEvent<ClipStartPlayingEventData>^ get();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Event which is raised on the frame that an animation is paused.
|
||||||
|
/// </summary>
|
||||||
|
property CallbackEvent<ClipPausedEventData>^ OnClipPaused
|
||||||
|
{
|
||||||
|
CallbackEvent<ClipPausedEventData>^ get();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Event which is raised on the frame that an animation has finished playing.
|
||||||
|
/// This will not be called for any animation that loops.
|
||||||
|
/// </summary>
|
||||||
|
property CallbackEvent<ClipFinishedEventData>^ OnClipFinished
|
||||||
|
{
|
||||||
|
CallbackEvent<ClipFinishedEventData>^ get();
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
@ -159,6 +239,55 @@ namespace SHADE
|
||||||
/// <param name="paramName">Name of the parameter.</param>
|
/// <param name="paramName">Name of the parameter.</param>
|
||||||
/// <returns>True if the trigger is set.</returns>
|
/// <returns>True if the trigger is set.</returns>
|
||||||
System::Nullable<bool> GetTriggerState(System::String^ paramName);
|
System::Nullable<bool> GetTriggerState(System::String^ paramName);
|
||||||
|
|
||||||
|
internal:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Static Clear Functions */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Disposes static event data which may contains data from SHADE_Scripting.
|
||||||
|
/// </summary>
|
||||||
|
static void ClearStaticEventData();
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Event Handling Functions */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// To be called from native code when this component is removed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">The entity which has it's component removed.</param>
|
||||||
|
static void OnComponentRemoved(EntityID entity);
|
||||||
|
/// <summary>
|
||||||
|
/// To be called from native code when a clip for this component has started
|
||||||
|
/// playing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">The entity which has a clip start playing.</param>
|
||||||
|
/// <param name="animAssetId">AssetID of the animation clip.</param>
|
||||||
|
/// <param name="currTimeStamp">Timestamp that the clip was started at.</param>
|
||||||
|
static void RaiseOnClipStartedPlaying(EntityID entity, AssetID animAssetId, float currTimeStamp);
|
||||||
|
/// <summary>
|
||||||
|
/// To be called from native code when a clip for this component has been paused.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">The entity which a clip has paused.</param>
|
||||||
|
/// <param name="animAssetId">AssetID of the animation clip.</param>
|
||||||
|
/// <param name="currTimeStamp">Timestamp that the clip was paused at.</param>
|
||||||
|
static void RaiseOnClipPaused(EntityID entity, AssetID animAssetId, float currTimeStamp);
|
||||||
|
/// <summary>
|
||||||
|
/// To be called from native code when a clip for this component has finished
|
||||||
|
/// playing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">The entity which a clip has finished playing.</param>
|
||||||
|
/// <param name="animAssetId">AssetID of the animation clip.</param>
|
||||||
|
static void RaiseOnClipFinished(EntityID entity, AssetID animAssetId);
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/* Static Data Members */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
// As these hold references to code in SHADE_Scripting, we must remember to dispose of them when changing scenes
|
||||||
|
static System::Collections::Generic::Dictionary<Entity, CallbackEvent<ClipStartPlayingEventData>^>^ onClipStartPlayingEventMap;
|
||||||
|
static System::Collections::Generic::Dictionary<Entity, CallbackEvent<ClipPausedEventData>^>^ onClipPausedEventMap;
|
||||||
|
static System::Collections::Generic::Dictionary<Entity, CallbackEvent<ClipFinishedEventData>^>^ onClipFinishedEventMap;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,18 +28,6 @@ namespace SHADE
|
||||||
: Component(entity)
|
: Component(entity)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void UIElement::ClearStaticEventData()
|
|
||||||
{
|
|
||||||
if (onClickEventMap != nullptr)
|
|
||||||
onClickEventMap->Clear();
|
|
||||||
if (onReleasedEventMap != nullptr)
|
|
||||||
onReleasedEventMap->Clear();
|
|
||||||
if (onHoverEnterEventMap != nullptr)
|
|
||||||
onHoverEnterEventMap->Clear();
|
|
||||||
if (onHoverExitEventMap != nullptr)
|
|
||||||
onHoverExitEventMap->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Properties */
|
/* Properties */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -112,9 +100,24 @@ namespace SHADE
|
||||||
return onHoverExitEventMap[owner.EntityId];
|
return onHoverExitEventMap[owner.EntityId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Static Clear Functions */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
void UIElement::ClearStaticEventData()
|
||||||
|
{
|
||||||
|
if (onClickEventMap != nullptr)
|
||||||
|
onClickEventMap->Clear();
|
||||||
|
if (onReleasedEventMap != nullptr)
|
||||||
|
onReleasedEventMap->Clear();
|
||||||
|
if (onHoverEnterEventMap != nullptr)
|
||||||
|
onHoverEnterEventMap->Clear();
|
||||||
|
if (onHoverExitEventMap != nullptr)
|
||||||
|
onHoverExitEventMap->Clear();
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Event Handling Functions */
|
/* Event Handling Functions */
|
||||||
/*-----------------------------------------------------------------------------a----*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
void UIElement::OnComponentRemoved(EntityID entity)
|
void UIElement::OnComponentRemoved(EntityID entity)
|
||||||
{
|
{
|
||||||
SAFE_NATIVE_CALL_BEGIN
|
SAFE_NATIVE_CALL_BEGIN
|
||||||
|
|
|
@ -22,6 +22,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Utility/Debug.hxx"
|
#include "Utility/Debug.hxx"
|
||||||
#include "Scripts/ScriptStore.hxx"
|
#include "Scripts/ScriptStore.hxx"
|
||||||
#include "Components/UIElement.hxx"
|
#include "Components/UIElement.hxx"
|
||||||
|
#include "Components/Animator.hxx"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,7 @@ namespace SHADE
|
||||||
|
|
||||||
// Unload static data of components that have access to the assembly
|
// Unload static data of components that have access to the assembly
|
||||||
UIElement::ClearStaticEventData();
|
UIElement::ClearStaticEventData();
|
||||||
|
Animator::ClearStaticEventData();
|
||||||
|
|
||||||
// Unload the script
|
// Unload the script
|
||||||
scriptContext->Unload();
|
scriptContext->Unload();
|
||||||
|
|
Loading…
Reference in New Issue