From 0bae2bbfa7011b86d44a314e3919f244113127db Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 7 Oct 2016 09:19:10 +0200 Subject: [PATCH] Obj-Importer: start new streaming handling. --- code/ObjFileData.h | 6 +++--- code/ObjFileImporter.cpp | 23 +++++++++++++++++++++++ code/ObjFileImporter.h | 4 ++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/code/ObjFileData.h b/code/ObjFileData.h index 2d282e6a9..4fc262760 100644 --- a/code/ObjFileData.h +++ b/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, diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index a70d69b4a..8beabaf88 100644 --- a/code/ObjFileImporter.cpp +++ b/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 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() : diff --git a/code/ObjFileImporter.h b/code/ObjFileImporter.h index 8c482017b..a962d43c4 100644 --- a/code/ObjFileImporter.h +++ b/code/ObjFileImporter.h @@ -50,8 +50,8 @@ struct aiNode; namespace Assimp { namespace ObjFile { -struct Object; -struct Model; + struct Object; + struct Model; } // ------------------------------------------------------------------------------------------------