rename Tree to placeable and dynamically load size
add stone variants as placeables
This commit is contained in:
+10
-8
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user