Added texture, modifiable material fix

This commit is contained in:
maverickdgg 2023-02-03 20:12:48 +08:00
parent e3d616b4e1
commit a6290d9c8f
66 changed files with 103 additions and 39 deletions

View File

@ -1,4 +1,4 @@
Start Maximized: true Start Maximized: true
Working Scene ID: 97086054 Working Scene ID: 97158628
Window Size: {x: 1920, y: 1013} Window Size: {x: 1920, y: 1013}
Style: 0 Style: 0

View File

@ -1,16 +1,16 @@
[Window][MainStatusBar] [Window][MainStatusBar]
Pos=0,989 Pos=0,981
Size=1920,20 Size=1920,20
Collapsed=0 Collapsed=0
[Window][SHEditorMenuBar] [Window][SHEditorMenuBar]
Pos=0,48 Pos=0,48
Size=1920,941 Size=1920,933
Collapsed=0 Collapsed=0
[Window][Hierarchy Panel] [Window][Hierarchy Panel]
Pos=0,187 Pos=0,186
Size=300,802 Size=300,795
Collapsed=0 Collapsed=0
DockId=0x00000004,0 DockId=0x00000004,0
@ -21,13 +21,13 @@ Collapsed=0
[Window][Inspector] [Window][Inspector]
Pos=1434,48 Pos=1434,48
Size=486,941 Size=486,933
Collapsed=0 Collapsed=0
DockId=0x00000006,0 DockId=0x00000006,0
[Window][Profiler] [Window][Profiler]
Pos=0,48 Pos=0,48
Size=300,137 Size=300,136
Collapsed=0 Collapsed=0
DockId=0x00000003,0 DockId=0x00000003,0
@ -76,7 +76,7 @@ DockId=0x0000000B,0
[Window][ Viewport] [Window][ Viewport]
Pos=302,48 Pos=302,48
Size=1130,705 Size=1130,697
Collapsed=0 Collapsed=0
DockId=0x0000000B,0 DockId=0x0000000B,0
@ -93,14 +93,14 @@ Collapsed=0
DockId=0x0000000A,0 DockId=0x0000000A,0
[Window][ Asset Browser] [Window][ Asset Browser]
Pos=302,755 Pos=302,747
Size=1130,234 Size=1130,234
Collapsed=0 Collapsed=0
DockId=0x0000000C,0 DockId=0x0000000C,0
[Window][Material Inspector] [Window][Material Inspector]
Pos=1434,48 Pos=1434,48
Size=486,941 Size=486,933
Collapsed=0 Collapsed=0
DockId=0x00000006,1 DockId=0x00000006,1
@ -116,13 +116,13 @@ Collapsed=0
[Window][Collider Tag Panel] [Window][Collider Tag Panel]
Pos=302,48 Pos=302,48
Size=1130,705 Size=1130,697
Collapsed=0 Collapsed=0
DockId=0x0000000B,1 DockId=0x0000000B,1
[Window][Input Bindings Panel] [Window][Input Bindings Panel]
Pos=1434,48 Pos=1434,48
Size=486,941 Size=486,933
Collapsed=0 Collapsed=0
DockId=0x00000006,2 DockId=0x00000006,2
@ -151,7 +151,7 @@ Column 15 Weight=1.2009
Column 16 Weight=1.0132 Column 16 Weight=1.0132
[Docking][Data] [Docking][Data]
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split=X DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,77 Size=1920,933 Split=X
DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1432,1036 Split=X DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1432,1036 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881 DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,147 Selected=0x1E6EB881 DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,147 Selected=0x1E6EB881

View File

@ -1,8 +1,8 @@
- VertexShader: 46580970 - VertexShader: 46580970
FragmentShader: 35983630 FragmentShader: 35983630
SubPass: G-Buffer Write SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54429632 data.textureIndex: 51995224
data.alpha: 0 data.alpha: 0
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: howToPlay_default
ID: 65084899
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: howToPlay_hover
ID: 58647112
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: howToPlay_pressed
ID: 55758383
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: mainMenu_default
ID: 65788519
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: mainMenu_hover
ID: 55999018
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: mainMenu_pressed
ID: 66382894
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: quit_default
ID: 66477839
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: quit_hover
ID: 65045286
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: quit_pressed
ID: 58607560
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: retry_default
ID: 55782622
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: retry_hover
ID: 58972174
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: retry_pressed
ID: 55224464
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: settings_default
ID: 58593104
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: settings_hover
ID: 64495732
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: settings_pressed
ID: 63138015
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: startGame_default
ID: 52901020
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: startGame_hover
ID: 62235279
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: startGame_pressed
ID: 64722619
Type: 3

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -199,7 +199,7 @@ namespace SHADE
// Check material usage // Check material usage
for (const auto& rendId : sb.Renderables) for (const auto& rendId : sb.Renderables)
{ {
auto rend = SHComponentManager::GetComponent<SHRenderable>(rendId); auto rend = SHComponentManager::GetComponent_s<SHRenderable>(rendId);
if (rend) if (rend)
{ {
if (rend->GetMaterial() == matToCheck) if (rend->GetMaterial() == matToCheck)
@ -328,7 +328,7 @@ namespace SHADE
for (auto rendId : subBatch.Renderables) for (auto rendId : subBatch.Renderables)
{ {
// Transform // Transform
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(rendId); auto transform = SHComponentManager::GetComponent_s<SHTransformComponent>(rendId);
if (transform) if (transform)
{ {
if (SHSceneManager::CheckNodeAndComponentsActive<SHRenderable>(rendId)) if (SHSceneManager::CheckNodeAndComponentsActive<SHRenderable>(rendId))
@ -382,13 +382,16 @@ namespace SHADE
for (auto& subBatch : subBatches) for (auto& subBatch : subBatches)
for (auto rendId : subBatch.Renderables) for (auto rendId : subBatch.Renderables)
{ {
auto* renderable = SHComponentManager::GetComponent<SHRenderable>(rendId); auto* renderable = SHComponentManager::GetComponent_s<SHRenderable>(rendId);
if (renderable)
{
instancedIntegerData.emplace_back(SHInstancedIntegerData instancedIntegerData.emplace_back(SHInstancedIntegerData
{ {
rendId, rendId,
renderable->GetLightLayer() renderable->GetLightLayer()
}); });
} }
}
// Transfer to GPU // Transfer to GPU
if (instancedIntegerBuffer[frameIndex] && !drawData.empty()) if (instancedIntegerBuffer[frameIndex] && !drawData.empty())
@ -579,13 +582,17 @@ namespace SHADE
transformData.emplace_back(); transformData.emplace_back();
} }
const SHRenderable* renderable = SHComponentManager::GetComponent<SHRenderable>(rendId); const SHRenderable* renderable = SHComponentManager::GetComponent_s<SHRenderable>(rendId);
if (renderable)
{
instancedIntegerData.emplace_back(SHInstancedIntegerData instancedIntegerData.emplace_back(SHInstancedIntegerData
{ {
rendId, rendId,
renderable->GetLightLayer() renderable->GetLightLayer()
} }
); );
}
// Material Properties // Material Properties
if (!EMPTY_MAT_PROPS) if (!EMPTY_MAT_PROPS)

View File

@ -1,6 +1,7 @@
#include "SHpch.h" #include "SHpch.h"
#include "SHButtonComponent.h" #include "SHButtonComponent.h"
#include "Resource/SHResourceManager.h"
#include "Graphics/MiddleEnd/Textures/SHTextureLibrary.h"
namespace SHADE namespace SHADE
{ {

View File

@ -238,16 +238,18 @@ namespace SHADE
auto material = renderable->GetModifiableMaterial(); auto material = renderable->GetModifiableMaterial();
if (!comp.isHovered && !comp.isClicked) if (!comp.isHovered && !comp.isClicked)
{
if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetDefaultTexture()); material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetDefaultTexture()));
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
} }
}
else if (comp.isClicked) else if (comp.isClicked)
{ {
if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE) if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetClickedTexture()); material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetClickedTexture()));
//SHLOG_INFO("SETTING CLICKED TEXTURE") //SHLOG_INFO("SETTING CLICKED TEXTURE")
} }
} }
@ -255,7 +257,7 @@ namespace SHADE
{ {
if (comp.GetHoveredTexture() != 0 && SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE) if (comp.GetHoveredTexture() != 0 && SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetHoveredTexture()); material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>( comp.GetHoveredTexture()));
//SHLOG_INFO("SETTING HOVERED TEXTURE") //SHLOG_INFO("SETTING HOVERED TEXTURE")
} }
} }
@ -361,7 +363,7 @@ namespace SHADE
{ {
if (comp.GetDefaultTexture()!= 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture()!= 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetDefaultTexture()); material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetDefaultTexture()));
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
} }
} }
@ -369,7 +371,7 @@ namespace SHADE
{ {
if (comp.GetToggledTexture() != 0 && SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE) if (comp.GetToggledTexture() != 0 && SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetToggledTexture()); material->SetProperty("data.textureIndex", SHResourceManager::LoadOrGet<SHTexture>(comp.GetToggledTexture()));
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
} }
} }