Commit 374f508f authored by chili's avatar chili
Browse files

loading diffuse textures

parent 55aefc03
...@@ -8,3 +8,5 @@ ...@@ -8,3 +8,5 @@
#include "TransformCbuf.h" #include "TransformCbuf.h"
#include "VertexBuffer.h" #include "VertexBuffer.h"
#include "VertexShader.h" #include "VertexShader.h"
#include "Texture.h"
#include "Sampler.h"
\ No newline at end of file
#include "Mesh.h" #include "Mesh.h"
#include "imgui/imgui.h" #include "imgui/imgui.h"
#include "Surface.h"
#include <unordered_map> #include <unordered_map>
#include <sstream> #include <sstream>
...@@ -246,13 +247,6 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a ...@@ -246,13 +247,6 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
.Append( VertexLayout::Normal ) .Append( VertexLayout::Normal )
) ); ) );
auto& material = *pMaterials[mesh.mMaterialIndex];
for( int i = 0; i < material.mNumProperties; i++ )
{
auto& prop = *material.mProperties[i];
int qqq = 90;
}
for( unsigned int i = 0; i < mesh.mNumVertices; i++ ) for( unsigned int i = 0; i < mesh.mNumVertices; i++ )
{ {
vbuf.EmplaceBack( vbuf.EmplaceBack(
...@@ -274,6 +268,16 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a ...@@ -274,6 +268,16 @@ std::unique_ptr<Mesh> Model::ParseMesh( Graphics& gfx,const aiMesh& mesh,const a
std::vector<std::unique_ptr<Bind::Bindable>> bindablePtrs; std::vector<std::unique_ptr<Bind::Bindable>> bindablePtrs;
if( mesh.mMaterialIndex >= 0 )
{
using namespace std::string_literals;
auto& material = *pMaterials[mesh.mMaterialIndex];
aiString texFileName;
material.GetTexture( aiTextureType_DIFFUSE,0,&texFileName );
bindablePtrs.push_back( std::make_unique<Bind::Texture>( gfx,Surface::FromFile( "Models\\nano_textured\\"s + texFileName.C_Str() ) ) );
bindablePtrs.push_back( std::make_unique<Bind::Sampler>( gfx ) );
}
bindablePtrs.push_back( std::make_unique<Bind::VertexBuffer>( gfx,vbuf ) ); bindablePtrs.push_back( std::make_unique<Bind::VertexBuffer>( gfx,vbuf ) );
bindablePtrs.push_back( std::make_unique<Bind::IndexBuffer>( gfx,indices ) ); bindablePtrs.push_back( std::make_unique<Bind::IndexBuffer>( gfx,indices ) );
......
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