diff --git a/Assets/Scenes/UI Test.shade.shmeta b/Assets/Scenes/UI Test.shade.shmeta deleted file mode 100644 index 2559b6b7..00000000 --- a/Assets/Scenes/UI Test.shade.shmeta +++ /dev/null @@ -1,3 +0,0 @@ -Name: UI Test -ID: 89355801 -Type: 5 diff --git a/Assets/Scenes/UI Test.shade b/Assets/Scenes/UI_Test.shade similarity index 100% rename from Assets/Scenes/UI Test.shade rename to Assets/Scenes/UI_Test.shade diff --git a/Assets/Scenes/UI_Test.shade.shmeta b/Assets/Scenes/UI_Test.shade.shmeta new file mode 100644 index 00000000..8b8d6f22 --- /dev/null +++ b/Assets/Scenes/UI_Test.shade.shmeta @@ -0,0 +1,3 @@ +Name: UI_Test +ID: 87707373 +Type: 5 diff --git a/Assets/Scripts/RaccoonShowcase.cs b/Assets/Scripts/RaccoonShowcase.cs index 1da191fd..424a8a3e 100644 --- a/Assets/Scripts/RaccoonShowcase.cs +++ b/Assets/Scripts/RaccoonShowcase.cs @@ -23,6 +23,7 @@ public class RaccoonShowcase : Script [Range(-5, 5)] public List intList = new List(new int[] { 2, 8, 2, 6, 8, 0, 1 }); public List enumList = new List(new Light.Type[] { Light.Type.Point, Light.Type.Directional, Light.Type.Ambient }); + public List nullList; public FontAsset fontAsset; public MeshAsset mesh; public MaterialAsset matAsset; diff --git a/Assets/Shaders/TestCube_Tile_FS.glsl b/Assets/Shaders/TestCube_Tile_FS.glsl new file mode 100644 index 00000000..84403a7c --- /dev/null +++ b/Assets/Shaders/TestCube_Tile_FS.glsl @@ -0,0 +1,48 @@ +#version 450 +#extension GL_ARB_separate_shader_objects : enable +#extension GL_ARB_shading_language_420pack : enable +#extension GL_EXT_nonuniform_qualifier : require + +struct MatPropData +{ + vec2 tileMult; + uint textureIndex; +}; + +layout(location = 0) in struct +{ + vec4 vertPos; // location 0 + vec2 uv; // location = 1 + vec4 normal; // location = 2 + +} In; + +// material stuff +layout(location = 3) flat in struct +{ + int materialIndex; + uint eid; + uint lightLayerIndex; +} In2; + +layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global) +layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials +{ + MatPropData data[]; +} MatProp; + +layout(location = 0) out vec4 position; +layout(location = 1) out uint outEntityID; +layout(location = 2) out uint lightLayerIndices; +layout(location = 3) out vec4 normals; +layout(location = 4) out vec4 albedo; + +void main() +{ + position = In.vertPos; + normals = In.normal; + albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv); + + outEntityID = In2.eid; + lightLayerIndices = In2.lightLayerIndex; +} \ No newline at end of file diff --git a/Assets/Shaders/TestCube_Tile_FS.shshaderb b/Assets/Shaders/TestCube_Tile_FS.shshaderb new file mode 100644 index 00000000..c7444c7d Binary files /dev/null and b/Assets/Shaders/TestCube_Tile_FS.shshaderb differ diff --git a/Assets/Shaders/TestCube_Tile_FS.shshaderb.shmeta b/Assets/Shaders/TestCube_Tile_FS.shshaderb.shmeta new file mode 100644 index 00000000..d19dc36d --- /dev/null +++ b/Assets/Shaders/TestCube_Tile_FS.shshaderb.shmeta @@ -0,0 +1,3 @@ +Name: TestCube_Tile_FS +ID: 39265233 +Type: 2 diff --git a/Assets/Shaders/TestCube_Tile_VS.glsl b/Assets/Shaders/TestCube_Tile_VS.glsl new file mode 100644 index 00000000..31a448fe --- /dev/null +++ b/Assets/Shaders/TestCube_Tile_VS.glsl @@ -0,0 +1,74 @@ +#version 450 +#extension GL_KHR_vulkan_glsl : enable + +//#include "ShaderDescriptorDefinitions.glsl" + + +layout(location = 0) in vec3 aVertexPos; +layout(location = 1) in vec2 aUV; +layout(location = 2) in vec3 aNormal; +layout(location = 3) in vec3 aTangent; +layout(location = 4) in mat4 worldTransform; +layout(location = 8) in uvec2 integerData; + +struct MatPropData +{ + vec2 tileMult; + uint textureIndex; +}; + +layout(location = 0) out struct +{ + vec4 vertPos; // location 0 + vec2 uv; // location = 1 + vec4 normal; // location = 2 + +} Out; + +// material stuff +layout(location = 3) out struct +{ + int materialIndex; + uint eid; + uint lightLayerIndex; + +} Out2; + +layout(set = 2, binding = 0) uniform CameraData +{ + vec4 position; + mat4 vpMat; + mat4 viewMat; + mat4 perspectiveMat; + mat4 orthoMat; +} cameraData; + +layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials +{ + MatPropData data[]; +} MatProp; + +void main() +{ + Out2.materialIndex = gl_InstanceIndex; + Out2.eid = integerData[0]; + Out2.lightLayerIndex = integerData[1]; + + // for transforming gBuffer position and normal data + mat4 modelViewMat = cameraData.viewMat * worldTransform; + + // gBuffer position will be in view space + Out.vertPos = modelViewMat * vec4(aVertexPos, 1.0f); + + // uvs for texturing in fragment shader + Out.uv = aUV * MatProp.data[gl_InstanceIndex].tileMult; + + mat3 transposeInv = mat3 (transpose(inverse(modelViewMat))); + + // normals are also in view space + Out.normal.rgb = transposeInv * aNormal.rgb; + Out.normal.rgb = normalize (Out.normal.rgb); + + // clip space for rendering + gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); +} \ No newline at end of file diff --git a/Assets/Shaders/TestCube_Tile_VS.shshaderb b/Assets/Shaders/TestCube_Tile_VS.shshaderb new file mode 100644 index 00000000..9f836656 Binary files /dev/null and b/Assets/Shaders/TestCube_Tile_VS.shshaderb differ diff --git a/Assets/Shaders/TestCube_Tile_VS.shshaderb.shmeta b/Assets/Shaders/TestCube_Tile_VS.shshaderb.shmeta new file mode 100644 index 00000000..0603263f --- /dev/null +++ b/Assets/Shaders/TestCube_Tile_VS.shshaderb.shmeta @@ -0,0 +1,3 @@ +Name: TestCube_Tile_VS +ID: 44231040 +Type: 2 diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp index d0fbaf2c..87234a6b 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.cpp @@ -90,7 +90,7 @@ namespace SHADE SHVkDescriptorSetLayout::Binding materialDataBinding { .Type = vk::DescriptorType::eStorageBufferDynamic, - .Stage = vk::ShaderStageFlagBits::eFragment, + .Stage = vk::ShaderStageFlagBits::eFragment | vk::ShaderStageFlagBits::eVertex, .BindPoint = SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA, .DescriptorCount = 1, }; diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index 03ca0b3d..bd1d60cd 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -61,8 +61,13 @@ namespace SHADE SHVkInstance::Init(true, false, true); #endif - // Get Physical Device and Construct Logical Device + // Get Physical Device physicalDevice = SHVkInstance::CreatePhysicalDevice(SH_PHYSICAL_DEVICE_TYPE::BEST); + if (!physicalDevice->GetVkPhysicalDevice()) + { + throw std::runtime_error("[Graphics System] No supported Vulkan 1.3 compatible GPU was detected!"); + } + // Construct Logical Device device = SHVkInstance::CreateLogicalDevice({ SHQueueParams(SH_Q_FAM::GRAPHICS, SH_QUEUE_SELECT::DEDICATED), SHQueueParams(SH_Q_FAM::TRANSFER, SH_QUEUE_SELECT::DEDICATED) }, physicalDevice); // Construct surface diff --git a/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp b/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp index bd68de82..7c111a2d 100644 --- a/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp +++ b/SHADE_Engine/src/Physics/PhysicsObject/SHPhysicsObjectManager.cpp @@ -250,9 +250,7 @@ namespace SHADE } // A static rigid body is implicitly created on creation of a physics object. - // We only need to sync rigid bodies here in the event it is non-static. - - physicsObject->SyncRigidBody(*componentGroup.rigidBodyComponent); + // Nothing is needed here. } void SHPhysicsObjectManager::addCollider(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup) @@ -269,7 +267,7 @@ namespace SHADE //for (int i = 0; i < NUM_SHAPES; ++i) // physicsObject->AddCollisionShape(i); - //physicsObject->SyncColliders(*componentGroup.colliderComponent); + physicsObject->SyncColliders(*componentGroup.colliderComponent); } void SHPhysicsObjectManager::removeRigidBody(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup) diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp index 89be2614..2df5c496 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.cpp @@ -411,7 +411,14 @@ namespace SHADE objectManager.AddRigidBody(EID); if (SHComponentManager::HasComponent(EID)) + { objectManager.AddCollider(EID); + + auto* COLLIDER = SHComponentManager::GetComponent(EID); + for (size_t i = 0; i < COLLIDER->GetCollisionShapes().size(); ++i) + objectManager.AddCollisionShape(EID, i); + } + }; //////////////////////////////// diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystemRoutines.cpp b/SHADE_Engine/src/Physics/System/SHPhysicsSystemRoutines.cpp index 24bd2f81..1d070f00 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystemRoutines.cpp +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystemRoutines.cpp @@ -255,6 +255,8 @@ namespace SHADE // Sync transforms & physics components transforms if (transformComponent && transformComponent->HasChanged()) { + physicsObject.GetRigidBody()->setIsSleeping(false); + preUpdateSyncTransform ( physicsObject diff --git a/SHADE_Managed/src/Editor/Editor.cxx b/SHADE_Managed/src/Editor/Editor.cxx index 29e3da36..80c73d4f 100644 --- a/SHADE_Managed/src/Editor/Editor.cxx +++ b/SHADE_Managed/src/Editor/Editor.cxx @@ -189,6 +189,12 @@ namespace SHADE System::Type^ listType = field->FieldType->GenericTypeArguments[0]; RangeAttribute^ rangeAttrib = hasAttribute(field); System::Collections::IList^ iList = safe_cast(field->GetValue(object)); + if (iList == nullptr) + { + // Create if the list does not exist + iList = safe_cast(System::Activator::CreateInstance(field->FieldType)); + field->SetValue(object, iList); + } if (SHEditorUI::CollapsingHeader(Convert::ToNative(field->Name), &isHovered)) {