From 5bad17d281fcfea05c6f2e77c57657b41993879e Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 15 Jun 2019 21:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Assimp=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/AssimpLoaderMesh.cpp | 30 +++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/example/Vulkan/AssimpLoaderMesh.cpp b/example/Vulkan/AssimpLoaderMesh.cpp index 346d616b..175913e8 100644 --- a/example/Vulkan/AssimpLoaderMesh.cpp +++ b/example/Vulkan/AssimpLoaderMesh.cpp @@ -46,8 +46,7 @@ namespace const Color4f COLOR_PURE_BLACK(0,0,0,1); const Color4f COLOR_PURE_WHITE(1,1,1,1); - inline const vec pos_to_vec(const aiVector3D &v3d){return vec(v3d.x,-v3d.z,v3d.y,1.0);} - inline const vec dir_to_vec(const aiVector3D &v3d){return vec(v3d.x,-v3d.z,v3d.y,0.0);} + inline const vec pos_to_vec(const aiVector3D &v3d){return vec(v3d.x,-v3d.y,v3d.z,1.0);} void VecY2Z(List &target,const aiVector3D *source,const uint count) { @@ -60,8 +59,27 @@ namespace for(uint i=0;ix= source->x; - tp->y=-source->z; - tp->z= source->y; + tp->y=-source->y; + tp->z= source->z; + + ++source; + ++tp; + } + } + + void VecCopy(List &target,const aiVector3D *source,const uint count) + { + target.SetCount(count); + + if(count<=0)return; + + Vector3f *tp=target.GetData(); + + for(uint i=0;ix=source->x; + tp->y=source->y; + tp->z=source->z; ++source; ++tp; @@ -243,8 +261,8 @@ private: if(mesh->HasTangentsAndBitangents()) { - VecY2Z(md->tangent, mesh->mTangents, mesh->mNumVertices); - VecY2Z(md->bitangent, mesh->mBitangents, mesh->mNumVertices); + VecCopy(md->tangent, mesh->mTangents, mesh->mNumVertices); + VecCopy(md->bitangent, mesh->mBitangents, mesh->mNumVertices); } }