voxels
This commit is contained in:
parent
3613c03085
commit
6fe9c0f4c2
7 changed files with 262 additions and 13 deletions
17
main.cpp
17
main.cpp
|
|
@ -31,8 +31,8 @@ import Crafter.Event;
|
|||
import Crafter.Math;
|
||||
using namespace Crafter;
|
||||
|
||||
typedef VulkanShader<"MeshShaderHeightmapRGBA.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT, 2, {{{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0}, {VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1}}}> MeshVulkanShader;
|
||||
typedef VulkanShader<"FragmentShaderVertexColor.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT, 0, {}> FragmentShader;
|
||||
typedef VulkanShader<"MeshShaderMixedVoxelGrid.spirv", "main", VK_SHADER_STAGE_MESH_BIT_EXT, 2, {{{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 0}, {VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1}}}> MeshVulkanShader;
|
||||
typedef VulkanShader<"FragmentShaderSolidWhite.spirv", "main", VK_SHADER_STAGE_FRAGMENT_BIT, 0, {}> FragmentShader;
|
||||
typedef VulkanPipeline<MeshVulkanShader, FragmentShader> Pipeline;
|
||||
|
||||
int main() {
|
||||
|
|
@ -44,21 +44,16 @@ int main() {
|
|||
WindowWaylandVulkan window("Crafter.Graphics", 1280, 720);
|
||||
|
||||
Camera camera(1.57079633, 1280.0f / 720.0f, 0.01, 512);
|
||||
camera.view = MatrixRowMajor<float, 4, 4, 1>::Translation(0, 2, -10);
|
||||
camera.view = MatrixRowMajor<float, 4, 4, 1>::Translation(0, 0, 10);
|
||||
camera.Update();
|
||||
VkCommandBuffer cmd = window.StartInit();
|
||||
|
||||
|
||||
DescriptorSet<MeshVulkanShader, FragmentShader> descriptors;
|
||||
HeightmapShader<HeightRGBA> meshShader(4, 2, 1, &camera);
|
||||
for(uint32_t i = 0; i < 1*1*4*64; i++) {
|
||||
meshShader.heights.value[i].height = -0.5;
|
||||
meshShader.heights.value[i].r = 255;
|
||||
meshShader.heights.value[i].g = 255;
|
||||
meshShader.heights.value[i].b = 255;
|
||||
meshShader.heights.value[i].a = 255;
|
||||
VoxelShader<uint> meshShader(1, 4, 4, &camera);
|
||||
for(uint32_t i = 0; i < 16; i++) {
|
||||
meshShader.grid.value[i] = 1;
|
||||
}
|
||||
|
||||
meshShader.WriteDescriptors(descriptors.set[0]);
|
||||
meshShader.Update();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue