From 79e92395f8ce3d92c446e3bb3250d19ce33decd5 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 16 Apr 2021 10:34:26 -0700 Subject: Update `model-viewer` example and fixing compiler bugs. (#1795) --- tools/platform/model.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'tools/platform/model.cpp') diff --git a/tools/platform/model.cpp b/tools/platform/model.cpp index 54c171e54..fadfcc0e2 100644 --- a/tools/platform/model.cpp +++ b/tools/platform/model.cpp @@ -20,7 +20,10 @@ #include #include -namespace gfx { +namespace platform { + +using namespace gfx; +using namespace Slang; // TinyObj provides a tuple type that bundles up indices, but doesn't // provide equality comparison or hashing for that type. We'd like @@ -70,11 +73,11 @@ bool operator==(SmoothingGroupVertexID const& left, SmoothingGroupVertexID const namespace std { - template<> struct hash + template<> struct hash { - size_t operator()(gfx::ObjIndexKey const& key) const + size_t operator()(platform::ObjIndexKey const& key) const { - gfx::Hasher hasher; + platform::Hasher hasher; hasher.add(key.index.vertex_index); hasher.add(key.index.normal_index); hasher.add(key.index.texcoord_index); @@ -82,11 +85,11 @@ namespace std } }; - template<> struct hash + template <> struct hash { - size_t operator()(gfx::SmoothingGroupVertexID const& id) const + size_t operator()(platform::SmoothingGroupVertexID const& id) const { - gfx::Hasher hasher; + platform::Hasher hasher; hasher.add(id.smoothingGroup); hasher.add(id.positionID); return hasher.state; @@ -94,7 +97,7 @@ namespace std }; } -namespace gfx +namespace platform { ComPtr loadTextureImage( @@ -202,7 +205,7 @@ static std::string makeString(const char* start, const char* end) return std::string(start, size_t(end - start)); } -Result ModelLoader::load( +SlangResult ModelLoader::load( char const* inputPath, void** outModel) { -- cgit v1.2.3