Merge branch 'main' into PlayerController
This commit is contained in:
commit
04c19fb586
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Dangrek-Regular
|
||||||
|
ID: 174412429
|
||||||
|
Type: 10
|
Binary file not shown.
|
@ -477,7 +477,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Options
|
Text: Options
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -497,7 +497,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Audio
|
Text: Audio
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -533,7 +533,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Master
|
Text: Master
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -553,7 +553,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: SFX
|
Text: SFX
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -573,7 +573,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: BGM
|
Text: BGM
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -612,7 +612,7 @@
|
||||||
Material: 128676209
|
Material: 128676209
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Slider Component:
|
Slider Component:
|
||||||
Slider Value: 0
|
Slider Value: 1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -635,7 +635,7 @@
|
||||||
Material: 128676209
|
Material: 128676209
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Slider Component:
|
Slider Component:
|
||||||
Slider Value: 0
|
Slider Value: 1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -658,7 +658,7 @@
|
||||||
Material: 128676209
|
Material: 128676209
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Slider Component:
|
Slider Component:
|
||||||
Slider Value: 0
|
Slider Value: 1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -678,7 +678,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Camera
|
Text: Camera
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -714,7 +714,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: FOV
|
Text: FOV
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -734,7 +734,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Sensitivity
|
Text: Sensitivity
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -773,7 +773,7 @@
|
||||||
Material: 128676209
|
Material: 128676209
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Slider Component:
|
Slider Component:
|
||||||
Slider Value: 0
|
Slider Value: 1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -796,7 +796,7 @@
|
||||||
Material: 128676209
|
Material: 128676209
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Slider Component:
|
Slider Component:
|
||||||
Slider Value: 0
|
Slider Value: 1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -832,7 +832,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: 100
|
Text: 100
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -852,7 +852,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: 100
|
Text: 100
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -872,7 +872,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: 100
|
Text: 100
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -908,7 +908,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: 100
|
Text: 100
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -928,7 +928,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: 100
|
Text: 100
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 19
|
Canvas ID: 19
|
||||||
|
@ -1004,7 +1004,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Credits
|
Text: Credits
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 46
|
Canvas ID: 46
|
||||||
|
@ -1080,7 +1080,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Text Renderer Component:
|
Text Renderer Component:
|
||||||
Text: Level Select
|
Text: Level Select
|
||||||
Font: 176667660
|
Font: 174412429
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 50
|
Canvas ID: 50
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class GameManager : Script
|
||||||
if (itemScored)
|
if (itemScored)
|
||||||
{
|
{
|
||||||
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
|
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
|
||||||
multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
|
//multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
|
||||||
currMultiplierDuration += Time.DeltaTimeF;
|
currMultiplierDuration += Time.DeltaTimeF;
|
||||||
|
|
||||||
if (currMultiplierDuration >= maxMultiplierDuration)
|
if (currMultiplierDuration >= maxMultiplierDuration)
|
||||||
|
@ -110,7 +110,7 @@ public class GameManager : Script
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
|
//multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((timer > 0 && totalItemCount <= 0 && !itemShatter) || Input.GetKeyDown(Input.KeyCode.F1))
|
if ((timer > 0 && totalItemCount <= 0 && !itemShatter) || Input.GetKeyDown(Input.KeyCode.F1))
|
||||||
|
|
|
@ -14,7 +14,17 @@ namespace SHADE_Scripting.UI
|
||||||
public int minValue = 0;
|
public int minValue = 0;
|
||||||
public int maxValue = 0;
|
public int maxValue = 0;
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
Slider slider = sliderObj.GetComponent<Slider>();
|
||||||
|
TextRenderable text = GetComponent<TextRenderable>();
|
||||||
|
|
||||||
|
if (slider != null && text != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
Slider slider = sliderObj.GetComponent<Slider>();
|
Slider slider = sliderObj.GetComponent<Slider>();
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <FMOD/fmod.hpp>
|
#include <FMOD/fmod.hpp>
|
||||||
#include <FMOD/fmod_studio.hpp>
|
#include <FMOD/fmod_studio.hpp>
|
||||||
#include <SDL_keyboard.h>
|
#include <SDL_keyboard.h>
|
||||||
|
#include "Camera/SHCameraSystem.h"
|
||||||
|
|
||||||
const std::string AUDIO_FOLDER_PATH{ std::string(ASSET_ROOT)+ "/Audio/" };
|
const std::string AUDIO_FOLDER_PATH{ std::string(ASSET_ROOT)+ "/Audio/" };
|
||||||
|
|
||||||
|
@ -53,8 +54,9 @@ namespace SHADE
|
||||||
|
|
||||||
denseListener = &SHComponentManager::GetDense<SHAudioListenerComponent>();
|
denseListener = &SHComponentManager::GetDense<SHAudioListenerComponent>();
|
||||||
fmodStudioSystem->getCoreSystem(&fmodSystem);
|
fmodStudioSystem->getCoreSystem(&fmodSystem);
|
||||||
|
fmodSystem->setSoftwareFormat(0, FMOD_SPEAKERMODE_5POINT1, 0);
|
||||||
|
result = fmodStudioSystem->initialize(AUDIO_SYS_MAX_CHANNELS, AUDIO_SYS_MAX_CHANNELS, FMOD_STUDIO_INIT_NORMAL | FMOD_INIT_NORMAL, extraDriverData);
|
||||||
|
|
||||||
result = fmodStudioSystem->initialize(AUDIO_SYS_MAX_CHANNELS, AUDIO_SYS_MAX_CHANNELS, FMOD_STUDIO_INIT_NORMAL, extraDriverData);
|
|
||||||
ErrorCheck();
|
ErrorCheck();
|
||||||
|
|
||||||
fmodSystem->setSoftwareFormat(0, speakerMode, 0);
|
fmodSystem->setSoftwareFormat(0, speakerMode, 0);
|
||||||
|
@ -83,17 +85,10 @@ 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 + "footsteps.bank").data());
|
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Music.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());
|
||||||
|
|
||||||
//auto clip = CreateAudioClip("event:/Characters/sfx_footsteps_human");
|
|
||||||
//clip->Play();
|
|
||||||
//PlayEventOnce("event:/Characters/sfx_footsteps_raccoon");
|
|
||||||
//PlayEventOnce("event:/SFX/Dawn/Dawn_Attack");
|
|
||||||
|
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
|
|
||||||
// Subscribe to Editor State Change Events
|
// Subscribe to Editor State Change Events
|
||||||
|
@ -115,35 +110,65 @@ namespace SHADE
|
||||||
void SHADE::SHAudioSystem::Run(double dt)
|
void SHADE::SHAudioSystem::Run(double dt)
|
||||||
{
|
{
|
||||||
static_cast<void>(dt);
|
static_cast<void>(dt);
|
||||||
//if (GetKeyState(VK_SPACE) & 0x8000)
|
|
||||||
// PlayEventOnce("event:/Characters/sfx_footsteps_raccoon");
|
|
||||||
|
|
||||||
fmodStudioSystem->update();
|
fmodStudioSystem->update();
|
||||||
if (!denseListener->empty())
|
//int listenerID = 0;
|
||||||
|
//for(auto& listener : *denseListener)
|
||||||
|
//{
|
||||||
|
// if(!listener.isActive)
|
||||||
|
// continue;
|
||||||
|
// //SHAudioListenerComponent& listener = denseListener->at(0); //Loop through dense
|
||||||
|
// SHTransformComponent* listenerTransform = SHComponentManager::GetComponent_s<SHTransformComponent>(listener.GetEID());
|
||||||
|
// if (listenerTransform)
|
||||||
|
// {
|
||||||
|
// listener.SetPos(listenerTransform->GetWorldPosition());
|
||||||
|
// SHQuaternion worldOrientation = listenerTransform->GetWorldOrientation();
|
||||||
|
// SHVec3 orientatedFoward = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Forward) * SHQuaternion::Conjugate(worldOrientation)).ToEuler();
|
||||||
|
// SHVec3 orientatedUp = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Up) * SHQuaternion::Conjugate(worldOrientation)).ToEuler();
|
||||||
|
// listener.SetForward(orientatedFoward);
|
||||||
|
// listener.SetUp(orientatedUp);
|
||||||
|
|
||||||
|
// FMOD_3D_ATTRIBUTES attribs{ { 0 } };
|
||||||
|
// attribs.position = { listener.pos.x, listener.pos.y, listener.pos.z };
|
||||||
|
// attribs.forward = { orientatedFoward.x, orientatedFoward.y, orientatedFoward.z };
|
||||||
|
// attribs.up = { orientatedUp.x, orientatedUp.y, orientatedUp.z };
|
||||||
|
//
|
||||||
|
// fmodStudioSystem->setListenerAttributes(listenerID++, &attribs);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(auto camSystem = SHSystemManager::GetSystem<SHCameraSystem>())
|
||||||
{
|
{
|
||||||
SHAudioListenerComponent& listener = denseListener->at(0);
|
auto mainCamEID = camSystem->GetMainCameraEID();
|
||||||
SHTransformComponent* listenerTransform = SHComponentManager::GetComponent_s<SHTransformComponent>(listener.GetEID());
|
if(auto camComponent = SHComponentManager::GetComponent_s<SHCameraComponent>(mainCamEID))
|
||||||
if (listenerTransform)
|
|
||||||
{
|
{
|
||||||
listener.SetPos(listenerTransform->GetWorldPosition()); // TODO: Clean up listener
|
FMOD_3D_ATTRIBUTES attribs{ { 0 } };
|
||||||
listener.SetForward({ (listenerTransform->GetLocalScale()[0] > 0.f) ? 1.f : -1.f, 0.f, 0.f }); //TODO: USE CORRECT FORWARD
|
SHVec3 pos = camComponent->GetPosition();
|
||||||
FMOD_VECTOR pos = { listener.pos[0] ,listener.pos[1] ,0.f };
|
SHVec3 forward, up, right;
|
||||||
FMOD_VECTOR forward = { listener.forward[0] ,listener.forward[1] ,listener.forward[2] };
|
camSystem->GetCameraAxis(*camComponent, forward, right, up);
|
||||||
FMOD_VECTOR up = { listener.up[0] ,listener.up[1] ,listener.up[2] };
|
attribs.position = { pos.x, pos.y, pos.z };
|
||||||
fmodSystem->set3DListenerAttributes(0, &pos, nullptr, &forward, &up);
|
attribs.forward = { forward.x, forward.y, forward.z };
|
||||||
|
attribs.up = { up.x, up.y, up.z };
|
||||||
|
fmodStudioSystem->setListenerAttributes(0, &attribs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto [begin, end] = audioClipLibrary.GetDenseAccess();
|
auto [begin, end] = audioClipLibrary.GetDenseAccess();
|
||||||
for(auto it = begin; it != end; ++it)
|
for (auto& it = begin; it != end; ++it)
|
||||||
{
|
{
|
||||||
if(it->instance && (it->transformRef != MAX_EID))
|
if(it->instance && (it->transformRef != MAX_EID))
|
||||||
{
|
{
|
||||||
if(SHTransformComponent* transformComponent = SHComponentManager::GetComponent_s<SHTransformComponent>(it->transformRef))
|
if(SHTransformComponent* transformComponent = SHComponentManager::GetComponent_s<SHTransformComponent>(it->transformRef))
|
||||||
{
|
{
|
||||||
FMOD_3D_ATTRIBUTES attribs{}; //TODO: Set other attribs
|
FMOD_3D_ATTRIBUTES attribs{ { 0 } };
|
||||||
auto pos = transformComponent->GetWorldPosition();
|
auto pos = transformComponent->GetWorldPosition();
|
||||||
|
SHQuaternion worldOrientation = transformComponent->GetWorldOrientation();
|
||||||
|
SHVec3 orientatedFoward = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Forward) * SHQuaternion::Conjugate(worldOrientation)).ToEuler();
|
||||||
|
SHVec3 orientatedUp = (worldOrientation * SHQuaternion::FromEuler(SHVec3::Up) * SHQuaternion::Conjugate(worldOrientation)).ToEuler();
|
||||||
|
|
||||||
attribs.position = {pos.x, pos.y, pos.z};
|
attribs.position = {pos.x, pos.y, pos.z};
|
||||||
|
attribs.forward = {orientatedFoward.x, orientatedFoward.y, orientatedFoward.z};
|
||||||
|
attribs.up = {orientatedUp.x, orientatedUp.y, orientatedUp.z};
|
||||||
it->instance->set3DAttributes(&attribs);
|
it->instance->set3DAttributes(&attribs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,3 +13,4 @@
|
||||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||||
#include "Physics/Interface/SHColliderComponent.h"
|
#include "Physics/Interface/SHColliderComponent.h"
|
||||||
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
|
#include "Graphics/MiddleEnd/TextRendering/SHTextRenderableComponent.h"
|
||||||
|
#include "AudioSystem/SHAudioListenerComponent.h"
|
|
@ -267,7 +267,7 @@ namespace SHADE
|
||||||
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImRect SHAssetBrowser::DrawAsset(SHAsset const* const asset, FileExt const& ext /*= ""*/) noexcept
|
ImRect SHAssetBrowser::DrawAsset(SHAsset const* const asset, FileExt const& ext /*= ""*/, bool isSubAsset /*= false*/) noexcept
|
||||||
{
|
{
|
||||||
if (asset == nullptr)
|
if (asset == nullptr)
|
||||||
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
||||||
|
@ -280,10 +280,20 @@ namespace SHADE
|
||||||
bool highlighted = false;
|
bool highlighted = false;
|
||||||
if(!filter.empty())
|
if(!filter.empty())
|
||||||
{
|
{
|
||||||
ImGui::SetNextItemOpen(true);
|
//ImGui::SetNextItemOpen(true);
|
||||||
if(SHStringUtilities::StringFindInsensitive(asset->name.data(), filter) == std::string::npos)
|
if(SHStringUtilities::StringFindInsensitive(asset->name.data(), filter) == std::string::npos)
|
||||||
{
|
{
|
||||||
|
bool subAssetFiltered = false;
|
||||||
|
for (auto const& subAsset : asset->subAssets)
|
||||||
|
{
|
||||||
|
subAssetFiltered |= (SHStringUtilities::StringFindInsensitive(subAsset->name.data(), filter) != std::string::npos);
|
||||||
|
}
|
||||||
|
if(!subAssetFiltered)
|
||||||
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
return ImRect(ImGui::GetItemRectMin(), ImGui::GetItemRectMax());
|
||||||
|
else if(!asset->subAssets.empty())
|
||||||
|
{
|
||||||
|
ImGui::SetNextItemOpen(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -363,7 +373,12 @@ namespace SHADE
|
||||||
case AssetType::TEXTURE: break;
|
case AssetType::TEXTURE: break;
|
||||||
case AssetType::MESH: break;
|
case AssetType::MESH: break;
|
||||||
case AssetType::SCENE:
|
case AssetType::SCENE:
|
||||||
editor->LoadScene(asset->id);
|
{
|
||||||
|
if(editor->LoadScene(asset->id))
|
||||||
|
{
|
||||||
|
editor->editorConfig->workingSceneID = asset->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AssetType::PREFAB: break;
|
case AssetType::PREFAB: break;
|
||||||
case AssetType::MATERIAL:
|
case AssetType::MATERIAL:
|
||||||
|
@ -431,7 +446,7 @@ namespace SHADE
|
||||||
for(auto const& subAsset : asset->subAssets)
|
for(auto const& subAsset : asset->subAssets)
|
||||||
{
|
{
|
||||||
const float horizontalLineSize = 25.0f;
|
const float horizontalLineSize = 25.0f;
|
||||||
const ImRect childRect = DrawAsset(subAsset);
|
const ImRect childRect = DrawAsset(subAsset, "", true);
|
||||||
const float midPoint = (childRect.Min.y + childRect.Max.y) * 0.5f;
|
const float midPoint = (childRect.Min.y + childRect.Max.y) * 0.5f;
|
||||||
drawList->AddLine(ImVec2(vertLineStart.x, midPoint), ImVec2(vertLineStart.x + horizontalLineSize, midPoint), treeLineColor, 1);
|
drawList->AddLine(ImVec2(vertLineStart.x, midPoint), ImVec2(vertLineStart.x + horizontalLineSize, midPoint), treeLineColor, 1);
|
||||||
vertLineEnd.y = midPoint;
|
vertLineEnd.y = midPoint;
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace SHADE
|
||||||
ImRect RecursivelyDrawTree(FolderPointer folder);
|
ImRect RecursivelyDrawTree(FolderPointer folder);
|
||||||
void DrawCurrentFolder();
|
void DrawCurrentFolder();
|
||||||
ImRect DrawFile(SHFile& file) noexcept;
|
ImRect DrawFile(SHFile& file) noexcept;
|
||||||
ImRect DrawAsset(SHAsset const* const asset, FileExt const& ext = "") noexcept;
|
ImRect DrawAsset(SHAsset const* const asset, FileExt const& ext = "", bool isSubAsset = false) noexcept;
|
||||||
void DrawAssetBeingCreated() noexcept;
|
void DrawAssetBeingCreated() noexcept;
|
||||||
void DrawAssetBrowserFilter();
|
void DrawAssetBrowserFilter();
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "Serialization/Prefab/SHPrefabManager.h"
|
#include "Serialization/Prefab/SHPrefabManager.h"
|
||||||
#include "../SHEditorWindowManager.h"
|
#include "../SHEditorWindowManager.h"
|
||||||
#include "../AssetBrowser/SHAssetBrowser.h"
|
#include "../AssetBrowser/SHAssetBrowser.h"
|
||||||
|
#include "Assets/SHAssetManager.h"
|
||||||
|
#include "Assets/Asset Types/SHPrefabAsset.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -99,7 +101,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal);
|
ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal);
|
||||||
|
|
||||||
if (!ImGui::IsAnyItemFocused())
|
if (!ImGui::IsAnyItemActive())
|
||||||
{
|
{
|
||||||
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_A))
|
if (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_A))
|
||||||
{
|
{
|
||||||
|
@ -136,6 +138,23 @@ namespace SHADE
|
||||||
draggingEntities.clear();
|
draggingEntities.clear();
|
||||||
ImGui::ClearDragDrop();
|
ImGui::ClearDragDrop();
|
||||||
}
|
}
|
||||||
|
//else if(SHDragDrop::currentDragDropTag == SHDragDrop::DRAG_RESOURCE)
|
||||||
|
//{
|
||||||
|
// if (const AssetID* assetPayload = SHDragDrop::AcceptPayload<AssetID>(SHDragDrop::DRAG_RESOURCE)) //If payload is valid
|
||||||
|
// {
|
||||||
|
// auto assetId = *assetPayload;
|
||||||
|
// auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData<SHPrefabAsset>(assetId)->data);
|
||||||
|
// if (!createdEntitiesList.empty())
|
||||||
|
// {
|
||||||
|
// std::vector<EntityID> eidList;
|
||||||
|
// std::ranges::transform(createdEntitiesList, std::back_inserter(eidList), [](std::pair<EntityID, EntityID> pair) {return pair.second; });
|
||||||
|
// ParentSelectedEntities(eid, eidList);
|
||||||
|
// SetScrollTo(createdEntitiesList.begin()->second);
|
||||||
|
// SHPrefabManager::AddEntity(assetId, createdEntitiesList.begin()->second);
|
||||||
|
// skipFrame = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
@ -359,6 +378,20 @@ namespace SHADE
|
||||||
draggingEntities.clear();
|
draggingEntities.clear();
|
||||||
//ImGui::ClearDragDrop();
|
//ImGui::ClearDragDrop();
|
||||||
}
|
}
|
||||||
|
if (const AssetID* assetPayload = SHDragDrop::AcceptPayload<AssetID>(SHDragDrop::DRAG_RESOURCE)) //If payload is valid
|
||||||
|
{
|
||||||
|
auto assetId = *assetPayload;
|
||||||
|
auto createdEntitiesList = SHSerialization::DeserializeEntitiesFromString(SHAssetManager::GetData<SHPrefabAsset>(assetId)->data);
|
||||||
|
if(!createdEntitiesList.empty())
|
||||||
|
{
|
||||||
|
std::vector<EntityID> eidList;
|
||||||
|
std::ranges::transform(createdEntitiesList, std::back_inserter(eidList), [](std::pair<EntityID, EntityID> pair){return pair.second;} );
|
||||||
|
ParentSelectedEntities(eid, eidList);
|
||||||
|
SetScrollTo(createdEntitiesList.begin()->second);
|
||||||
|
SHPrefabManager::AddEntity(assetId, createdEntitiesList.begin()->second);
|
||||||
|
skipFrame = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
SHDragDrop::EndTarget();
|
SHDragDrop::EndTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace SHADE
|
||||||
data.createdEntities.clear();
|
data.createdEntities.clear();
|
||||||
data.createdEntities = SHSerialization::DeserializeEntitiesFromString(data.entityData, data.parentEID);
|
data.createdEntities = SHSerialization::DeserializeEntitiesFromString(data.entityData, data.parentEID);
|
||||||
data.entityData = SHSerialization::ResolveSerializedEntityIndices(data.entityData, data.createdEntities);
|
data.entityData = SHSerialization::ResolveSerializedEntityIndices(data.entityData, data.createdEntities);
|
||||||
|
if(!data.createdEntities.empty())
|
||||||
SHEditorWindowManager::GetEditorWindow<SHHierarchyPanel>()->SetScrollTo(data.createdEntities.begin()->second);
|
SHEditorWindowManager::GetEditorWindow<SHHierarchyPanel>()->SetScrollTo(data.createdEntities.begin()->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -171,10 +171,15 @@ namespace SHADE
|
||||||
if (auto toggleButton = SHComponentManager::GetComponent_s<SHToggleButtonComponent>(eid))
|
if (auto toggleButton = SHComponentManager::GetComponent_s<SHToggleButtonComponent>(eid))
|
||||||
{
|
{
|
||||||
DrawComponent(toggleButton);
|
DrawComponent(toggleButton);
|
||||||
}if (auto slider = SHComponentManager::GetComponent_s<SHSliderComponent>(eid))
|
}
|
||||||
|
if (auto slider = SHComponentManager::GetComponent_s<SHSliderComponent>(eid))
|
||||||
{
|
{
|
||||||
DrawComponent(slider);
|
DrawComponent(slider);
|
||||||
}
|
}
|
||||||
|
if(auto listenerComponent = SHComponentManager::GetComponent_s<SHAudioListenerComponent>(eid))
|
||||||
|
{
|
||||||
|
DrawComponent(listenerComponent);
|
||||||
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
// Render Scripts
|
// Render Scripts
|
||||||
SHScriptEngine* scriptEngine = static_cast<SHScriptEngine*>(SHSystemManager::GetSystem<SHScriptEngine>());
|
SHScriptEngine* scriptEngine = static_cast<SHScriptEngine*>(SHSystemManager::GetSystem<SHScriptEngine>());
|
||||||
|
@ -198,7 +203,7 @@ namespace SHADE
|
||||||
DrawAddComponentWithEnforcedComponentButton<SHColliderComponent, SHTransformComponent>(eid);
|
DrawAddComponentWithEnforcedComponentButton<SHColliderComponent, SHTransformComponent>(eid);
|
||||||
DrawAddComponentWithEnforcedComponentButton<SHTextRenderableComponent, SHTransformComponent>(eid);
|
DrawAddComponentWithEnforcedComponentButton<SHTextRenderableComponent, SHTransformComponent>(eid);
|
||||||
DrawAddComponentWithEnforcedComponentButton<SHAnimatorComponent, SHTransformComponent, SHRenderable>(eid);
|
DrawAddComponentWithEnforcedComponentButton<SHAnimatorComponent, SHTransformComponent, SHRenderable>(eid);
|
||||||
|
DrawAddComponentWithEnforcedComponentButton<SHAudioListenerComponent, SHTransformComponent>(eid);
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -579,19 +579,23 @@ namespace SHADE
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHEditor::LoadScene(AssetID const& assetID) noexcept
|
bool SHEditor::LoadScene(AssetID const& assetID) noexcept
|
||||||
{
|
{
|
||||||
if(shWindow->IsUnsavedChanges())
|
if(shWindow->IsUnsavedChanges())
|
||||||
{
|
{
|
||||||
//Unsaved changes prompt
|
//Unsaved changes prompt
|
||||||
isUnsavedChangesPromptOpen = true;
|
isUnsavedChangesPromptOpen = true;
|
||||||
sceneToLoad = assetID;
|
sceneToLoad = assetID;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Load the scene
|
//Load the scene
|
||||||
sceneToLoad = 0;
|
sceneToLoad = 0;
|
||||||
|
editorConfig->workingSceneID = assetID;
|
||||||
|
SHConfigurationManager::SaveEditorConfig();
|
||||||
SHSceneManager::RestartScene(assetID);
|
SHSceneManager::RestartScene(assetID);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace SHADE
|
||||||
|
|
||||||
bool SaveScene(std::string const& newSceneName = {});
|
bool SaveScene(std::string const& newSceneName = {});
|
||||||
|
|
||||||
void LoadScene(AssetID const& assetID) noexcept;
|
bool LoadScene(AssetID const& assetID) noexcept;
|
||||||
|
|
||||||
void Play();
|
void Play();
|
||||||
void Pause();
|
void Pause();
|
||||||
|
|
|
@ -246,6 +246,7 @@ namespace SHADE
|
||||||
AddComponentToComponentNode<SHTextRenderableComponent>(components, eid);
|
AddComponentToComponentNode<SHTextRenderableComponent>(components, eid);
|
||||||
AddComponentToComponentNode<SHAnimatorComponent>(components, eid);
|
AddComponentToComponentNode<SHAnimatorComponent>(components, eid);
|
||||||
AddComponentToComponentNode<SHUIComponent>(components, eid);
|
AddComponentToComponentNode<SHUIComponent>(components, eid);
|
||||||
|
AddComponentToComponentNode<SHAudioListenerComponent>(components, eid);
|
||||||
|
|
||||||
node[ComponentsNode] = components;
|
node[ComponentsNode] = components;
|
||||||
|
|
||||||
|
@ -306,6 +307,7 @@ namespace SHADE
|
||||||
AddComponentID<SHTextRenderableComponent>(componentIDList, componentsNode);
|
AddComponentID<SHTextRenderableComponent>(componentIDList, componentsNode);
|
||||||
AddComponentID<SHAnimatorComponent>(componentIDList, componentsNode);
|
AddComponentID<SHAnimatorComponent>(componentIDList, componentsNode);
|
||||||
AddComponentID<SHUIComponent>(componentIDList, componentsNode);
|
AddComponentID<SHUIComponent>(componentIDList, componentsNode);
|
||||||
|
AddComponentID<SHAudioListenerComponent>(componentIDList, componentsNode);
|
||||||
|
|
||||||
return componentIDList;
|
return componentIDList;
|
||||||
}
|
}
|
||||||
|
@ -392,5 +394,6 @@ namespace SHADE
|
||||||
SHSerializationHelper::InitializeComponentFromNode<SHLightComponent>(componentsNode, eid);
|
SHSerializationHelper::InitializeComponentFromNode<SHLightComponent>(componentsNode, eid);
|
||||||
SHSerializationHelper::InitializeComponentFromNode<SHAnimatorComponent>(componentsNode, eid);
|
SHSerializationHelper::InitializeComponentFromNode<SHAnimatorComponent>(componentsNode, eid);
|
||||||
SHSerializationHelper::InitializeComponentFromNode<SHUIComponent>(componentsNode, eid);
|
SHSerializationHelper::InitializeComponentFromNode<SHUIComponent>(componentsNode, eid);
|
||||||
|
SHSerializationHelper::InitializeComponentFromNode<SHAudioListenerComponent>(componentsNode, eid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,18 +432,27 @@ namespace SHADE
|
||||||
if (comp.GetValue() < 0.0f)
|
if (comp.GetValue() < 0.0f)
|
||||||
comp.value = 0.0f;
|
comp.value = 0.0f;
|
||||||
}
|
}
|
||||||
|
try
|
||||||
if (comp.GetValue() != tempValue)
|
|
||||||
{
|
{
|
||||||
//Set shader value.
|
|
||||||
|
|
||||||
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
|
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
|
||||||
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
|
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
|
||||||
auto material = renderable->GetModifiableMaterial();
|
auto material = renderable->GetModifiableMaterial();
|
||||||
|
if (renderable)
|
||||||
|
{
|
||||||
|
if (comp.GetValue() != material->GetProperty<float>("data.sliderThreshold"))
|
||||||
|
{
|
||||||
|
//Set shader value.
|
||||||
|
|
||||||
material->SetProperty("data.sliderThreshold", comp.GetValue());
|
material->SetProperty("data.sliderThreshold", comp.GetValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -903,6 +903,12 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
return pair->type;
|
return pair->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sort */
|
||||||
|
System::String^ sortKeyAccessor(System::Type^ type)
|
||||||
|
{
|
||||||
|
return type->Name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptStore::refreshScriptTypeList()
|
void ScriptStore::refreshScriptTypeList()
|
||||||
|
@ -926,6 +932,10 @@ namespace SHADE
|
||||||
Func<Pair^, Type^>^ selector = gcnew Func<Pair^, Type^>(selectorFunc);
|
Func<Pair^, Type^>^ selector = gcnew Func<Pair^, Type^>(selectorFunc);
|
||||||
scriptTypeList = Enumerable::Select(whereResult, selector);
|
scriptTypeList = Enumerable::Select(whereResult, selector);
|
||||||
|
|
||||||
|
/* Sort: By Alphabetical Order */
|
||||||
|
Func<Type^, String^>^ sorter = gcnew Func<Type^, String^>(sortKeyAccessor);
|
||||||
|
scriptTypeList = Enumerable::OrderBy(scriptTypeList, sorter);
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "[ScriptStore] Successfully retrieved references to " << Enumerable::Count(scriptTypeList)
|
oss << "[ScriptStore] Successfully retrieved references to " << Enumerable::Count(scriptTypeList)
|
||||||
|
|
Loading…
Reference in New Issue