Files
lity3d/Engine/Rendering/texture.h
T
shuiyu1123 2d56cb3bc9 MiMoEngine ASM: x86-64 MASM汇编+C混合架构游戏引擎
核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2)
外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言
含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
2026-07-10 19:20:40 +08:00

38 lines
1.1 KiB
C

#pragma once
// ============================================================================
// texture.h - 纹理加载 (WIC)
// ============================================================================
#include <d3d11.h>
#include <stdint.h>
typedef struct {
ID3D11Texture2D* texture;
ID3D11ShaderResourceView* srv;
uint32_t width;
uint32_t height;
uint32_t mip_levels;
} Texture;
// 创建/销毁
Texture* texture_create(void);
void texture_destroy(Texture* texture);
// 从文件加载
Texture* texture_load_from_file(ID3D11Device* device, const char* path);
// 从内存加载
Texture* texture_load_from_memory(ID3D11Device* device,
const uint8_t* data, uint32_t size);
// 创建纯色纹理
Texture* texture_create_solid(ID3D11Device* device, uint32_t w, uint32_t h,
uint8_t r, uint8_t g, uint8_t b, uint8_t a);
// 创建棋盘格
Texture* texture_create_checkerboard(ID3D11Device* device, uint32_t size, uint32_t checks);
// 绑定
void texture_bind(Texture* texture, ID3D11DeviceContext* ctx, uint32_t slot);