mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
[vulkan] Implement alias model texturing
I had messed up my index array creation, but once that was fixed the textures worked well other than a lot of pixels are shades of grey due to being in the top or bottom color map range.
This commit is contained in:
parent
64904e2b27
commit
28652c4d59
3 changed files with 16 additions and 12 deletions
|
@ -300,12 +300,13 @@ Vulkan_Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m,
|
|||
}
|
||||
|
||||
// now build the indices for DrawElements
|
||||
for (i = 0; i < hdr->mdl.numverts; i++) {
|
||||
indexmap[i] = indexmap[i] != -1 ? indexmap[i] : i;
|
||||
}
|
||||
for (i = 0; i < numtris; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
indices[3 * i + j] = indexmap[triangles.a[i].vertindex[j]];
|
||||
int vind = triangles.a[i].vertindex[j];
|
||||
if (stverts.a[vind].onseam && !triangles.a[i].facesfront) {
|
||||
vind = indexmap[vind];
|
||||
}
|
||||
indices[3 * i + j] = vind;
|
||||
}
|
||||
}
|
||||
// finished with indexmap
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#version 450
|
||||
layout (set = 0, binding = 2) uniform sampler2D Texture;
|
||||
layout (set = 0, binding = 3) uniform sampler2D GlowMap;
|
||||
layout (set = 0, binding = 4) uniform sampler2D ColorA;
|
||||
layout (set = 0, binding = 5) uniform sampler2D ColorB;
|
||||
/*
|
||||
layout (set = 2, binding = 0) uniform sampler2D Texture;
|
||||
layout (set = 2, binding = 1) uniform sampler2D GlowMap;
|
||||
|
@ -38,11 +42,10 @@ main (void)
|
|||
vec4 c;
|
||||
int i;
|
||||
vec3 light = vec3 (0);
|
||||
/*
|
||||
c = texture (Texture, st);
|
||||
c += texture (ColorA, st);
|
||||
c += texture (ColorB, st);
|
||||
c += texture (GlowMap, st);
|
||||
/*
|
||||
if (MaxLights > 0) {
|
||||
for (i = 0; i < light_count; i++) {
|
||||
vec3 dist = lights[i].position - position;
|
||||
|
@ -51,7 +54,9 @@ main (void)
|
|||
light += lights[i].color * mag * lights[i].dist / dd;
|
||||
}
|
||||
}
|
||||
frag_color = c * vec4(light, 1);//fogBlend (c);
|
||||
c *= vec4 (light, 1);
|
||||
*/
|
||||
frag_color = vec4((normal + 1)/2, 1);
|
||||
c += texture (GlowMap, st);
|
||||
//frag_color = vec4((normal + 1)/2, 1);
|
||||
frag_color = c;//fogBlend (c);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,6 @@ Vulkan_DrawAlias (struct entity_s *ent, struct vulkan_ctx_s *ctx)
|
|||
dfunc->vkCmdPushConstants (aframe->cmd, actx->layout,
|
||||
VK_SHADER_STAGE_VERTEX_BIT,
|
||||
64, sizeof (float), &blend);
|
||||
if (0) {
|
||||
aframe->imageInfo[0].imageView = get_view (skin->tex, ctx->default_white);
|
||||
aframe->imageInfo[1].imageView = get_view (skin->glow, ctx->default_black);
|
||||
aframe->imageInfo[2].imageView = get_view (skin->colora,
|
||||
|
@ -133,10 +132,9 @@ Vulkan_DrawAlias (struct entity_s *ent, struct vulkan_ctx_s *ctx)
|
|||
dfunc->vkCmdPushDescriptorSetKHR (aframe->cmd,
|
||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
actx->layout,
|
||||
ALIAS_BUFFER_INFOS, ALIAS_IMAGE_INFOS,
|
||||
0, ALIAS_IMAGE_INFOS,
|
||||
aframe->descriptors
|
||||
+ ALIAS_BUFFER_INFOS);
|
||||
}
|
||||
dfunc->vkCmdDrawIndexed (aframe->cmd, 3 * hdr->mdl.numtris, 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -303,7 +301,7 @@ Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
|||
aframe->imageInfo[j].sampler = actx->sampler;
|
||||
int k = j + ALIAS_BUFFER_INFOS;
|
||||
aframe->descriptors[k] = base_image_write;
|
||||
aframe->descriptors[k].dstBinding = j;
|
||||
aframe->descriptors[k].dstBinding = k;
|
||||
aframe->descriptors[k].pImageInfo = &aframe->imageInfo[j];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue