Files
lity3d/Engine/Asset/mesh.h
T

31 lines
932 B
C

#pragma once
// ============================================================================
// mesh.h - 网格 (顶点缓冲 + 索引缓冲)
// ============================================================================
#include <d3d11.h>
#include <stdint.h>
typedef struct {
ID3D11Buffer* vertex_buffer;
ID3D11Buffer* index_buffer;
uint32_t vertex_count;
uint32_t index_count;
uint32_t vertex_stride;
} MeshBuffer;
// 从内存数据创建网格
MeshBuffer* mesh_create(ID3D11Device* device,
const void* vertices, uint32_t vertex_count, uint32_t vertex_stride,
const uint32_t* indices, uint32_t index_count);
// 从 OBJ 文件加载网格 (简化版: 仅顶点+面)
MeshBuffer* mesh_load_obj(ID3D11Device* device, const char* filepath);
// 销毁
void mesh_destroy(MeshBuffer* mesh);
// 绘制
void mesh_draw(ID3D11DeviceContext* ctx, MeshBuffer* mesh);