rename biliear_sampler to pixel sampler and remove point_sampler
This commit is contained in:
parent
944c00b89e
commit
e87a66b984
28
src/main.cpp
28
src/main.cpp
@ -28,8 +28,7 @@ static SDL_Window *window;
|
||||
|
||||
static SDL_GPUGraphicsPipeline *basic_graphics_pipeline;
|
||||
static SDL_GPUGraphicsPipeline *world_graphics_pipeline;
|
||||
static SDL_GPUSampler *point_sampler;
|
||||
static SDL_GPUSampler *bilinear_sampler;
|
||||
static SDL_GPUSampler *pixel_sampler;
|
||||
|
||||
static SDL_GPUBuffer *vertex_buffer;
|
||||
static SDL_GPUBuffer *index_buffer;
|
||||
@ -933,23 +932,7 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_GPUSamplerCreateInfo point_sampler_info = {
|
||||
.min_filter = SDL_GPU_FILTER_NEAREST,
|
||||
.mag_filter = SDL_GPU_FILTER_NEAREST,
|
||||
.mipmap_mode = SDL_GPU_SAMPLERMIPMAPMODE_NEAREST,
|
||||
|
||||
.address_mode_u = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE,
|
||||
.address_mode_v = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE,
|
||||
.address_mode_w = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE,
|
||||
|
||||
.max_anisotropy = 4.0f,
|
||||
.enable_anisotropy = true,
|
||||
};
|
||||
|
||||
point_sampler = SDL_CreateGPUSampler(device, &point_sampler_info);
|
||||
SDL_GPUTextureSamplerBinding tile_atlas_texture_binding = { .texture = tile_atlas_texture, .sampler = point_sampler };
|
||||
|
||||
SDL_GPUSamplerCreateInfo bilinear_sampler_info = {
|
||||
SDL_GPUSamplerCreateInfo pixel_sampler_info = {
|
||||
.min_filter = SDL_GPU_FILTER_LINEAR,
|
||||
.mag_filter = SDL_GPU_FILTER_LINEAR,
|
||||
.mipmap_mode = SDL_GPU_SAMPLERMIPMAPMODE_LINEAR,
|
||||
@ -962,7 +945,8 @@ int main(int argc, char **argv) {
|
||||
.enable_anisotropy = true,
|
||||
};
|
||||
|
||||
bilinear_sampler = SDL_CreateGPUSampler(device, &bilinear_sampler_info);
|
||||
pixel_sampler = SDL_CreateGPUSampler(device, &pixel_sampler_info);
|
||||
SDL_GPUTextureSamplerBinding tile_atlas_texture_binding = { .texture = tile_atlas_texture, .sampler = pixel_sampler };
|
||||
|
||||
vertex_buffer = create_buffer(SDL_GPU_BUFFERUSAGE_VERTEX, sizeof(vertices), vertices, "vertex_buffer");
|
||||
if (!vertex_buffer) {
|
||||
@ -1357,7 +1341,7 @@ int main(int argc, char **argv) {
|
||||
{ .buffer = world_buffer, .offset = 0 },
|
||||
};
|
||||
SDL_GPUTextureSamplerBinding texture_bindings[] = {
|
||||
{ .texture = tile_atlas_texture, .sampler = bilinear_sampler },
|
||||
{ .texture = tile_atlas_texture, .sampler = pixel_sampler },
|
||||
};
|
||||
|
||||
SDL_BindGPUGraphicsPipeline(render_pass, world_graphics_pipeline);
|
||||
@ -1375,7 +1359,7 @@ int main(int argc, char **argv) {
|
||||
{ .buffer = player_instance_buffer, .offset = 0 },
|
||||
};
|
||||
SDL_GPUTextureSamplerBinding texture_bindings[] = {
|
||||
{ .texture = player_texture, .sampler = bilinear_sampler },
|
||||
{ .texture = player_texture, .sampler = pixel_sampler },
|
||||
};
|
||||
|
||||
SDL_BindGPUGraphicsPipeline(render_pass, basic_graphics_pipeline);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user