Alpha Blending

This commit is contained in:
Isuru Samarathunga
2025-09-14 08:29:57 +05:30
parent 4f4f25e165
commit 9ed9f83558

View File

@ -39,7 +39,16 @@ namespace ia::iae
const auto pixelShader = LoadShaderFromMemory(ShaderStage::PIXEL, SHADER_SOURCE_UNLITMESH_FRAG, sizeof(SHADER_SOURCE_UNLITMESH_FRAG), 1, 1, 0, 0);
SDL_GPUColorTargetDescription colorTargets[] = {
{.format = SDL_GetGPUSwapchainTextureFormat(g_gpuDevice, g_windowHandle)}};
{.format = SDL_GetGPUSwapchainTextureFormat(g_gpuDevice, g_windowHandle),
.blend_state = SDL_GPUColorTargetBlendState{
.src_color_blendfactor = SDL_GPU_BLENDFACTOR_ONE,
.dst_color_blendfactor = SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.color_blend_op = SDL_GPU_BLENDOP_ADD,
.src_alpha_blendfactor = SDL_GPU_BLENDFACTOR_ONE,
.dst_alpha_blendfactor = SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.alpha_blend_op = SDL_GPU_BLENDOP_ADD,
.enable_blend = true,
}}};
SDL_GPUVertexBufferDescription vertexBuffers[] = {{
.slot = 0,
.pitch = sizeof(Vertex_Mesh),