1
- /*
2
- MIT License
3
- Copyright (c) 2019 AnastaZIuk
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
- SOFTWARE.
19
- */
20
- #if 0 // oldie
1
+ // Copyright (C) 2023 - DevSH Graphics Programming Sp. z O.O.
2
+ // This file is part of the "Nabla Engine".
3
+ // For conditions of distribution and use, see copyright notice in nabla.h
4
+
21
5
22
6
#include < algorithm>
23
7
#include < iostream>
@@ -33,16 +17,15 @@ SOFTWARE.
33
17
34
18
#include " CImageLoaderOpenEXR.h"
35
19
36
- #include "openexr/IlmBase/Imath/ImathBox.h"
37
- #include "openexr/OpenEXR/IlmImf/ImfRgbaFile.h"
38
- #include "openexr/OpenEXR/IlmImf/ImfInputFile.h"
39
- #include "openexr/OpenEXR/IlmImf/ImfChannelList.h"
40
- #include "openexr/OpenEXR/IlmImf/ImfChannelListAttribute.h"
41
- #include "openexr/OpenEXR/IlmImf/ImfStringAttribute.h"
42
- #include "openexr/OpenEXR/IlmImf/ImfMatrixAttribute.h"
43
- #include "openexr/OpenEXR/IlmImf/ImfArray.h"
20
+ #include " ImfRgbaFile.h"
21
+ #include " ImfInputFile.h"
22
+ #include " ImfChannelList.h"
23
+ #include " ImfChannelListAttribute.h"
24
+ #include " ImfStringAttribute.h"
25
+ #include " ImfMatrixAttribute.h"
26
+ #include " ImfArray.h"
44
27
45
- #include "openexr/OpenEXR/IlmImf/ ImfNamespace.h"
28
+ #include " ImfNamespace.h"
46
29
namespace IMF = Imf;
47
30
namespace IMATH = Imath;
48
31
@@ -86,17 +69,17 @@ class nblIStream : public IMF::IStream
86
69
// read the first byte in the file, tellg() returns 0.
87
70
// --------------------------------------------------------
88
71
89
- virtual IMF::Int64 tellg() override
72
+ virtual uint64_t tellg () override
90
73
{
91
- return static_cast<IMF::Int64 >(fileOffset);
74
+ return static_cast <uint64_t >(fileOffset);
92
75
}
93
76
94
77
// -------------------------------------------
95
78
// Set the current reading position.
96
79
// After calling seekg(i), tellg() returns i.
97
80
// -------------------------------------------
98
81
99
- virtual void seekg(IMF::Int64 pos) override
82
+ virtual void seekg (uint64_t pos) override
100
83
{
101
84
fileOffset = static_cast <decltype (fileOffset)>(pos);
102
85
}
@@ -409,6 +392,11 @@ SAssetBundle CImageLoaderOpenEXR::loadAsset(system::IFile* _file, const asset::I
409
392
return SAssetBundle (std::move (meta),std::move (images));
410
393
}
411
394
395
+ bool isImfMagic (char * b)
396
+ {
397
+ return b[0 ] == 0x76 && b[1 ] == 0x2f && b[2 ] == 0x31 && b[3 ] == 0x01 ;
398
+ }
399
+
412
400
bool CImageLoaderOpenEXR::isALoadableFileFormat (system::IFile* _file, const system::logger_opt_ptr logger) const
413
401
{
414
402
char magicNumberBuffer[sizeof (SContext::magicNumber)];
@@ -609,5 +597,4 @@ bool readHeader(IMF::IStream* nblIStream, SContext& ctx)
609
597
}
610
598
611
599
612
- #endif // _NBL_COMPILE_WITH_OPENEXR_LOADER_
613
- #endif
600
+ #endif // _NBL_COMPILE_WITH_OPENEXR_LOADER_
0 commit comments