rename Tree to placeable and dynamically load size
buildbot/windows Build done.
buildbot/linux Build done.

add stone variants as placeables
This commit is contained in:
Sven Balzer
2026-08-06 19:45:47 +02:00
parent ff82f59fdf
commit ecd6571785
9 changed files with 204 additions and 185 deletions
+10 -8
View File
@@ -971,9 +971,9 @@ bool renderer_init(SDL_Window *window_) {
wgpuShaderModuleRelease(shader);
}
{ // Tree
{ // Placeable
const char shader_source[] = {
#embed "shaders/wgsl/tree.wgsl"
#embed "shaders/wgsl/placeable.wgsl"
};
WGPUShaderModule shader = wgpuDeviceCreateShaderModule(device, &(WGPUShaderModuleDescriptor){
@@ -981,19 +981,21 @@ bool renderer_init(SDL_Window *window_) {
.chain = { .next = NULL, .sType = WGPUSType_ShaderSourceWGSL },
.code = { .data = shader_source, .length = SDL_arraysize(shader_source) },
},
.label = { .data = "tree shader", .length = WGPU_STRLEN }
.label = { .data = "placeable shader", .length = WGPU_STRLEN }
});
shaders[R_SHADER_TREE] = wgpuDeviceCreateRenderPipeline(device, &(WGPURenderPipelineDescriptor){
.label = { .data = "tree render_pipeline", .length = WGPU_STRLEN },
shaders[R_SHADER_PLACEABLE] = wgpuDeviceCreateRenderPipeline(device, &(WGPURenderPipelineDescriptor){
.label = { .data = "placeable render_pipeline", .length = WGPU_STRLEN },
.layout = wgpuDeviceCreatePipelineLayout(device, &(WGPUPipelineLayoutDescriptor){
.label = { .data = "tree pipeline_layout", .length = WGPU_STRLEN },
.label = { .data = "placeable pipeline_layout", .length = WGPU_STRLEN },
.bindGroupLayoutCount = 4,
.bindGroupLayouts = (WGPUBindGroupLayout[]){
wgpuDeviceCreateBindGroupLayout(device, &(WGPUBindGroupLayoutDescriptor){
.entryCount = 0,
.entries = (WGPUBindGroupLayoutEntry[]){},
.entryCount = 1,
.entries = (WGPUBindGroupLayoutEntry[]){
{ .binding = 0, .visibility = WGPUShaderStage_Vertex, .buffer = { .type = WGPUBufferBindingType_ReadOnlyStorage } },
},
}),
wgpuDeviceCreateBindGroupLayout(device, &(WGPUBindGroupLayoutDescriptor){
.entryCount = 2,