From 564314088263887504b3db376ae4b20bb7a0d750 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 22 Jun 2013 11:19:30 +0200 Subject: [PATCH] Work on paging to file. --- library/PolyVoxCore/include/PolyVoxCore/FilePager.h | 7 +++++++ library/PolyVoxCore/include/PolyVoxCore/Pager.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/library/PolyVoxCore/include/PolyVoxCore/FilePager.h b/library/PolyVoxCore/include/PolyVoxCore/FilePager.h index 8ba7a081..5e28782d 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/FilePager.h +++ b/library/PolyVoxCore/include/PolyVoxCore/FilePager.h @@ -70,6 +70,13 @@ namespace PolyVox { logTrace() << "Paging in data for " << region; + fseek(pFile, 0L, SEEK_END); + pBlockData->m_uCompressedDataLength = ftell(pFile); + fseek(pFile, 0L, SEEK_SET); + + delete[] pBlockData->m_pCompressedData; + pBlockData->m_pCompressedData = new uint8_t[pBlockData->m_uCompressedDataLength]; + fread(pBlockData->m_pCompressedData, sizeof(uint8_t), pBlockData->m_uCompressedDataLength, pFile); if(ferror(pFile)) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Pager.h b/library/PolyVoxCore/include/PolyVoxCore/Pager.h index 893898bb..13f4ad19 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Pager.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Pager.h @@ -24,6 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Pager_H__ #define __PolyVox_Pager_H__ +#include "PolyVoxCore/Impl/Block.h" #include "PolyVoxCore/Impl/TypeDef.h" #include "PolyVoxCore/ConstVolumeProxy.h" @@ -42,6 +43,9 @@ namespace PolyVox /// Destructor virtual ~Pager() {}; + virtual void pageIn(const Region& region, Block* pBlockData) = 0; + virtual void pageOut(const Region& region, Block* pBlockData) = 0; + virtual void dataRequiredHandler(const ConstVolumeProxy& volumeProxy, const Region& region) { POLYVOX_ASSERT(false, "NOT IMPLEMENTED");