sponza up in the crib

This commit is contained in:
Halbear 2026-06-07 23:01:16 +01:00
parent a8adf662ff
commit f725d12810
75 changed files with 8585 additions and 5 deletions

View file

@ -44,6 +44,10 @@ public class GameCore implements GameLogic {
Scene scene = engineInstance.scene();
List<ModelData> models = new ArrayList<>();
ModelData SponzaData = ModelLoader.LoadModel("resources/models/Sponza/Sponza.json");
List<MaterialData> SponzaMaterial = ModelLoader.LoadMaterials("resources/models/Sponza/Sponza_mat.json");
scene.AddActor(new Actor("Sponza", SponzaData.ID(), new Vector3f(0,0,-5f)));
models.add(ModelLoader.LoadModel("resources/models/Metro/OBJ/MetroLeadCar.json"));
models.add(ModelLoader.LoadModel("resources/models/Corvette/CorvetteOBJ.json"));
//models.add(ModelLoader.LoadModel("resources/models/Sloop/SloopOBJ.json"));
@ -63,7 +67,8 @@ public class GameCore implements GameLogic {
materials.addAll(ModelLoader.LoadMaterials("resources/models/Sloop/SloopOBJ_mat.json"));
materials.addAll(ModelLoader.LoadMaterials("resources/models/melona/melona_mat.json"));
materials.addAll(ModelLoader.LoadMaterials("resources/models/Alice/Welsh040Alice_mat.json"));
materials.addAll(SponzaMaterial);
models.add(SponzaData);
Camera camera = scene.GetCamera();
camera.SetPosition(0.0f, 0.0f, 0.0f);
camera.SetRotation((float) Math.toRadians(0.0f), (float) Math.toRadians(0.0f),0);

View file

@ -72,6 +72,7 @@ public class SceneRender {//dynamic rendering
private static final String VERTEX_SHADER_FILE_SPV = VERTEX_SHADER_FILE_GLSL + ".spv";
private final VulkanBuffer[] BufferViewMatrices;
private final Pipeline VkPipeline;
private Matrix4f ProjectionMatrix;
public SceneRender(VulkanContext vulkanContext){
ClearValueColour = VkClearValue.calloc().color(
@ -90,6 +91,7 @@ public class SceneRender {//dynamic rendering
0,1,VK_SHADER_STAGE_VERTEX_BIT));
BufferProjectionMatrix = VulkanUtils.CreateHostVisibleBuffer(vulkanContext, VulkanUtils.MATRIX4X4_SIZE,
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, DESCRIPTOR_ID_PRJ, descriptorLayoutVertexUniform);
ProjectionMatrix = PrimaryRuntime.GetEngineInstance().scene().GetProjection().GetProjectionMatrix();
VulkanUtils.CopyMatrixToBuffer(vulkanContext, BufferProjectionMatrix, PrimaryRuntime.GetEngineInstance().scene().GetProjection().GetProjectionMatrix(),0);
descriptorLayoutFragStorage = new DescriptorSetLayout(vulkanContext, new DescriptorSetLayout.LayoutInformation(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
0,1,VK_SHADER_STAGE_FRAGMENT_BIT));
@ -233,7 +235,7 @@ public class SceneRender {//dynamic rendering
.offset(it->it.x(0).y(0));
vkCmdSetScissor(CommandHandle, 0, Scissor);
VulkanUtils.CopyMatrixToBuffer(vulkanContext, BufferViewMatrices[CurrentFrame],engineInstance.scene().GetCamera().GetViewMatrix(), 0);
VulkanUtils.CopyMatrixToBuffer(vulkanContext, BufferViewMatrices[CurrentFrame],engineInstance.scene().GetCamera().GetViewMatrix(), 0); // here
DescriptorAllocator descriptorAllocator = vulkanContext.GetDescriptorAllocator();
LongBuffer DescriptorSets = MemStack.mallocLong(4)
.put(0,descriptorAllocator.GetDescriptorSet(DESCRIPTOR_ID_PRJ).GetVkDescriptorSet())

View file

@ -26,8 +26,9 @@ ShaderRecompiling = true
#Vulkan Debugging toggle
vkValidated=true
vsync=false
#Vsync images
#Swap Chain Images
RequestedImages=3
DefaultTexturePath=resources/EngineResources/Texture/DefaultTexture.png
#This is the name of the GPU you want the engine to use
PhysicalDeviceName=
@ -35,4 +36,3 @@ PhysicalDeviceName=
field_of_view=60.0f
z_near_plane=1.0f
z_far_plane=100.0f