Pre-multiply V and P matrices
This commit is contained in:
1 parent
e7f4f4b51d
commit
2cf4f6832d
5 files changed
+21
-25
No files matched your search
@@ -496,7 +496,7 @@ void gpu_init(gpu_ctx_t *ctx, GLFWwindow *window, const char *name)
|
||||
const VkPushConstantRange push_constant_range = {
|
||||
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
|
||||
.offset = 0,
|
||||
.size = sizeof(vp_t),
|
||||
.size = sizeof(mat4_t),
|
||||
};
|
||||
|
||||
// Load vertex and fragment shader modules
|
||||
@@ -956,7 +956,7 @@ void gpu_model_cleanup(const gpu_ctx_t *ctx, const gpu_model_t *model)
|
||||
}
|
||||
|
||||
void gpu_render(
|
||||
const gpu_ctx_t *ctx, vp_t vp, size_t model_count,
|
||||
const gpu_ctx_t *ctx, mat4_t vp, size_t model_count,
|
||||
const gpu_model_t *models, const mat4_t **bone_matrices,
|
||||
const mat4_t *model_transforms)
|
||||
{
|
||||
@@ -1001,7 +1001,7 @@ void gpu_render(
|
||||
ctx->cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->floor_pipeline);
|
||||
vkCmdPushConstants(
|
||||
ctx->cmd_buf, ctx->model_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT,
|
||||
0, sizeof(vp_t), &vp);
|
||||
0, sizeof(mat4_t), &vp);
|
||||
vkCmdDraw(ctx->cmd_buf, 4, 1, 0, 0);
|
||||
|
||||
// Draw models
|
||||
@@ -1009,7 +1009,7 @@ void gpu_render(
|
||||
ctx->cmd_buf, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->model_pipeline);
|
||||
vkCmdPushConstants(
|
||||
ctx->cmd_buf, ctx->model_pipeline_layout, VK_SHADER_STAGE_VERTEX_BIT,
|
||||
0, sizeof(vp_t), &vp);
|
||||
0, sizeof(mat4_t), &vp);
|
||||
for (unsigned i = 0; i < model_count; ++i) {
|
||||
models[i].transform_ptr[curr_img] = model_transforms[i];
|
||||
memcpy(
|
||||
|
||||
Reference in new issue
Block a user