Commit e288866e authored by chili's avatar chili
Browse files

fun with pointers

parent 84403d53
......@@ -25,5 +25,5 @@ private:
float speed_factor = 1.0f;
Camera cam;
PointLight light;
Model nano{ wnd.Gfx(),"Models\\nano_hierarchy.gltf" };
Model nano{ wnd.Gfx(),"Models\\nano_textured\\nanosuit.obj" };
};
\ No newline at end of file
......@@ -212,7 +212,7 @@ Model::Model( Graphics& gfx,const std::string fileName )
for( size_t i = 0; i < pScene->mNumMeshes; i++ )
{
meshPtrs.push_back( ParseMesh( gfx,*pScene->mMeshes[i] ) );
meshPtrs.push_back( ParseMesh( gfx,*pScene->mMeshes[i],pScene->mMaterials ) );
}
int nextId = 0;
......@@ -236,7 +236,7 @@ void Model::ShowWindow( const char* windowName ) noexcept
Model::~Model() noexcept
{}
std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh )
std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const aiMaterial* const* pMaterials )
{
using Dvtx::VertexLayout;
......@@ -246,6 +246,8 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh )
.Append( VertexLayout::Normal )
) );
auto& material = *pMaterials[mesh.mMaterialIndex];
for( unsigned int i = 0; i < mesh.mNumVertices; i++ )
{
vbuf.EmplaceBack(
......
......@@ -58,7 +58,7 @@ public:
void ShowWindow( const char* windowName = nullptr ) noexcept;
~Model() noexcept;
private:
static std::unique_ptr<Mesh> ParseMesh( Graphics& gfx,const aiMesh& mesh );
static std::unique_ptr<Mesh> ParseMesh( Graphics& gfx,const aiMesh& mesh,const aiMaterial* const* pMaterials );
std::unique_ptr<Node> ParseNode( int& nextId,const aiNode& node ) noexcept;
private:
std::unique_ptr<Node> pRoot;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment