OSDN Git Service

OBJ読み込み処理 若干の高速化
authorqw_fuku <fkhideaki@gmail.com>
Sat, 16 Jul 2016 12:35:13 +0000 (21:35 +0900)
committerqw_fuku <fkhideaki@gmail.com>
Sat, 16 Jul 2016 12:35:13 +0000 (21:35 +0900)
Src/LibQtGeoViewerCore/Format/Obj/ObjMesh.h
Src/LibQtGeoViewerCore/Format/Obj/ObjMeshIO.cpp
Src/LibQtGeoViewerCore/Format/Obj/ObjMeshIO.h

index 6a29f44..179d615 100644 (file)
@@ -186,6 +186,7 @@ protected:
 
 public:
        std::vector<lm::vec3f> m_Verts;
+       std::vector<lib_graph::color3b> m_Col;
        std::vector<lm::vec3f> m_Normals;
        std::vector<lm::vec2f> m_UVs;
 
index f03e8ca..53f23b2 100644 (file)
@@ -29,27 +29,6 @@ namespace lib_geo
 {
 
 
-inline float ReadNextFloat(istream& ist)
-{
-       string s;
-       ist >> s;
-       return (float)atof(s.c_str());
-}
-
-inline void ReadVec(istream& ist, lm::vec2f& v)
-{
-       v.x = ReadNextFloat(ist);
-       v.y = ReadNextFloat(ist);
-}
-
-inline void ReadVec(istream& ist, lm::vec3f& v)
-{
-       v.x = ReadNextFloat(ist);
-       v.y = ReadNextFloat(ist);
-       v.z = ReadNextFloat(ist);
-}
-
-
 // \83t\83@\83C\83\8b\93Ç\8d\9e
 bool ObjMeshReader::Load( ObjMesh& mesh , const string& filename )
 {
index d4f66ce..0878f9b 100644 (file)
@@ -38,6 +38,24 @@ protected:
 
        bool CheckAndModifyContinueToNextLine(std::string& s) const;
 
+       float ReadNextFloat(std::istream& ist)
+       {
+               ist >> m_ReadCache;
+               return (float)atof(m_ReadCache.c_str());
+       }
+
+       void ReadVec(std::istream& ist, lm::vec2f& v)
+       {
+               v.x = ReadNextFloat(ist);
+               v.y = ReadNextFloat(ist);
+       }
+
+       void ReadVec(std::istream& ist, lm::vec3f& v)
+       {
+               v.x = ReadNextFloat(ist);
+               v.y = ReadNextFloat(ist);
+               v.z = ReadNextFloat(ist);
+       }
 
 private:
        std::map<std::string, int>  m_MatIdxMap;
@@ -47,6 +65,8 @@ private:
        int                         m_PrimaryGroupIdx;
 
        std::string                 m_LoadWorkDirPath;
+
+       std::string m_ReadCache;
 };