1 Star 0 Fork 0

2144/dut

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Mesh.h 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
2144 提交于 2024-07-07 17:44 . s
#pragma once
#include "dut/WinMin.h"
#include "dut/DXTrace.h"
using namespace Microsoft::WRL;
namespace Dut
{
struct MeshIndice
{
ComPtr<ID3D11Buffer> m_pVertexBuffer;
ComPtr<ID3D11Buffer> m_pIndexBuffer;
DXGI_FORMAT m_IndiceType;
unsigned int m_VertexStride;
unsigned int m_NumIndices;
struct Desc
{
const void* vertices;
unsigned int vertexStride;
unsigned int vertexSize;
const void* indices;
unsigned int indiceStride;
unsigned int indiceSize;
unsigned int numIndices;
};
template<typename VertexType, typename IndiceType>
HRESULT Create(ID3D11Device* device,const std::vector<VertexType>& vertices, const std::vector<IndiceType>& indices)
{
Desc desc;
desc.vertices = &vertices[0];
desc.vertexStride = sizeof(VertexType);
desc.vertexSize = sizeof(VertexType) * vertices.size();
desc.indices = &indices[0];
desc.numIndices = indices.size();
desc.indiceStride = sizeof(IndiceType);
desc.indiceSize = indices.size() * sizeof(IndiceType);
return Create(device, desc);
}
HRESULT Create(ID3D11Device* device,const Desc& desc);
void DrawIndexed(ID3D11DeviceContext* context);
private:
DXGI_FORMAT GetIndiceType(const int& sz);
};
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/iamherer/dut.git
git@gitee.com:iamherer/dut.git
iamherer
dut
dut
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385