Переглянути джерело

Obj-Importer: start new streaming handling.

Kim Kulling 9 роки тому
батько
коміт
0bae2bbfa7
3 змінених файлів з 28 додано та 5 видалено
  1. 3 3
      code/ObjFileData.h
  2. 23 0
      code/ObjFileImporter.cpp
  3. 2 2
      code/ObjFileImporter.h

+ 3 - 3
code/ObjFileData.h

@@ -104,7 +104,7 @@ struct Face
 
 // ------------------------------------------------------------------------------------------------
 //! \struct Object
-//! \brief  Stores all objects of an objfile object definition
+//! \brief  Stores all objects of an obj-file object definition
 struct Object
 {
     enum ObjectType
@@ -160,8 +160,8 @@ struct Material
     aiString textureSpecularity;
     aiString textureOpacity;
     aiString textureDisp;
-    enum TextureType
-    {
+
+    enum TextureType {
         TextureDiffuseType = 0,
         TextureSpecularType,
         TextureAmbientType,

+ 23 - 0
code/ObjFileImporter.cpp

@@ -70,6 +70,29 @@ namespace Assimp {
 
 using namespace std;
 
+struct IOStreamBuffer {
+    BaseImporter *m_importer;
+    IOStream *m_stream;
+    size_t m_cacheSize;
+    std::vector<char> m_buffer;
+    size_t m_filesize;
+    size_t m_blockIndex;
+    IOStreamBuffer( BaseImporter *imp, IOStream *stream, size_t cache = 4096 )
+    : m_importer( imp )
+    , m_stream( stream )
+    , m_cacheSize( cache )
+    , m_buffer()
+    , m_filesize( 0 )
+    , m_blockIndex( 0 ) {
+        m_buffer.resize( m_cacheSize );
+        m_filesize = m_stream->FileSize() );
+    }
+
+    char &get( size_t index ) {
+
+    }
+};
+
 // ------------------------------------------------------------------------------------------------
 //  Default constructor
 ObjFileImporter::ObjFileImporter() :

+ 2 - 2
code/ObjFileImporter.h

@@ -50,8 +50,8 @@ struct aiNode;
 namespace Assimp {
 
 namespace ObjFile {
-struct Object;
-struct Model;
+    struct Object;
+    struct Model;
 }
 
 // ------------------------------------------------------------------------------------------------