Plasma Engine  2.0
Loading...
Searching...
No Matches
OzzUtils.h
1#pragma once
2
3#include <Foundation/IO/MemoryStream.h>
4#include <Foundation/IO/Stream.h>
5#include <RendererCore/RendererCoreDLL.h>
6#include <ozz/base/io/stream.h>
7
8namespace ozz::animation
9{
10 class Skeleton;
11 class Animation;
12}; // namespace ozz::animation
13
18class PL_RENDERERCORE_DLL plOzzArchiveData
19{
20 PL_DISALLOW_COPY_AND_ASSIGN(plOzzArchiveData);
21
22public:
25
26 plResult FetchRegularFile(const char* szFile);
27 plResult FetchEmbeddedArchive(plStreamReader& inout_stream);
28 plResult StoreEmbeddedArchive(plStreamWriter& inout_stream) const;
29
31};
32
36class PL_RENDERERCORE_DLL plOzzStreamReader : public ozz::io::Stream
37{
38public:
40
41 virtual bool opened() const override;
42
43 virtual size_t Read(void* pBuffer, size_t uiSize) override;
44
45 virtual size_t Write(const void* pBuffer, size_t uiSize) override;
46
47 virtual int Seek(int iOffset, Origin origin) override;
48
49 virtual int Tell() const override;
50
51 virtual size_t Size() const override;
52
53private:
54 plMemoryStreamReader m_Reader;
55};
56
60class PL_RENDERERCORE_DLL plOzzStreamWriter : public ozz::io::Stream
61{
62public:
64
65 virtual bool opened() const override;
66
67 virtual size_t Read(void* pBuffer, size_t uiSize) override;
68
69 virtual size_t Write(const void* pBuffer, size_t uiSize) override;
70
71 virtual int Seek(int iOffset, Origin origin) override;
72
73 virtual int Tell() const override;
74
75 virtual size_t Size() const override;
76
77private:
78 plMemoryStreamWriter m_Writer;
79};
80
81namespace plOzzUtils
82{
83 PL_RENDERERCORE_DLL void CopyAnimation(ozz::animation::Animation* pDst, const ozz::animation::Animation* pSrc);
84 PL_RENDERERCORE_DLL void CopySkeleton(ozz::animation::Skeleton* pDst, const ozz::animation::Skeleton* pSrc);
85} // namespace plOzzUtils
The default implementation for memory stream storage.
Definition MemoryStream.h:161
A reader which can access a memory stream.
Definition MemoryStream.h:259
A writer which can access a memory stream.
Definition MemoryStream.h:313
Stores or gather the data for an ozz file, for random access operations (seek / tell).
Definition OzzUtils.h:19
Implements the ozz::io::Stream interface for reading. The data has to be present in an plOzzArchiveDa...
Definition OzzUtils.h:37
Implements the ozz::io::Stream interface for writing. The data is gathered in an plOzzArchiveData obj...
Definition OzzUtils.h:61
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54