-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicModel.cpp
More file actions
executable file
·31 lines (23 loc) · 923 Bytes
/
BasicModel.cpp
File metadata and controls
executable file
·31 lines (23 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "BasicModel.h"
#include "LoadM3d.h"
BasicModel::BasicModel(ID3D11Device* device, TextureMgr& texMgr, const std::string& modelFilename, const std::wstring& texturePath)
{
std::vector<M3dMaterial> mats;
LoadM3der m3dLoader;
m3dLoader.LoadM3d(modelFilename, Vertices,Indices,Subsets,mats);
ModelMesh.SetVertices(device,&Vertices[0], Vertices.size());
ModelMesh.SetIndices(device,&Indices[0], Indices.size());
ModelMesh.SetSubsetTable(Subsets);
SubsetCount = mats.size();
for (UINT i = 0; i < SubsetCount; i++)
{
Mat.push_back(mats[i].Mat);
ID3D11ShaderResourceView* diffuseMapSRV = texMgr.CreateTexture(texturePath + mats[i].DiffuseMapName);
DiffuseMapSRV.push_back(diffuseMapSRV);
ID3D11ShaderResourceView* normalMapSRV = texMgr.CreateTexture(texturePath + mats[i].NormalMapName);
NormalMapSRV.push_back(normalMapSRV);
}
}
BasicModel::~BasicModel(void)
{
}