Merge remote-tracking branch 'origin/main' into SP3-2-Physics

This commit is contained in:
Diren D Bharwani 2023-02-03 22:44:58 +08:00
commit c61be35da0
32 changed files with 2610 additions and 235 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8432,7 +8432,7 @@
- EID: 20
Name: ===== Light =====
IsActive: true
NumberOfChildren: 2
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 296
@ -8463,6 +8463,25 @@
Strength: 0.699999988
IsActive: true
Scripts: ~
- EID: 65674
Name: Light_Directional
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2, y: 1.5, z: -5.5999999}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Light Component:
Position: {x: 2, y: 1.5, z: -5.5999999}
Type: Directional
Direction: {x: 1, y: 0, z: 0}
Color: {x: 0, y: 0, z: 0, w: 1}
Layer: 4294967295
Strength: 1
IsActive: true
Scripts: ~
- EID: 240
Name: ====ItemPool====
IsActive: true
@ -8486,7 +8505,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8533,7 +8552,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8580,7 +8599,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8627,7 +8646,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8674,7 +8693,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8721,7 +8740,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8768,7 +8787,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8815,7 +8834,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8862,7 +8881,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8909,7 +8928,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -8960,7 +8979,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9007,7 +9026,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9054,7 +9073,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9101,7 +9120,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9148,7 +9167,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9195,7 +9214,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9246,7 +9265,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9287,7 +9306,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9328,7 +9347,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9369,7 +9388,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9410,9 +9429,9 @@
Scale: {x: 1, y: 1, z: 1}
IsActive: true
RigidBody Component:
Type: Static
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9449,9 +9468,9 @@
Scale: {x: 1, y: 1, z: 1}
IsActive: true
RigidBody Component:
Type: Static
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9493,10 +9512,14 @@
timer: 200
scoreText: 237
timeText: 206
multiplierText: 139
maxMultiplierDuration: 5
maxMultiplierCombo: 10
multiplierFont: 60
- EID: 199
Name: =====Text====
IsActive: true
NumberOfChildren: 2
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 237
@ -9529,6 +9552,21 @@
Font: 176667660
IsActive: true
Scripts: ~
- EID: 139
Name: Multiplier
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 300, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 60, y: 60, z: 60}
IsActive: true
Text Renderer Component:
Text: TEST
Font: 176667660
IsActive: true
Scripts: ~
- EID: 198
Name: ====Raccoon====
IsActive: true
@ -9551,7 +9589,7 @@
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 1
Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: false
Interpolate: true
@ -9696,7 +9734,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9741,7 +9779,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9782,7 +9820,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9823,7 +9861,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9864,7 +9902,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9905,7 +9943,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9950,7 +9988,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -9991,7 +10029,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10032,7 +10070,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10073,7 +10111,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10114,7 +10152,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10159,7 +10197,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10200,7 +10238,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10241,7 +10279,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10282,7 +10320,7 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
@ -10406,9 +10444,9 @@
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: false
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false

View File

@ -67,3 +67,4 @@
Scripts:
- Type: MainMenu
Enabled: true
sceneID: 96668835

View File

@ -0,0 +1,19 @@
using System;
using SHADE;
public class FixRotation : Script
{
Transform tran;
protected override void awake()
{
tran = GetComponent<Transform>();
}
protected override void update()
{
if(tran)
tran.LocalEulerAngles = Vector3.Zero;
}
}

View File

@ -0,0 +1,3 @@
Name: FixRotation
ID: 162507316
Type: 9

View File

@ -12,7 +12,6 @@ public class Breakable : Script
private Transform trans;
public bool isBreak { get; set; }
private List<GameObject> itemPieces = new List<GameObject>();
private Random ran = new Random();
protected override void awake()
{
@ -44,7 +43,7 @@ public class Breakable : Script
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
return;
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold)
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold && !info.GameObject.GetScript<PlayerController>())
{
isBreak = true;
if(GameObject.GetScript<Item>())

View File

@ -208,12 +208,23 @@ public class PickAndThrow : Script
List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535);
List<RaycastHit> rayList3 = Physics.Raycast(new Ray(playerRayPos, dirNor), rayDistance * 0.75f, false, (ushort)65535);
if (rayList1.Count > 0 && rayList2.Count > 0 && rayList3.Count > 0)
if (rayList1.Count > 0)
{
RaycastHit ray1 = rayList1[0];
inRange = CheckForItem(ray1);
return;
}
else if (rayList2.Count > 0)
{
RaycastHit ray2 = rayList2[0];
inRange = CheckForItem(ray2);
return;
}
else if (rayList3.Count > 0)
{
RaycastHit ray3 = rayList3[0];
inRange = CheckForItem(ray1) || CheckForItem(ray2) || CheckForItem(ray3);
inRange = CheckForItem(ray3);
return;
}
else
{

View File

@ -371,7 +371,7 @@ public class PlayerController : Script
stateMachine.SetState(typeof(PlayerIdleState));
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
if (pat && pat.item.GetScript<Item>())
if (pat && pat.item)
{
holdItem = false;
isAiming = false;

View File

@ -26,6 +26,16 @@ public class GameManager : Script
public GameObject scoreText;
public GameObject timeText;
//mulitpler info
public GameObject multiplierText;
public float maxMultiplierDuration = 5.0f;
public float currMultiplierDuration { get; set; }
public int maxMultiplierCombo = 10;
public bool itemScored {get;set;}
public int currMultiplierCombo { get; set;}
public float multiplierFont = 60.0f;
private Vector3 fontScalar;
public static GameManager Instance { get; private set; }
protected override void awake()
@ -40,12 +50,15 @@ public class GameManager : Script
totalItemCount = 0;
Score = 0;
currGameState = GameState.START;
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
}
protected override void update()
{
Cheats();
if (currGameState == GameState.START)
{
timer -= Time.DeltaTimeF;
@ -54,6 +67,25 @@ public class GameManager : Script
if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
if (itemScored)
{
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
currMultiplierDuration += Time.DeltaTimeF;
if (currMultiplierDuration >= maxMultiplierDuration)
{
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
}
}
else
{
multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
}
if ((timer > 0 && totalItemCount < 0) || Input.GetKeyDown(Input.KeyCode.F1))
{
currGameState = GameState.WIN;
@ -86,4 +118,14 @@ public class GameManager : Script
}
}
public void ItemScored()
{
totalItemCount -= 1;
itemScored = true;
currMultiplierDuration = 0;
multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1;
}
}

View File

@ -12,8 +12,8 @@ public class ScoringZone : Script
if (GameManager.Instance && info.GameObject.GetScript<Item>())
{
Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored");
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score;
GameManager.Instance.totalItemCount -= 1;
GameManager.Instance.ItemScored();
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
info.GameObject.SetActive(false);
}
}

View File

@ -3,6 +3,7 @@ using SHADE;
public class MainMenu : Script
{
public uint sceneID;
protected override void awake()
{
Audio.PlayBGMOnce2D("event:/Music/main_menu");
@ -17,7 +18,7 @@ public class MainMenu : Script
if (Input.GetKeyUp(Input.KeyCode.Space))
{
Audio.PlaySFXOnce2D("event:/UI/success");
SceneManager.ChangeScene(86098106);
SceneManager.ChangeScene(sceneID);
Audio.StopAllSounds();
}

View File

@ -60,7 +60,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f)
{
return 0.0f;
return 0.7f;
}
else
return 1.0f;

View File

@ -0,0 +1,10 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
void main()
{
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: ShadowMap_FS
ID: 45925790
Type: 2

View File

@ -74,12 +74,15 @@ namespace Sandbox
#endif
window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow, wndData);
SHAssetManager::Load();
// Create Systems
SHSystemManager::CreateSystem<SHScriptEngine>();
SHSystemManager::CreateSystem<SHTransformSystem>();
SHSystemManager::CreateSystem<SHPhysicsSystem>();
#ifndef _PUBLISH
#ifdef SHEDITOR
SHSystemManager::CreateSystem<SHPhysicsDebugDrawSystem>();
#endif
@ -122,7 +125,7 @@ namespace Sandbox
SHSystemManager::RegisterRoutine<SHPhysicsSystem, SHPhysicsSystem::PhysicsUpdate>();
SHSystemManager::RegisterRoutine<SHPhysicsSystem, SHPhysicsSystem::PhysicsPostUpdate>();
#ifndef _PUBLISH
#ifdef SHEDITOR
SHSystemManager::RegisterRoutine<SHPhysicsDebugDrawSystem, SHPhysicsDebugDrawSystem::PhysicsDebugDraw>();
#endif
@ -155,7 +158,6 @@ namespace Sandbox
SHComponentManager::CreateComponentSparseSet<SHAnimatorComponent>();
//SHComponentManager::CreateComponentSparseSet<SHCameraComponent>();
SHAssetManager::Load();
//auto font = SHAssetManager::GetData<SHFontAsset>(176667660);
SHSystemManager::RegisterRoutine<SHAudioSystem, SHAudioSystem::AudioRoutine>();

View File

@ -200,7 +200,9 @@ namespace SHADE
void SHAudioSystem::ErrorCheck() const
{
if (result != FMOD_OK)
std::cerr << "Audio system error: " << FMOD_ErrorString(result) << std::endl;
{
SHLOG_ERROR( "Audio system error: {}", FMOD_ErrorString(result))
}
}
void SHAudioSystem::PlayEventOnce(const char* path, bool isSFX, EntityID eid, bool spatial)
@ -319,6 +321,15 @@ namespace SHADE
if (channel->isPlaying(&isPlaying) == FMOD_OK && isPlaying)
channel->stop();
}
auto [begin, end] = audioClipLibrary.GetDenseAccess();
for (auto it = begin; it != end; ++it)
{
if (it->instance)
{
it->instance->stop(FMOD_STUDIO_STOP_MODE::FMOD_STUDIO_STOP_IMMEDIATE);
it->instance->release();
}
}
masterGroup->stop();
}
@ -349,6 +360,10 @@ namespace SHADE
audioClipHandle = audioClipLibrary.Create();
it->second->createInstance(&audioClipHandle->instance);
}
else
{
SHLOG_ERROR("FMOD: Failed to find event path: {}", path)
}
return audioClipHandle;
}
@ -487,10 +502,12 @@ namespace SHADE
}
void SHAudioSystem::SetBgmVolume(float const bgmvol)
{
bgmVolume = bgmvol;
bgmChannelGroup->setVolume(bgmvol);
}
void SHAudioSystem::SetSfxVolume(float const sfxvol)
{
sfxVolume = sfxvol;
sfxChannelGroup->setVolume(sfxvol);
}
void SHAudioSystem::SetMasterVolume(float const mastervol)
@ -506,15 +523,12 @@ namespace SHADE
{
channel->setPaused(paused);
}
for (auto const& event : eventMap)
auto [begin, end] = audioClipLibrary.GetDenseAccess();
for (auto it = begin; it != end; ++it)
{
int instanceCount = 0;
event.second->getInstanceCount(&instanceCount);
std::vector<FMOD::Studio::EventInstance*> instances(instanceCount);
event.second->getInstanceList(instances.data(), static_cast<int>(instances.size()), &instanceCount);
for (auto const& instance : instances)
if (it->instance)
{
instance->setPaused(pause);
it->SetPause(pause);
}
}
}
@ -546,6 +560,7 @@ namespace SHADE
bank->loadSampleData();
int numOfEvents;
bank->getEventCount(&numOfEvents);
if (numOfEvents > 0)
{
std::vector<FMOD::Studio::EventDescription*> events(numOfEvents);
@ -560,11 +575,71 @@ namespace SHADE
}
}
float SHAudioSystem::GetVCAVolume(const char* path)
{
FMOD::Studio::VCA* vca = nullptr;
result = fmodStudioSystem->getVCA(path, &vca);
float volume = 0.0f;
if (result != FMOD_OK)
{
ErrorCheck();
return volume;
}
result = vca->getVolume(&volume);
if (result != FMOD_OK)
{
ErrorCheck();
return volume;
}
return volume;
}
void SHAudioSystem::SetVCAVolume(const char* path, float value)
{
FMOD::Studio::VCA* vca = nullptr;
result = fmodStudioSystem->getVCA(path, &vca);
if (result != FMOD_OK)
{
ErrorCheck();
return;
}
result = vca->setVolume(std::clamp(value, 0.0f, 1.0f));
if (result != FMOD_OK)
{
ErrorCheck();
return;
}
}
float SHAudioSystem::GetParameterValue(const char* path)
{
float value = {};
result = fmodStudioSystem->getParameterByName(path, &value);
if(result != FMOD_OK)
{
ErrorCheck();
}
return value;
}
void SHAudioSystem::SetParameter(const char* path, float value)
{
result = fmodStudioSystem->setParameterByName(path, value);
if (result != FMOD_OK)
{
ErrorCheck();
}
}
void AudioClip::Play()
{
if(!instance)
return;
instance->start();
FMOD_RESULT result = instance->start();
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
}
//void AudioClip::Play(bool isSfx)
@ -598,7 +673,11 @@ namespace SHADE
{
if (!instance)
return;
instance->stop(fadeOut ? FMOD_STUDIO_STOP_ALLOWFADEOUT : FMOD_STUDIO_STOP_IMMEDIATE);
FMOD_RESULT result = instance->stop(fadeOut ? FMOD_STUDIO_STOP_ALLOWFADEOUT : FMOD_STUDIO_STOP_IMMEDIATE);
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
}
void AudioClip::SetPause(bool pause)
@ -623,7 +702,11 @@ namespace SHADE
{
if (!instance)
return;
instance->setParameterByName(paramName, value);
FMOD_RESULT result = instance->setParameterByName(paramName, value);
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
}
//void AudioClip::SetParameterLabel(const char* paramName, const char* label)
@ -635,11 +718,31 @@ namespace SHADE
float AudioClip::GetParameterValue(const char* paramName)
{
if (!instance)
return {};
float value{};
instance->getParameterByName(paramName, &value);
if (!instance)
return value;
auto result = instance->getParameterByName(paramName, &value);
if (result != FMOD_OK)
{
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
}
return value;
}
float AudioClip::GetVolume()
{
float volume{};
if(!instance)
return volume;
instance->getVolume(&volume);
return volume;
}
void AudioClip::SetVolume(float volume)
{
if(!instance)
return;
instance->setVolume(volume);
}
SHEventHandle SHAudioSystem::onStop(SHEventPtr onStopEvent)

View File

@ -35,6 +35,8 @@ namespace SHADE
void SetParameter(const char* paramName, float value);
//void SetParameterLabel(const char* paramName, const char* label);
float GetParameterValue(const char* paramName);
float GetVolume();
void SetVolume(float volume);
friend class SHAudioSystem;
private:
FMOD::Studio::EventInstance* instance = nullptr;
@ -85,7 +87,13 @@ namespace SHADE
void SetPaused(bool pause);
bool GetPaused() const;
SHVec3 GetListenerPosition();
void LoadBank(const char* path);
float GetVCAVolume(const char* path);
void SetVCAVolume(const char* path, float value);
float GetParameterValue(const char* path);
void SetParameter(const char* path, float value);
private:
FMOD::Studio::System* fmodStudioSystem;

View File

@ -94,7 +94,7 @@ namespace SHADE
if (systemContainer.find(id) == systemContainer.end())
{
std::cout << "System Manager error: System Version " << version << " does not exit." << std::endl;
std::cout << "System Manager error: System Version " << typeid(T).name() << ", " << version << " does not exist." << std::endl;
return nullptr;
}

View File

@ -11,6 +11,7 @@ namespace SHADE
{
if (Begin())
{
DrawMenuBar();
ImGui::BeginTable("CollisionMtxTable", SHCollisionTag::NUM_LAYERS + 1, ImGuiTableRowFlags_Headers);
ImGui::TableNextRow();
ImGui::PushID("CollisionTagNames");
@ -56,7 +57,10 @@ namespace SHADE
if(i == idx)
continue;
std::string label = std::format("##{} vs {}", tagName, tagName2);
SHEditorWidgets::CheckBox(label, [tag, &idx]{return tag->GetLayerState(idx);}, [tag, i, idx](bool const& value){tag->SetLayerState(idx, value); SHCollisionTagMatrix::GetTag(idx)->SetLayerState(i, value);}, label.substr(2));
if (SHEditorWidgets::CheckBox(label, [tag, &idx] {return tag->GetLayerState(idx); }, [tag, i, idx](bool const& value) {tag->SetLayerState(idx, value); SHCollisionTagMatrix::GetTag(idx)->SetLayerState(i, value); }, label.substr(2)))
{
isDirty = true;
}
}
}
ImGui::EndTable();
@ -64,4 +68,21 @@ namespace SHADE
ImGui::End();
}
void SHColliderTagPanel::DrawMenuBar()
{
if (ImGui::BeginMenuBar())
{
ImGui::BeginDisabled(!isDirty);
if (ImGui::Button("Save"))
{
std::filesystem::path defaultCollisionTagNameFilePath{ ASSET_ROOT };
defaultCollisionTagNameFilePath.append("CollisionTags.SHConfig");
SHCollisionTagMatrix::Exit(defaultCollisionTagNameFilePath);
isDirty = false;
}
ImGui::EndDisabled();
ImGui::EndMenuBar();
}
}
}

View File

@ -14,6 +14,7 @@ namespace SHADE
//void Exit();
private:
void DrawMenuBar();
bool isDirty;
};
}

View File

@ -128,6 +128,7 @@ namespace SHADE
SHFreetypeInstance::Init();
//SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false);
@ -137,6 +138,7 @@ namespace SHADE
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
// Load Built In Shaders
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_ANIM);
@ -152,6 +154,7 @@ namespace SHADE
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 SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
}
@ -583,14 +586,21 @@ namespace SHADE
#endif
}
//if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::B))
static bool shadowAdded = false;
if (shadowAdded == false/* && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B)*/)
{
shadowAdded = true;
auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
if (lightComps.size() > 2)
{
lightComps[2].SetEnableShadow(true);
}
//for (auto& comp : lightComps)
//{
// auto& lightComps = SHComponentManager::GetDense<SHLightComponent>();
// for (auto& comp : lightComps)
// {
// comp.SetEnableShadow(true);
// }
//}
}
renderGraph->Begin(frameIndex);
auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex);
@ -809,11 +819,11 @@ namespace SHADE
tempLibrary.Init(device);
tempLibrary.CreateGraphicsPipelines
(
{ shadowMapVS, {} }, shadowMapNode->GetRenderpass(), newSubpass,
{ shadowMapVS, shadowMapFS }, shadowMapNode->GetRenderpass(), newSubpass,
SHGraphicsPredefinedData::SystemType::BATCHING,
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
);
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, {} });
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS });
}
newSubpass->SetCompanionSubpass(companionSubpass, shadowMapPipeline); // set companion subpass and pipeline

View File

@ -469,6 +469,7 @@ namespace SHADE
Handle<SHVkShaderModule> renderToSwapchainVS;
Handle<SHVkShaderModule> renderToSwapchainFS;
Handle<SHVkShaderModule> shadowMapVS;
Handle<SHVkShaderModule> shadowMapFS;
// Fonts
Handle<SHFont> testFont;

View File

@ -94,8 +94,8 @@ namespace SHADE
{
const bool CLEAR_EVENT = C_INFO.GetCollisionState() == SHCollisionInfo::State::EXIT || C_INFO.GetCollisionState() == SHCollisionInfo::State::INVALID;
const bool INACTIVE_OBJECT = !SHSceneManager::CheckNodeAndComponentsActive<SHColliderComponent>(C_INFO.GetEntityA())
|| !SHSceneManager::CheckNodeAndComponentsActive<SHColliderComponent>(C_INFO.GetEntityB());
const bool INACTIVE_OBJECT = !SHSceneManager::CheckNodeAndHasComponentsActive<SHColliderComponent>(C_INFO.GetEntityA())
|| !SHSceneManager::CheckNodeAndHasComponentsActive<SHColliderComponent>(C_INFO.GetEntityB());
if (CLEAR_EVENT || INACTIVE_OBJECT)
{

View File

@ -170,10 +170,7 @@ namespace SHADE
SHCollisionListener collisionListener;
SHRaycaster raycaster;
// For the debug drawer to draw rays
#ifdef SHEDITOR
std::vector<RaycastHit> raycastHits;
#endif
/*---------------------------------------------------------------------------------*/
/* Function Members */

View File

@ -62,9 +62,9 @@ namespace SHADE
loadFunctions();
// Generate script assembly if it hasn't been before
#ifndef _PUBLISH
#ifndef _PUBLISH
BuildScriptAssembly();
#endif
#endif
// Initialise the CSharp Engine
csEngineInit();

View File

@ -99,6 +99,31 @@ namespace SHADE
audioSys->StopAllSounds();
}
float Audio::GetVCAVolume(System::String^ path)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
return audioSys->GetVCAVolume(Convert::ToNative(path).data());
}
void Audio::SetVCAVolume(System::String^ path, float volume)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
audioSys->SetVCAVolume(Convert::ToNative(path).data(), volume);
}
float Audio::GetParameterValue(System::String^ path)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
return audioSys->GetParameterValue(Convert::ToNative(path).data());
}
void Audio::SetParameter(System::String^ path, float value)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();
audioSys->SetParameter(Convert::ToNative(path).data(), value);
}
AudioClipHandler Audio::CreateAudioClip(System::String^ path)
{
auto audioSys = SHSystemManager::GetSystem<SHAudioSystem>();

View File

@ -101,6 +101,10 @@ namespace SHADE
/// </summary>
static void StopAllSounds();
static float GetVCAVolume(System::String^ path);
static void SetVCAVolume(System::String^ path, float volume);
static float GetParameterValue(System::String^ path);
static void SetParameter(System::String^ path, float value);
//to comment ltr
static AudioClipHandler CreateAudioClip(System::String^ path);

View File

@ -84,6 +84,14 @@ namespace SHADE
return NativeObject->GetParameterValue(Convert::ToNative(paramName).data());
}
float AudioClipHandler::GetVolume()
{
return NativeObject->GetVolume();
}
void AudioClipHandler::SetVolume(float volume)
{
NativeObject->SetVolume(volume);
}
}

View File

@ -72,6 +72,8 @@ namespace SHADE
bool IsPaused();
void SetParameter(System::String^ paramName, float value);
float GetParameterValue(System::String^ paramName);
float GetVolume();
void SetVolume(float volume);
protected:
/*-----------------------------------------------------------------------------*/

View File

@ -28,25 +28,32 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/
bool Application::IsPlaying::get()
{
#ifdef SHEDITOR
auto editor = SHSystemManager::GetSystem<SHEditor>();
if (editor)
return editor->editorState == SHEditor::State::PLAY
||
editor->editorState == SHEditor::State::PAUSE;
#endif
return true;
}
bool Application::IsPaused::get()
{
#ifdef SHEDITOR
auto editor = SHSystemManager::GetSystem<SHEditor>();
if (editor)
return editor->editorState == SHEditor::State::PAUSE;
#endif
return false;
}
bool Application::IsEditor::get()
{
#ifdef SHEDITOR
return SHSystemManager::GetSystem<SHEditor>() != nullptr;
#else
return false;
#endif
}
int Application::WindowWidth::get()
{