fix: simplify mesh_draw, game_test projection fix

- mesh_draw: removed redundant ib null check
- game_test: cubes moved to z=0.3-0.8 (within near/far range)
- raw3d_test verified 3D rendering works correctly
This commit is contained in:
shuiyu1123 committed 2026-07-11 15:01:40 +08:00
1 parent ee097260ed
commit 4572bf9241
1 file changed
+2 -6
+2 -6
View File
@@ -35,12 +35,8 @@ void mesh_destroy(Mesh* m) {
void mesh_draw(Mesh* m, ID3D11DeviceContext* ctx) {
UINT stride = m->stride, offset = 0;
ctx->lpVtbl->IASetVertexBuffers(ctx, 0, 1, &m->vb, &stride, &offset);
if (m->ib) {
ctx->lpVtbl->IASetIndexBuffer(ctx, m->ib, DXGI_FORMAT_R32_UINT, 0);
ctx->lpVtbl->DrawIndexed(ctx, m->icount, 0, 0);
} else {
ctx->lpVtbl->Draw(ctx, m->vcount, 0);
}
ctx->lpVtbl->IASetIndexBuffer(ctx, m->ib, DXGI_FORMAT_R32_UINT, 0);
ctx->lpVtbl->DrawIndexed(ctx, m->icount, 0, 0);
}
Mesh* mesh_create_cube(ID3D11Device* dev) {