10#ifdef MOMENTUM_WITH_FBX_SDK
13#include <fbxsdk/core/fbxstream.h>
18#define FBX_VERSION_GE(major, minor, patch) \
19 ((FBXSDK_VERSION_MAJOR > (major)) || \
20 (FBXSDK_VERSION_MAJOR == (major) && FBXSDK_VERSION_MINOR > (minor)) || \
21 (FBXSDK_VERSION_MAJOR == (major) && FBXSDK_VERSION_MINOR == (minor) && \
22 FBXSDK_VERSION_POINT >= (patch)))
27class FbxMemoryStream :
public FbxStream {
29 FbxMemoryStream(std::span<const std::byte> buffer,
int pReaderId);
30 ~FbxMemoryStream()
override;
31 FbxMemoryStream(
const FbxMemoryStream&) =
default;
32 FbxMemoryStream& operator=(
const FbxMemoryStream&) =
default;
33 FbxMemoryStream(FbxMemoryStream&&) =
default;
34 FbxMemoryStream& operator=(FbxMemoryStream&&) =
default;
35 EState GetState()
override;
36 bool Open(
void* pStreamData)
override;
37 bool Close()
override;
38 bool Flush()
override;
39#if FBX_VERSION_GE(2020, 3, 2)
40 size_t Write(
const void* buffer, FbxUInt64 count)
override;
41 size_t Read(
void* buffer, FbxUInt64 count)
const override;
43 int Write(
const void* buffer,
int count)
override;
44 int Read(
void* buffer,
int count)
const override;
46 int GetReaderID()
const override;
47 int GetWriterID()
const override;
48 void Seek(
const FbxInt64& pOffset,
const FbxFile::ESeekPos& pSeekPos)
override;
49#if FBX_VERSION_GE(2020, 3, 2)
50 FbxInt64 GetPosition()
const override;
51 void SetPosition(FbxInt64 pPosition)
override;
53 long GetPosition()
const override;
54 void SetPosition(
long pPosition)
override;
56 int GetError()
const override;
57 void ClearError()
override;
60 std::span<const std::byte> buffer_;
62#if FBX_VERSION_GE(2020, 3, 2)
63 mutable FbxInt64 position_{0};
65 mutable long position_{0};
67 EState state_{eEmpty};
69 mutable int errorCode_{0};