diff --git a/Assets/Shaders/Kirsch_CS.shshaderb b/Assets/Shaders/Kirsch_CS.shshaderb index 4c54946c..6219d9a9 100644 Binary files a/Assets/Shaders/Kirsch_CS.shshaderb and b/Assets/Shaders/Kirsch_CS.shshaderb differ diff --git a/Assets/Shaders/PureCopy_CS.shshaderb b/Assets/Shaders/PureCopy_CS.shshaderb index 30a629f5..9f1b0534 100644 Binary files a/Assets/Shaders/PureCopy_CS.shshaderb and b/Assets/Shaders/PureCopy_CS.shshaderb differ diff --git a/Assets/Shaders/TestCube_FS.glsl b/Assets/Shaders/TestCube_FS.glsl index 4dc6deca..c60da6ce 100644 --- a/Assets/Shaders/TestCube_FS.glsl +++ b/Assets/Shaders/TestCube_FS.glsl @@ -13,37 +13,38 @@ struct MatPropData layout(location = 0) in struct { - vec4 vertColor; - vec2 uv; + vec4 vertPos; // location 0 + vec2 uv; // location = 1 + vec4 normal; // location = 2 } In; // material stuff -layout(location = 2) flat in struct +layout(location = 3) flat in struct { int materialIndex; uint eid; uint lightLayerIndex; } In2; -//layout (set = 0, binding = ) - layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global) -layout (set = 3, binding = 0) buffer MaterialProperties // For materials +layout (std430, set = 3, binding = 0) buffer MaterialProperties // For materials { MatPropData data[]; } MatProp; -layout(location = 0) out vec4 outColor; +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() { - outColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv) + - MatProp.data[In2.materialIndex].color / MatProp.data[In2.materialIndex].alpha; + position = In.vertPos; + normals = In.normal; + albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv) + MatProp.data[In2.materialIndex].color / MatProp.data[In2.materialIndex].alpha; outEntityID = In2.eid; lightLayerIndices = In2.lightLayerIndex; - //outColor = vec4 (1.0f); } \ No newline at end of file diff --git a/Assets/Shaders/TestCube_FS.shshaderb b/Assets/Shaders/TestCube_FS.shshaderb index 45b6a713..b0113dc7 100644 Binary files a/Assets/Shaders/TestCube_FS.shshaderb and b/Assets/Shaders/TestCube_FS.shshaderb differ diff --git a/Assets/Shaders/TestCube_VS.glsl b/Assets/Shaders/TestCube_VS.glsl index 7b58d1cf..49f107dd 100644 --- a/Assets/Shaders/TestCube_VS.glsl +++ b/Assets/Shaders/TestCube_VS.glsl @@ -14,13 +14,14 @@ layout(location = 8) in uvec2 integerData; layout(location = 0) out struct { - vec4 vertColor; // location 0 + vec4 vertPos; // location 0 vec2 uv; // location = 1 + vec4 normal; // location = 2 } Out; // material stuff -layout(location = 2) out struct +layout(location = 3) out struct { int materialIndex; uint eid; @@ -36,10 +37,14 @@ layout(set = 2, binding = 0) uniform CameraData void main() { - Out.uv = aUV; + Out2.materialIndex = gl_InstanceIndex; Out2.eid = integerData[0]; Out2.lightLayerIndex = integerData[1]; + + Out.vertPos = worldTransform * vec4(aVertexPos, 1.0f); + Out.uv = aUV; + Out.normal.rgb = mat3(transpose(inverse(worldTransform))) * aNormal.rgb; + Out.normal.rgb = normalize (Out.normal.rgb); gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); - Out.vertColor = vec4 (aVertexPos, 1.0f); } \ No newline at end of file diff --git a/Assets/Shaders/TestCube_VS.shshaderb b/Assets/Shaders/TestCube_VS.shshaderb index e070a9a6..03e23af3 100644 Binary files a/Assets/Shaders/TestCube_VS.shshaderb and b/Assets/Shaders/TestCube_VS.shshaderb differ diff --git a/SHADE_Engine/src/Assets/SHAssetManager.cpp b/SHADE_Engine/src/Assets/SHAssetManager.cpp index 228f3fdc..76b68e50 100644 --- a/SHADE_Engine/src/Assets/SHAssetManager.cpp +++ b/SHADE_Engine/src/Assets/SHAssetManager.cpp @@ -349,13 +349,13 @@ namespace SHADE meshAsset.id = GenerateAssetID(AssetType::MESH); meshAsset.type = AssetType::MESH; assetCollection.push_back(meshAsset); - SHAssetMetaHandler::WriteMetaData(meshAsset); + //SHAssetMetaHandler::WriteMetaData(meshAsset); } continue; } assetCollection.push_back(newAsset); - SHAssetMetaHandler::WriteMetaData(newAsset); + //SHAssetMetaHandler::WriteMetaData(newAsset); } } @@ -372,7 +372,7 @@ namespace SHADE ****************************************************************************/ void SHAssetManager::Load() noexcept { - //CompileAll(); + CompileAll(); InitLoaders(); BuildAssetCollection(); //LoadAllData();