aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2019-05-22 10:09:50 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2019-05-22 10:09:50 +0200
commit8e89140d8e701bc64f926ea9cd3bc5ae13fff4fd (patch)
tree8290f4f5d476200cf1920001b3a7d382feb94c07
parent19d3a9b6809075b00cb2309f77e5e213e498892f (diff)
shadow mapping with instance rendering ok
-rw-r--r--samples/deferred/deferredPbrRenderer.cs15
-rw-r--r--samples/deferred/main-crow.cs8
-rw-r--r--samples/deferred/main.cs12
-rw-r--r--samples/deferred/shaders/shadow.geom5
-rw-r--r--samples/deferred/shaders/shadow.vert8
-rw-r--r--samples/deferred/shadowMapRenderer.cs2
-rw-r--r--samples/pbr/EnvironmentPipeline.cs (renamed from samples/pbrSashaWillem/EnvironmentPipeline.cs)0
-rw-r--r--samples/pbr/PbrModel.cs (renamed from samples/pbrSashaWillem/PbrModel.cs)0
-rw-r--r--samples/pbr/PbrPipeline.cs (renamed from samples/pbrSashaWillem/PbrPipeline.cs)0
-rw-r--r--samples/pbr/main.cs (renamed from samples/pbrSashaWillem/main.cs)11
-rw-r--r--samples/pbr/pbr.csproj (renamed from samples/pbrSashaWillem/SachaWillemPbr.csproj)0
-rw-r--r--samples/pbr/screenshot.png (renamed from samples/pbrSashaWillem/screenshot.png)bin384899 -> 384899 bytes
-rw-r--r--samples/pbr/shaders/FullScreenQuad.vert (renamed from samples/pbrSashaWillem/shaders/FullScreenQuad.vert)0
-rw-r--r--samples/pbr/shaders/filtercube.vert (renamed from samples/pbrSashaWillem/shaders/filtercube.vert)0
-rw-r--r--samples/pbr/shaders/genbrdflut.frag (renamed from samples/pbrSashaWillem/shaders/genbrdflut.frag)0
-rw-r--r--samples/pbr/shaders/genbrdflut.vert (renamed from samples/pbrSashaWillem/shaders/genbrdflut.vert)0
-rw-r--r--samples/pbr/shaders/irradiancecube.frag (renamed from samples/pbrSashaWillem/shaders/irradiancecube.frag)0
-rw-r--r--samples/pbr/shaders/pbr.vert (renamed from samples/pbrSashaWillem/shaders/pbr.vert)0
-rw-r--r--samples/pbr/shaders/pbr_khr.frag (renamed from samples/pbrSashaWillem/shaders/pbr_khr.frag)0
-rw-r--r--samples/pbr/shaders/prefilterenvmap.frag (renamed from samples/pbrSashaWillem/shaders/prefilterenvmap.frag)0
-rw-r--r--samples/pbr/shaders/simpletexture.frag (renamed from samples/pbrSashaWillem/shaders/simpletexture.frag)0
-rw-r--r--samples/pbr/shaders/skybox.frag (renamed from samples/pbrSashaWillem/shaders/skybox.frag)0
-rw-r--r--samples/pbr/shaders/skybox.vert (renamed from samples/pbrSashaWillem/shaders/skybox.vert)0
-rwxr-xr-xsamples/pbr/ui/fps.crow (renamed from samples/pbrSashaWillem/ui/fps.crow)0
-rw-r--r--vk.generator/Program.cs3
-rw-r--r--vk.net.sln22
-rw-r--r--vke/Properties/AssemblyInfo.cs51
-rw-r--r--vke/src/Instance.cs56
-rw-r--r--vke/src/model/BoundingBox.cs78
-rw-r--r--vke/src/model/Model.cs (renamed from vke/src/Model.cs)196
-rw-r--r--vke/src/model/PbrModel.cs (renamed from vke/src/PbrModel.cs)0
-rw-r--r--vke/src/model/PbrModelSeparateTextures.cs (renamed from vke/src/PbrModelSeparateTextures.cs)6
-rw-r--r--vke/src/model/PbrModelTexArray.cs (renamed from vke/src/PbrModelTexArray.cs)29
-rw-r--r--vke/src/model/glTFLoader.cs (renamed from vke/src/glTFLoader.cs)0
34 files changed, 216 insertions, 286 deletions
diff --git a/samples/deferred/deferredPbrRenderer.cs b/samples/deferred/deferredPbrRenderer.cs
index bf3ab54..d954c0f 100644
--- a/samples/deferred/deferredPbrRenderer.cs
+++ b/samples/deferred/deferredPbrRenderer.cs
@@ -14,6 +14,7 @@ namespace deferred {
public static VkSampleCountFlags NUM_SAMPLES = VkSampleCountFlags.SampleCount1;
public static VkFormat HDR_FORMAT = VkFormat.R32g32b32a32Sfloat;
public static VkFormat MRT_FORMAT = VkFormat.R32g32b32a32Sfloat;
+ public static bool TEXTURE_ARRAY = false;
public enum DebugView {
none,
@@ -29,13 +30,11 @@ namespace deferred {
irradiance,
shadowMap
}
-
- public static bool EnableTextureArray = false;
-
public DebugView currentDebugView = DebugView.none;
public int lightNumDebug = 0;
public int debugMip = 0;
public int debugFace = 0;
+ const float lightMoveSpeed = 0.1f;
public struct Matrices {
public Matrix4x4 projection;
@@ -69,8 +68,6 @@ namespace deferred {
}
};
- const float lightMoveSpeed = 0.1f;
-
Framebuffer[] frameBuffers;
Image gbColorRough, gbEmitMetal, gbN_AO, gbPos, hdrImg;
@@ -197,7 +194,7 @@ namespace deferred {
descLayoutMain.Bindings.Add (new VkDescriptorSetLayoutBinding (6, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));
#endif
- if (EnableTextureArray) {
+ if (TEXTURE_ARRAY) {
descLayoutMain.Bindings.Add (new VkDescriptorSetLayoutBinding (7, VkShaderStageFlags.Fragment, VkDescriptorType.CombinedImageSampler));//texture array
} else {
descLayoutTextures = new DescriptorSetLayout (dev,
@@ -224,7 +221,7 @@ namespace deferred {
cfg.multisampleState.minSampleShading = 0.5f;
}
cfg.Cache = pipelineCache;
- if (EnableTextureArray)
+ if (TEXTURE_ARRAY)
cfg.Layout = new PipelineLayout (dev, descLayoutMain, descLayoutGBuff);
else
cfg.Layout = new PipelineLayout (dev, descLayoutMain, descLayoutGBuff, descLayoutTextures);
@@ -249,7 +246,7 @@ namespace deferred {
new SpecializationConstant<float> (2, MAX_MATERIAL_COUNT))) {
cfg.AddShader (VkShaderStageFlags.Vertex, "shaders/GBuffPbr.vert.spv");
- if (EnableTextureArray)
+ if (TEXTURE_ARRAY)
cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/GBuffPbrTexArray.frag.spv", constants);
else
cfg.AddShader (VkShaderStageFlags.Fragment, "shaders/GBuffPbr.frag.spv", constants);
@@ -309,7 +306,7 @@ namespace deferred {
dev.WaitIdle ();
model?.Dispose ();
- if (EnableTextureArray) {
+ if (TEXTURE_ARRAY) {
PbrModelTexArray mod = new PbrModelTexArray (transferQ, path);
if (mod.texArray != null) {
DescriptorSetWrites uboUpdate = new DescriptorSetWrites (dsMain, descLayoutMain.Bindings[5], descLayoutMain.Bindings[7]);
diff --git a/samples/deferred/main-crow.cs b/samples/deferred/main-crow.cs
index 85a033c..6fa200e 100644
--- a/samples/deferred/main-crow.cs
+++ b/samples/deferred/main-crow.cs
@@ -9,10 +9,10 @@ using System.Linq;
namespace deferred {
class Program : Crow.CrowWin {
static void Main (string[] args) {
- Instance.DebugUtils = true;
- Instance.Validation = true;
+ Instance.DEBUG_UTILS = true;
+ Instance.VALIDATION = true;
//Instance.RenderDocCapture = true;
- DeferredPbrRenderer.EnableTextureArray = true;
+ DeferredPbrRenderer.TEXTURE_ARRAY = true;
PbrModelTexArray.TEXTURE_DIM = 512;
using (Program vke = new Program ()) {
@@ -128,7 +128,7 @@ namespace deferred {
Program () : base(true) {
- if (Instance.DebugUtils)
+ if (Instance.DEBUG_UTILS)
dbgRepport = new DebugReport (instance,
VkDebugReportFlagsEXT.ErrorEXT
| VkDebugReportFlagsEXT.DebugEXT
diff --git a/samples/deferred/main.cs b/samples/deferred/main.cs
index d7c4930..6a6eb1b 100644
--- a/samples/deferred/main.cs
+++ b/samples/deferred/main.cs
@@ -8,13 +8,13 @@ namespace deferred {
class Deferred : VkWindow {
static void Main (string[] args) {
- //Instance.Validation = true;
- //Instance.DebugUtils = true;
- //Instance.RenderDocCapture = true;
- DeferredPbrRenderer.EnableTextureArray = true;
+ Instance.VALIDATION = true;
+ Instance.DEBUG_UTILS = true;
+ //Instance.RENDER_DOC_CAPTURE = true;
+ DeferredPbrRenderer.TEXTURE_ARRAY = true;
DeferredPbrRenderer.NUM_SAMPLES = VkSampleCountFlags.SampleCount4;
- PbrModelTexArray.TEXTURE_DIM = 512;
+ PbrModelTexArray.TEXTURE_DIM = 1024;
using (Deferred vke = new Deferred ()) {
vke.Run ();
@@ -61,7 +61,7 @@ namespace deferred {
Deferred () : base(true) {
- if (Instance.DebugUtils)
+ if (Instance.DEBUG_UTILS)
dbgRepport = new DebugReport (instance,
VkDebugReportFlagsEXT.ErrorEXT
| VkDebugReportFlagsEXT.DebugEXT
diff --git a/samples/deferred/shaders/shadow.geom b/samples/deferred/shaders/shadow.geom
index 283586d..9fd322c 100644
--- a/samples/deferred/shaders/shadow.geom
+++ b/samples/deferred/shaders/shadow.geom
@@ -21,16 +21,13 @@ layout (set = 0, binding = 1) uniform UBOLights {
//layout (location = 0) in int inInstanceIndex[];
-layout(push_constant) uniform PushConsts {
- mat4 model;
-} pc;
void main()
{
for (int i = 0; i < gl_in.length(); i++)
{
gl_Layer = gl_InvocationID;
- gl_Position = lights[gl_InvocationID].mvp * model * pc.model * gl_in[i].gl_Position;
+ gl_Position = lights[gl_InvocationID].mvp * model * gl_in[i].gl_Position;
EmitVertex();
}
EndPrimitive();
diff --git a/samples/deferred/shaders/shadow.vert b/samples/deferred/shaders/shadow.vert
index 548f093..b0bd6c0 100644
--- a/samples/deferred/shaders/shadow.vert
+++ b/samples/deferred/shaders/shadow.vert
@@ -1,8 +1,12 @@
#version 450
-layout (location = 0) in vec4 inPos;
+layout (location = 0) in vec3 inPos;
+
+layout(push_constant) uniform PushConsts {
+ mat4 model;
+} pc;
void main()
{
- gl_Position = inPos;
+ gl_Position = pc.model * vec4(inPos,1);
} \ No newline at end of file
diff --git a/samples/deferred/shadowMapRenderer.cs b/samples/deferred/shadowMapRenderer.cs
index e24b872..7b86f81 100644
--- a/samples/deferred/shadowMapRenderer.cs
+++ b/samples/deferred/shadowMapRenderer.cs
@@ -78,7 +78,7 @@ namespace deferred {
cfg.Layout = new PipelineLayout (dev, descLayoutShadow);
cfg.Layout.AddPushConstants (
- new VkPushConstantRange (VkShaderStageFlags.Geometry, (uint)Marshal.SizeOf<Matrix4x4> ())
+ new VkPushConstantRange (VkShaderStageFlags.Vertex, (uint)Marshal.SizeOf<Matrix4x4> ())
);
cfg.AddVertexBinding<PbrModel.Vertex> (0);
diff --git a/samples/pbrSashaWillem/EnvironmentPipeline.cs b/samples/pbr/EnvironmentPipeline.cs
index a03374b..a03374b 100644
--- a/samples/pbrSashaWillem/EnvironmentPipeline.cs
+++ b/samples/pbr/EnvironmentPipeline.cs
diff --git a/samples/pbrSashaWillem/PbrModel.cs b/samples/pbr/PbrModel.cs
index b7e117a..b7e117a 100644
--- a/samples/pbrSashaWillem/PbrModel.cs
+++ b/samples/pbr/PbrModel.cs
diff --git a/samples/pbrSashaWillem/PbrPipeline.cs b/samples/pbr/PbrPipeline.cs
index 4ca7e7a..4ca7e7a 100644
--- a/samples/pbrSashaWillem/PbrPipeline.cs
+++ b/samples/pbr/PbrPipeline.cs
diff --git a/samples/pbrSashaWillem/main.cs b/samples/pbr/main.cs
index 95e945b..d8e0590 100644
--- a/samples/pbrSashaWillem/main.cs
+++ b/samples/pbr/main.cs
@@ -1,11 +1,18 @@
-using System;
+/* Forward pbr sample inspire from https://github.com/SaschaWillems/Vulkan-glTF-PBR
+ *
+ * Copyright (c) 2019 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+ *
+ * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+ */
+
+using System;
using System.Numerics;
using System.Runtime.InteropServices;
using Glfw;
using VK;
using CVKL;
-namespace pbrSachaWillem {
+namespace pbrSample {
class Program : VkWindow{
static void Main (string[] args) {
using (Program vke = new Program ()) {
diff --git a/samples/pbrSashaWillem/SachaWillemPbr.csproj b/samples/pbr/pbr.csproj
index 1e1cb59..1e1cb59 100644
--- a/samples/pbrSashaWillem/SachaWillemPbr.csproj
+++ b/samples/pbr/pbr.csproj
diff --git a/samples/pbrSashaWillem/screenshot.png b/samples/pbr/screenshot.png
index 5662cb5..5662cb5 100644
--- a/samples/pbrSashaWillem/screenshot.png
+++ b/samples/pbr/screenshot.png
Binary files differ
diff --git a/samples/pbrSashaWillem/shaders/FullScreenQuad.vert b/samples/pbr/shaders/FullScreenQuad.vert
index 826720b..826720b 100644
--- a/samples/pbrSashaWillem/shaders/FullScreenQuad.vert
+++ b/samples/pbr/shaders/FullScreenQuad.vert
diff --git a/samples/pbrSashaWillem/shaders/filtercube.vert b/samples/pbr/shaders/filtercube.vert
index 34adf73..34adf73 100644
--- a/samples/pbrSashaWillem/shaders/filtercube.vert
+++ b/samples/pbr/shaders/filtercube.vert
diff --git a/samples/pbrSashaWillem/shaders/genbrdflut.frag b/samples/pbr/shaders/genbrdflut.frag
index b6290dd..b6290dd 100644
--- a/samples/pbrSashaWillem/shaders/genbrdflut.frag
+++ b/samples/pbr/shaders/genbrdflut.frag
diff --git a/samples/pbrSashaWillem/shaders/genbrdflut.vert b/samples/pbr/shaders/genbrdflut.vert
index f3dd233..f3dd233 100644
--- a/samples/pbrSashaWillem/shaders/genbrdflut.vert
+++ b/samples/pbr/shaders/genbrdflut.vert
diff --git a/samples/pbrSashaWillem/shaders/irradiancecube.frag b/samples/pbr/shaders/irradiancecube.frag
index 340d679..340d679 100644
--- a/samples/pbrSashaWillem/shaders/irradiancecube.frag
+++ b/samples/pbr/shaders/irradiancecube.frag
diff --git a/samples/pbrSashaWillem/shaders/pbr.vert b/samples/pbr/shaders/pbr.vert
index 76ee24b..76ee24b 100644
--- a/samples/pbrSashaWillem/shaders/pbr.vert
+++ b/samples/pbr/shaders/pbr.vert
diff --git a/samples/pbrSashaWillem/shaders/pbr_khr.frag b/samples/pbr/shaders/pbr_khr.frag
index 9564e00..9564e00 100644
--- a/samples/pbrSashaWillem/shaders/pbr_khr.frag
+++ b/samples/pbr/shaders/pbr_khr.frag
diff --git a/samples/pbrSashaWillem/shaders/prefilterenvmap.frag b/samples/pbr/shaders/prefilterenvmap.frag
index ae1212e..ae1212e 100644
--- a/samples/pbrSashaWillem/shaders/prefilterenvmap.frag
+++ b/samples/pbr/shaders/prefilterenvmap.frag
diff --git a/samples/pbrSashaWillem/shaders/simpletexture.frag b/samples/pbr/shaders/simpletexture.frag
index d5bcf79..d5bcf79 100644
--- a/samples/pbrSashaWillem/shaders/simpletexture.frag
+++ b/samples/pbr/shaders/simpletexture.frag
diff --git a/samples/pbrSashaWillem/shaders/skybox.frag b/samples/pbr/shaders/skybox.frag
index 57a7dbe..57a7dbe 100644
--- a/samples/pbrSashaWillem/shaders/skybox.frag
+++ b/samples/pbr/shaders/skybox.frag
diff --git a/samples/pbrSashaWillem/shaders/skybox.vert b/samples/pbr/shaders/skybox.vert
index 22e285e..22e285e 100644
--- a/samples/pbrSashaWillem/shaders/skybox.vert
+++ b/samples/pbr/shaders/skybox.vert
diff --git a/samples/pbrSashaWillem/ui/fps.crow b/samples/pbr/ui/fps.crow
index 351f059..351f059 100755
--- a/samples/pbrSashaWillem/ui/fps.crow
+++ b/samples/pbr/ui/fps.crow
diff --git a/vk.generator/Program.cs b/vk.generator/Program.cs
index 604c1bd..79e03e5 100644
--- a/vk.generator/Program.cs
+++ b/vk.generator/Program.cs
@@ -1,8 +1,9 @@
//
// Program.cs
//
-// Author:
+// Authors:
// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// https://github.com/mellinoe
//
// Copyright (c) 2019 jp
//
diff --git a/vk.net.sln b/vk.net.sln
index 4addd1e..5d6ed69 100644
--- a/vk.net.sln
+++ b/vk.net.sln
@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vk.generator", "vk.generato
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vk.rewrite", "vk.rewrite\vk.rewrite.csproj", "{F41EA96F-A9F7-4E85-B2EE-5757C5FAD00D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SachaWillemPbr", "samples\pbrSashaWillem\SachaWillemPbr.csproj", "{1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vkvg_tests", "samples\vkvg_tests\vkvg_tests.csproj", "{1F05E74F-AEE8-481C-8FDF-456654CC30BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vulkan", "VK\vulkan.csproj", "{1603D809-D9C4-4EE5-B921-B053CE22E068}"
@@ -25,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "deferred", "samples\deferre
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "compute", "samples\compute\compute.csproj", "{05515E15-D3C3-4A8C-A940-9467D9D77823}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pbr", "samples\pbr\pbr.csproj", "{790642C5-7AD1-437D-9F9C-3F721133AFEF}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -59,12 +59,6 @@ Global
{F41EA96F-A9F7-4E85-B2EE-5757C5FAD00D}.temp|Any CPU.ActiveCfg = Debug|Any CPU
{F41EA96F-A9F7-4E85-B2EE-5757C5FAD00D}.temp|Any CPU.Build.0 = Debug|Any CPU
{F41EA96F-A9F7-4E85-B2EE-5757C5FAD00D}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}.Release|Any CPU.Build.0 = Release|Any CPU
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}.temp|Any CPU.ActiveCfg = Debug|Any CPU
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F05E74F-AEE8-481C-8FDF-456654CC30BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F05E74F-AEE8-481C-8FDF-456654CC30BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F05E74F-AEE8-481C-8FDF-456654CC30BE}.Release|Any CPU.Build.0 = Release|Any CPU
@@ -98,15 +92,23 @@ Global
{05515E15-D3C3-4A8C-A940-9467D9D77823}.temp|Any CPU.ActiveCfg = Debug|Any CPU
{05515E15-D3C3-4A8C-A940-9467D9D77823}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
{05515E15-D3C3-4A8C-A940-9467D9D77823}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.temp|Any CPU.ActiveCfg = Debug|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.temp|Any CPU.Build.0 = Debug|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.DebugCrow|Any CPU.ActiveCfg = Debug|Any CPU
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF}.DebugCrow|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{96A2E0B8-91AE-4EB9-A435-185D01E24067} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
{96A2A7896-91AE-4EB9-A435-185D01E24067} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
- {1F18E74F-BCC9-481C-8FDF-89D81CBB30BE} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
{1F05E74F-AEE8-481C-8FDF-456654CC30BE} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
{001F5D64-871B-47A4-A823-78C7CE3785AA} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
{BFF1BEEC-2E93-4963-AD3C-2A8C9BA05C36} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
{05515E15-D3C3-4A8C-A940-9467D9D77823} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
+ {790642C5-7AD1-437D-9F9C-3F721133AFEF} = {A2A2849A-0032-4AA8-BC0E-82C69D7DE354}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
@@ -141,5 +143,7 @@ Global
$0.XmlFormattingPolicy = $6
$6.inheritsSet = null
$6.scope = application/config+xml
+ $0.StandardHeader = $7
+ $7.Text = @Copyright (c) ${Year} ${AuthorName} <${AuthorEmail}>\n\nThis code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
EndGlobalSection
EndGlobal
diff --git a/vke/Properties/AssemblyInfo.cs b/vke/Properties/AssemblyInfo.cs
deleted file mode 100644
index fc7cb0d..0000000
--- a/vke/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// AssemblyInfo.cs
-//
-// Author:
-// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
-//
-// Copyright (c) 2019 jp
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle ("testvk")]
-[assembly: AssemblyDescription ("")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("Grand Tetra Software")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("jp")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion ("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
diff --git a/vke/src/Instance.cs b/vke/src/Instance.cs
index 423d3c0..0b53e68 100644
--- a/vke/src/Instance.cs
+++ b/vke/src/Instance.cs
@@ -1,5 +1,5 @@
//
-// PhysicalDevice.cs
+// Instance.cs
//
// Author:
// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
@@ -30,14 +30,23 @@ using VK;
using static VK.Vk;
namespace CVKL {
+ /// <summary>
+ /// Vulkan Instance disposable class
+ /// </summary>
public class Instance : IDisposable {
- public static bool Validation;
- public static bool DebugUtils;
- public static bool RenderDocCapture;
+ /// <summary>If true, the VK_LAYER_KHRONOS_validation layer is loaded at startup; </summary>
+ public static bool VALIDATION;
+ /// <summary>If true, the VK_EXT_DEBUG_UTILS_EXTENSION_NAME and VK_EXT_DEBUG_REPORT_EXTENSION_NAME device extensions are enabled</summary>
+ public static bool DEBUG_UTILS;
+ /// <summary>If true, the VK_LAYER_RENDERDOC_Capture layer is loaded at startup; </summary>
+ public static bool RENDER_DOC_CAPTURE;
VkInstance inst;
- static class Strings {
+ public IntPtr Handle => inst.Handle;
+
+
+ static class Strings {
public static FixedUtf8String Name = "VKENGINE";
public static FixedUtf8String VK_KHR_SURFACE_EXTENSION_NAME = "VK_KHR_surface";
public static FixedUtf8String VK_KHR_WIN32_SURFACE_EXTENSION_NAME = "VK_KHR_win32_surface";
@@ -51,25 +60,12 @@ namespace CVKL {
public static FixedUtf8String VkTraceLayeName = "VK_LAYER_LUNARG_vktrace";
public static FixedUtf8String RenderdocCaptureLayerName = "VK_LAYER_RENDERDOC_Capture";
public static FixedUtf8String main = "main";
- }
-
- public PhysicalDeviceCollection GetAvailablePhysicalDevice () {
- return new PhysicalDeviceCollection (inst);
- }
-
- public VkSurfaceKHR CreateSurface (IntPtr hWindow) {
- ulong surf;
- Utils.CheckResult ((VkResult)Glfw.Glfw3.CreateWindowSurface (inst.Handle, hWindow, IntPtr.Zero, out surf), "Create Surface Failed.");
- return surf;
- }
+ }
public Instance () {
init ();
}
- public IntPtr Handle {
- get { return inst.Handle; }
- }
void init () {
List<IntPtr> instanceExtensions = new List<IntPtr> ();
@@ -84,12 +80,12 @@ namespace CVKL {
throw new PlatformNotSupportedException ();
}
- if (Validation)
+ if (VALIDATION)
enabledLayerNames.Add (Strings.LayerValidation);
- if (RenderDocCapture)
+ if (RENDER_DOC_CAPTURE)
enabledLayerNames.Add (Strings.RenderdocCaptureLayerName);
- if (DebugUtils) {
+ if (DEBUG_UTILS) {
instanceExtensions.Add (Strings.VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
instanceExtensions.Add (Strings.VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
}
@@ -127,6 +123,15 @@ namespace CVKL {
enabledLayerNames.Unpin ();
}
+ public PhysicalDeviceCollection GetAvailablePhysicalDevice () => new PhysicalDeviceCollection (inst);
+ /// <summary>
+ /// Create a new vulkan surface from native window pointer
+ /// </summary>
+ public VkSurfaceKHR CreateSurface (IntPtr hWindow) {
+ ulong surf;
+ Utils.CheckResult ((VkResult)Glfw.Glfw3.CreateWindowSurface (inst.Handle, hWindow, IntPtr.Zero, out surf), "Create Surface Failed.");
+ return surf;
+ }
public void GetDelegate<T> (string name, out T del) {
using (FixedUtf8String n = new FixedUtf8String (name)) {
del = Marshal.GetDelegateForFunctionPointer<T> (vkGetInstanceProcAddr (Handle, (IntPtr)n));
@@ -138,9 +143,10 @@ namespace CVKL {
protected virtual void Dispose (bool disposing) {
if (!disposedValue) {
- if (disposing) {
- // TODO: supprimer l'état managé (objets managés).
- }
+ if (disposing) {
+ // TODO: supprimer l'état managé (objets managés).
+ } else
+ System.Diagnostics.Debug.WriteLine ("Instance disposed by Finalizer");
vkDestroyInstance (inst, IntPtr.Zero);
diff --git a/vke/src/model/BoundingBox.cs b/vke/src/model/BoundingBox.cs
new file mode 100644
index 0000000..07747c8
--- /dev/null
+++ b/vke/src/model/BoundingBox.cs
@@ -0,0 +1,78 @@
+//
+// BoundingBox
+//
+// Authors:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+// https://github.com/mellinoe
+//
+// Copyright (c) 2019 jp
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Numerics;
+/* code derived from https://github.com/mellinoe*/
+namespace CVKL {
+ public struct BoundingBox {
+ public Vector3 min;
+ public Vector3 max;
+ public bool isValid;
+ public BoundingBox (Vector3 min, Vector3 max, bool isValid = false) {
+ this.min = min;
+ this.max = max;
+ this.isValid = isValid;
+ }
+ public BoundingBox getAABB (Matrix4x4 m) {
+ if (!isValid)
+ return default (BoundingBox);
+ Vector3 mini = new Vector3 (m.M41, m.M42, m.M43);
+ Vector3 maxi = mini;
+ Vector3 v0, v1;
+
+ Vector3 right = new Vector3 (m.M11, m.M12, m.M13);
+ v0 = right * this.min.X;
+ v1 = right * this.max.X;
+ mini += Vector3.Min (v0, v1);
+ maxi += Vector3.Max (v0, v1);
+
+ Vector3 up = new Vector3 (m.M21, m.M22, m.M23);
+ v0 = up * this.min.Y;
+ v1 = up * this.max.Y;
+ mini += Vector3.Min (v0, v1);
+ maxi += Vector3.Max (v0, v1);
+
+ Vector3 back = new Vector3 (m.M31, m.M32, m.M33);
+ v0 = back * this.min.Z;
+ v1 = back * this.max.Z;
+ mini += Vector3.Min (v0, v1);
+ maxi += Vector3.Max (v0, v1);
+
+ return new BoundingBox (mini, maxi, true);
+ }
+
+ public float Width => max.X - min.X;
+ public float Height => max.Y - min.Y;
+ public float Depth => max.Z - min.Z;
+
+ public Vector3 Center => new Vector3 (Width / 2f + min.X, Height / 2f + min.Y, Depth / 2f + min.Z);
+
+ public static BoundingBox operator +(BoundingBox bb1, BoundingBox bb2) {
+ return bb1.isValid ? bb2.isValid ? new BoundingBox (Vector3.Min (bb1.min, bb2.min), Vector3.Min (bb1.max, bb2.max),true) : bb1 : bb2.isValid ? bb2 : default(BoundingBox);
+ }
+ public override string ToString () => isValid ? string.Format ($" {min}->{max}") : "Invalid";
+ }
+}
diff --git a/vke/src/Model.cs b/vke/src/model/Model.cs
index 03cae49..fbcea30 100644
--- a/vke/src/Model.cs
+++ b/vke/src/model/Model.cs
@@ -31,55 +31,6 @@ using VK;
namespace CVKL {
- public struct BoundingBox {
- public Vector3 min;
- public Vector3 max;
- public bool isValid;
- public BoundingBox (Vector3 min, Vector3 max, bool isValid = false) {
- this.min = min;
- this.max = max;
- this.isValid = isValid;
- }
- public BoundingBox getAABB (Matrix4x4 m) {
- if (!isValid)
- return default (BoundingBox);
- Vector3 mini = new Vector3 (m.M41, m.M42, m.M43);
- Vector3 maxi = mini;
- Vector3 v0, v1;
-
- Vector3 right = new Vector3 (m.M11, m.M12, m.M13);
- v0 = right * this.min.X;
- v1 = right * this.max.X;
- mini += Vector3.Min (v0, v1);
- maxi += Vector3.Max (v0, v1);
-
- Vector3 up = new Vector3 (m.M21, m.M22, m.M23);
- v0 = up * this.min.Y;
- v1 = up * this.max.Y;
- mini += Vector3.Min (v0, v1);
- maxi += Vector3.Max (v0, v1);
-
- Vector3 back = new Vector3 (m.M31, m.M32, m.M33);
- v0 = back * this.min.Z;
- v1 = back * this.max.Z;
- mini += Vector3.Min (v0, v1);
- maxi += Vector3.Max (v0, v1);
-
- return new BoundingBox (mini, maxi, true);
- }
-
- public float Width => max.X - min.X;
- public float Height => max.Y - min.Y;
- public float Depth => max.Z - min.Z;
-
- public Vector3 Center => new Vector3 (Width / 2f + min.X, Height / 2f + min.Y, Depth / 2f + min.Z);
-
- public static BoundingBox operator +(BoundingBox bb1, BoundingBox bb2) {
- return bb1.isValid ? bb2.isValid ? new BoundingBox (Vector3.Min (bb1.min, bb2.min), Vector3.Min (bb1.max, bb2.max),true) : bb1 : bb2.isValid ? bb2 : default(BoundingBox);
- }
- public override string ToString () => isValid ? string.Format ($" {min}->{max}") : "Invalid";
- }
-
public enum AlphaMode : UInt32 {
Opaque,
@@ -88,6 +39,18 @@ namespace CVKL {
};
//TODO:stride in buffer views?
public class Model {
+ public struct Vertex {
+ [VertexAttribute (VertexAttributeType.Position, VkFormat.R32g32b32Sfloat)]
+ public Vector3 pos;
+ [VertexAttribute (VertexAttributeType.Normal, VkFormat.R32g32b32Sfloat)]
+ public Vector3 normal;
+ [VertexAttribute (VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
+ public Vector2 uv;
+ public override string ToString () {
+ return pos.ToString () + ";" + normal.ToString () + ";" + uv.ToString ();
+ }
+ };
+
public struct Dimensions {
public Vector3 min;
public Vector3 max;
@@ -97,11 +60,13 @@ namespace CVKL {
max = _max;
}
}
+
public class InstancedCmd
{
public int meshIdx;
public uint count;
}
+
public class Primitive {
public string name;
public UInt32 indexBase;
@@ -178,52 +143,21 @@ namespace CVKL {
}
}
- protected Device dev;
-
- public VkIndexType IndexBufferType;
-
- protected int defaultSceneIndex;
- public Scene DefaultScene => Scenes[defaultSceneIndex];
- public List<Mesh> Meshes;
- public List<Scene> Scenes;
-
- public Node FindNode(string name) {
- foreach (Scene scene in Scenes)
- {
- Node n = scene.FindNode(name);
- if (n != null)
- return n;
- }
- return null;
- }
-
- public Dimensions dimensions = new Dimensions (new Vector3 (float.MaxValue), new Vector3 (float.MinValue));
- //public struct MaterialStruct {
- // public UInt32 baseColorTexture;
- // public UInt32 metallicRoughnessTexture;
- // public UInt32 normalTexture;
- // public UInt32 occlusionTexture;
- // public UInt32 emissiveTexture;
- //}
-
-
- /// <summary>
- /// Material class with textures indices and a descriptorSet for those textures
- /// </summary>
public class Material {
public enum Workflow { PhysicalyBaseRendering = 1, SpecularGlossinnes };
public string Name;
public Workflow workflow;
public Int32 baseColorTexture;
- public Int32 metallicRoughnessTexture;
- public Int32 normalTexture;
- public Int32 occlusionTexture;
- public Int32 emissiveTexture;
+ public Int32 metallicRoughnessTexture;
+ public Int32 normalTexture;
+ public Int32 occlusionTexture;
+ public Int32 emissiveTexture;
public Vector4 baseColorFactor;
public Vector4 emissiveFactor;
public AttachmentType availableAttachments;
public AttachmentType availableAttachments1;
+
public AlphaMode alphaMode;
public float alphaCutoff;
public float metallicFactor;
@@ -232,23 +166,14 @@ namespace CVKL {
public bool metallicRoughness = true;
public bool specularGlossiness = false;
- //struct Extension {
- // vkglTF::Texture* specularGlossinessTexture;
- // vkglTF::Texture* diffuseTexture;
- // glm::vec4 diffuseFactor = glm::vec4 (1.0f);
- // glm::vec3 specularFactor = glm::vec3 (0.0f);
- //}
- //extension;
-
public Material (Int32 _baseColorTexture = -1, Int32 _metallicRoughnessTexture = -1,
- Int32 _normalTexture = -1, Int32 _occlusionTexture = -1)
- {
+ Int32 _normalTexture = -1, Int32 _occlusionTexture = -1) {
workflow = Workflow.PhysicalyBaseRendering;
- baseColorTexture = _baseColorTexture;
- metallicRoughnessTexture = _metallicRoughnessTexture;
- normalTexture = _normalTexture;
- occlusionTexture = _occlusionTexture;
- emissiveTexture = -1;
+ baseColorTexture = _baseColorTexture;
+ metallicRoughnessTexture = _metallicRoughnessTexture;
+ normalTexture = _normalTexture;
+ occlusionTexture = _occlusionTexture;
+ emissiveTexture = -1;
alphaMode = AlphaMode.Opaque;
alphaCutoff = 1f;
@@ -262,64 +187,25 @@ namespace CVKL {
}
}
+ protected Device dev;
- public struct Vertex {
- [VertexAttribute(VertexAttributeType.Position, VkFormat.R32g32b32Sfloat)]
- public Vector3 pos;
- [VertexAttribute(VertexAttributeType.Normal, VkFormat.R32g32b32Sfloat)]
- public Vector3 normal;
- [VertexAttribute(VertexAttributeType.UVs, VkFormat.R32g32Sfloat)]
- public Vector2 uv;
- public override string ToString () {
- return pos.ToString () + ";" + normal.ToString () + ";" + uv.ToString ();
- }
- };
-
- //void getSceneDimensions () {
- // // Calculate binary volume hierarchy for all nodes in the scene
- // for (auto node : linearNodes) {
- // calculateBoundingBox (node, nullptr);
- // }
-
- // dimensions.min = glm::vec3 (FLT_MAX);
- // dimensions.max = glm::vec3 (-FLT_MAX);
-
- // for (auto node : linearNodes) {
- // if (node->bvh.valid) {
- // dimensions.min = glm::min (dimensions.min, node->bvh.min);
- // dimensions.max = glm::max (dimensions.max, node->bvh.max);
- // }
- // }
-
- // // Calculate scene aabb
- // aabb = glm::scale (glm::mat4 (1.0f), glm::vec3 (dimensions.max[0] - dimensions.min[0], dimensions.max[1] - dimensions.min[1], dimensions.max[2] - dimensions.min[2]));
- // aabb[3][0] = dimensions.min[0];
- // aabb[3][1] = dimensions.min[1];
- // aabb[3][2] = dimensions.min[2];
- //}
-
- //public void calculateBoundingBox (Node node, Node parent) {
- // BoundingBox parentBvh = (parent != null) ? parent.bvh : new BoundingBox (dimensions.min, dimensions.max);
-
- // if (node.Mesh != null) {
- // if (node.Mesh.bb.valid) {
- // node.aabb = node.Mesh.bb.getAABB (node.Matrix);
- // if (node.Children == null) {
- // node.bvh.min = node.aabb.min;
- // node.bvh.max = node.aabb.max;
- // node.bvh.valid = true;
- // }
- // }
- // }
+ public VkIndexType IndexBufferType;
- // parentBvh.min = Vector3.Min (parentBvh.min, node.bvh.min);
- // parentBvh.max = Vector3.Min (parentBvh.max, node.bvh.max);
+ protected int defaultSceneIndex;
+ public Scene DefaultScene => Scenes[defaultSceneIndex];
+ public List<Mesh> Meshes;
+ public List<Scene> Scenes;
- // if (node.Children == null)
- // return;
+ public Node FindNode(string name) {
+ foreach (Scene scene in Scenes)
+ {
+ Node n = scene.FindNode(name);
+ if (n != null)
+ return n;
+ }
+ return null;
+ }
- // foreach (Node child in node.Children)
- // calculateBoundingBox (child, node);
- //}
+ public Dimensions dimensions = new Dimensions (new Vector3 (float.MaxValue), new Vector3 (float.MinValue));
}
}
diff --git a/vke/src/PbrModel.cs b/vke/src/model/PbrModel.cs
index d4b96ec..d4b96ec 100644
--- a/vke/src/PbrModel.cs
+++ b/vke/src/model/PbrModel.cs
diff --git a/vke/src/PbrModelSeparateTextures.cs b/vke/src/model/PbrModelSeparateTextures.cs
index 387f20a..ae9482f 100644
--- a/vke/src/PbrModelSeparateTextures.cs
+++ b/vke/src/model/PbrModelSeparateTextures.cs
@@ -42,7 +42,7 @@ namespace CVKL {
/// Pbr data structure suitable for push constant or ubo, containing
/// availablility of attached textures and the coef of pbr inputs
/// </summary>
- public struct Material {
+ public new struct Material {
public Vector4 baseColorFactor;
public Vector4 emissiveFactor;
public Vector4 diffuseFactor;
@@ -59,9 +59,11 @@ namespace CVKL {
Image[] textures;
public Material[] materials;
+ /// <summary>
+ /// one descriptor per material containing textures
+ /// </summary>
DescriptorSet[] descriptorSets;
-
public PbrModelSeparatedTextures (Queue transferQ, string path, DescriptorSetLayout layout, params AttachmentType[] attachments) {
dev = transferQ.Dev;
using (CommandPool cmdPool = new CommandPool (dev, transferQ.index)) {
diff --git a/vke/src/PbrModelTexArray.cs b/vke/src/model/PbrModelTexArray.cs
index b7b09e4..99c6f76 100644
--- a/vke/src/PbrModelTexArray.cs
+++ b/vke/src/model/PbrModelTexArray.cs
@@ -39,11 +39,11 @@ namespace CVKL {
/// </summary>
public class PbrModelTexArray : PbrModel {
public static uint TEXTURE_DIM = 512;
+
/// <summary>
- /// Pbr data structure suitable for push constant or ubo, containing
- /// availablility of attached textures and the coef of pbr inputs
+ /// Material structure for ubo containing texture indices in tex array
/// </summary>
- public struct Material {
+ public new struct Material {
public Vector4 baseColorFactor;
public Vector4 emissiveFactor;
public Vector4 diffuseFactor;
@@ -54,10 +54,10 @@ namespace CVKL {
public AttachmentType TexCoord1;
public int baseColorTextureSet;
- public int physicalDescriptorTextureSet;
- public int normalTextureSet;
- public int occlusionTextureSet;
- public int emissiveTextureSet;
+ public int phyDescTex;
+ public int normalTex;
+ public int aoTex;
+ public int emissiveTex;
public float metallicFactor;
public float roughnessFactor;
@@ -122,10 +122,10 @@ namespace CVKL {
roughnessFactor = mats[i].roughnessFactor,
baseColorTextureSet = mats[i].baseColorTexture,
- physicalDescriptorTextureSet = mats[i].metallicRoughnessTexture,
- normalTextureSet = mats[i].normalTexture,
- occlusionTextureSet = mats[i].occlusionTexture,
- emissiveTextureSet = mats[i].emissiveTexture,
+ phyDescTex = mats[i].metallicRoughnessTexture,
+ normalTex = mats[i].normalTexture,
+ aoTex = mats[i].occlusionTexture,
+ emissiveTex = mats[i].emissiveTexture,
TexCoord0 = mats[i].availableAttachments,
TexCoord1 = mats[i].availableAttachments1,
@@ -140,14 +140,13 @@ namespace CVKL {
public override void RenderNode (CommandBuffer cmd, PipelineLayout pipelineLayout, Node node, Matrix4x4 currentTransform, bool shadowPass = false) {
Matrix4x4 localMat = node.localMatrix * currentTransform;
- VkShaderStageFlags matStage = shadowPass ? VkShaderStageFlags.Geometry : VkShaderStageFlags.Vertex;
- cmd.PushConstant (pipelineLayout, matStage, localMat);
+
+ cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Vertex, localMat);
if (node.Mesh != null) {
foreach (Primitive p in node.Mesh.Primitives) {
- if (!shadowPass) {
+ if (!shadowPass)
cmd.PushConstant (pipelineLayout, VkShaderStageFlags.Fragment, (int)p.material, (uint)Marshal.SizeOf<Matrix4x4> ());
- }
cmd.DrawIndexed (p.indexCount, 1, p.indexBase, p.vertexBase, 0);
}
}
diff --git a/vke/src/glTFLoader.cs b/vke/src/model/glTFLoader.cs
index d21ff61..d21ff61 100644
--- a/vke/src/glTFLoader.cs
+++ b/vke/src/model/glTFLoader.cs