Compare commits
39 Commits
master
...
feature/jt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb1eaad91c | ||
|
|
81fad0f20c | ||
|
|
354cf46b51 | ||
|
|
2998ad82a1 | ||
|
|
3ce8af18e2 | ||
|
|
824db16a68 | ||
|
|
3dd83275c9 | ||
|
|
d65049a657 | ||
|
|
e2fa181aa6 | ||
|
|
6332f8a5bc | ||
|
|
b58bec39d9 | ||
|
|
ce7b2e571a | ||
|
|
6c95fe19d0 | ||
|
|
26e4ab2a23 | ||
|
|
a84bf34cbb | ||
|
|
cd0bbe15af | ||
|
|
d04dd1af9b | ||
|
|
b406ce6707 | ||
|
|
2c87088079 | ||
|
|
2ec097b862 | ||
|
|
dd313da24f | ||
|
|
5925dcd0e2 | ||
|
|
9b644494ed | ||
|
|
b1a700dbbc | ||
|
|
f77db867b5 | ||
|
|
4b523e99c4 | ||
|
|
53f0d5dcbd | ||
|
|
bbfc9f4658 | ||
|
|
fde8bf1071 | ||
|
|
cf3be00fd3 | ||
|
|
1f8f4da97c | ||
|
|
b9cf35ea3a | ||
|
|
09375a386a | ||
|
|
a09a4d0518 | ||
|
|
8b73b85628 | ||
|
|
b0515a0dd0 | ||
|
|
05b9940ce3 | ||
|
|
e8393116d4 | ||
|
|
49fa7fcc44 |
11
.github/workflows/ccpp.yml
vendored
11
.github/workflows/ccpp.yml
vendored
@@ -197,4 +197,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
*.zip
|
*.zip
|
||||||
|
upload_url: '${{ steps.upload-url.outputs.url }}'
|
||||||
|
- name: Upload EXE files
|
||||||
|
if: contains(matrix.name, 'windows-msvc-hunter')
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}}'
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
build/bin/assimp*.exe
|
||||||
|
upload_url: '${{ steps.upload-url.outputs.url }}'
|
||||||
83
code/AssetLib/JT/JTImporter.cpp
Normal file
83
code/AssetLib/JT/JTImporter.cpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
//
|
||||||
|
|
||||||
|
#include "JT/JTImporter.h"
|
||||||
|
#include <assimp/StreamReader.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace Assimp::JT {
|
||||||
|
|
||||||
|
enum class SegmentType {
|
||||||
|
Invalid = -1, //< Predefined class: Invalid
|
||||||
|
LOGICAL_SCENE_GRAPH,//< Predefined class: Logical_Scene_Graph
|
||||||
|
JT_BREP,//< Predefined class: JT_BRep
|
||||||
|
PMI_DATA, //<Predefined class: PMI_Data
|
||||||
|
META_DATA, //< Predefined class: Meta_Data
|
||||||
|
SHAPE, //< Predefined class: Shape
|
||||||
|
SHAPE_LOD0, //< Predefined class: Shape_LOD0
|
||||||
|
SHAPE_LOD1, //< Predefined class: Logical_Scene_Graph
|
||||||
|
SHAPE_LOD2, //< Predefined class: Shape_LOD2
|
||||||
|
SHAPE_LOD3, //< Predefined class: Shape_LOD3
|
||||||
|
SHAPE_LOD4, //< Predefined class: Shape_LOD4
|
||||||
|
SHAPE_LOD5, //< Predefined class: Shape_LOD5
|
||||||
|
SHAPE_LOD6, //< Predefined class: Shape_LOD6
|
||||||
|
SHAPE_LOD7, //< Predefined class: Shape_LOD7
|
||||||
|
SHAPE_LOD8, //< Predefined class: Shape_LOD8
|
||||||
|
SHAPE_LOD9, ///< Predefined class: Shape_LOD9
|
||||||
|
XT_BREP, //< Predefined class: XT_BRep
|
||||||
|
Count //< Number of segment types
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Guid {
|
||||||
|
uint32_t Data0{};
|
||||||
|
uint32_t Data1{};
|
||||||
|
uint32_t Data2{}
|
||||||
|
uint32_t Data3{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Version {
|
||||||
|
constexpr static size_t VersionSize = 80;
|
||||||
|
uint8_t Version[VersionSize]{};
|
||||||
|
int32_t Empty{0};
|
||||||
|
uint64_t TOCOffset{0};
|
||||||
|
|
||||||
|
}
|
||||||
|
struct SegmentHeader {
|
||||||
|
Guid SegmentGuid{};
|
||||||
|
SegmentType Type{SegmentType::Invalid};
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
void readVersion(StreamReaderLE& reader, Version& version) {
|
||||||
|
reader.ReadBytes(version.Version, Version::VersionSize);
|
||||||
|
version.Empty = reader.Read<int32_t>();
|
||||||
|
version.TOCOffset = reader.Read<uint64_t>();
|
||||||
|
}
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
JTImporter::JTImporter() : BaseImporter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
JTImporter::~JTImporter() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JTImporter::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void JTImporter::setupProperties(const Importer* pImp) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
|
||||||
|
auto stream = std::shared_ptr<IOStream>(pIOHandler->Open(pFile, "rb"));
|
||||||
|
if (!stream) {
|
||||||
|
throw DeadlyImportError("Failed to open JT file " + pFile + " for reading.");
|
||||||
|
}
|
||||||
|
StreamReaderLE reader(stream);
|
||||||
|
Version version;
|
||||||
|
readVersion(reader, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Namespace Assimp
|
||||||
17
code/AssetLib/JT/JTImporter.h
Normal file
17
code/AssetLib/JT/JTImporter.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <assimp/BaseImporter.h>
|
||||||
|
|
||||||
|
namespace Assimp::JT {
|
||||||
|
|
||||||
|
|
||||||
|
class JTImporter : public BaseImporter {
|
||||||
|
public:
|
||||||
|
JTImporter();
|
||||||
|
~JTImporter() override;
|
||||||
|
bool CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
|
||||||
|
void setupProperties(const Importer* pImp) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) override;
|
||||||
|
}
|
||||||
@@ -914,29 +914,16 @@ class Asset {
|
|||||||
friend struct Buffer; // To access OpenFile
|
friend struct Buffer; // To access OpenFile
|
||||||
friend class AssetWriter;
|
friend class AssetWriter;
|
||||||
|
|
||||||
private:
|
|
||||||
IOSystem *mIOSystem;
|
|
||||||
|
|
||||||
std::string mCurrentAssetDir;
|
|
||||||
|
|
||||||
size_t mSceneLength;
|
|
||||||
size_t mBodyOffset, mBodyLength;
|
|
||||||
|
|
||||||
std::vector<LazyDictBase *> mDicts;
|
|
||||||
|
|
||||||
IdMap mUsedIds;
|
|
||||||
|
|
||||||
Ref<Buffer> mBodyBuffer;
|
|
||||||
|
|
||||||
Asset(Asset &);
|
|
||||||
Asset &operator=(const Asset &);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// Copy policies
|
||||||
|
Asset(Asset &) = delete;
|
||||||
|
Asset &operator=(const Asset &) = delete;
|
||||||
|
|
||||||
//! Keeps info about the enabled extensions
|
//! Keeps info about the enabled extensions
|
||||||
struct Extensions {
|
struct Extensions {
|
||||||
bool KHR_binary_glTF;
|
bool KHR_binary_glTF{ false };
|
||||||
bool KHR_materials_common;
|
bool KHR_materials_common{ false };
|
||||||
|
|
||||||
} extensionsUsed;
|
} extensionsUsed;
|
||||||
|
|
||||||
AssetMetadata asset;
|
AssetMetadata asset;
|
||||||
@@ -961,8 +948,7 @@ public:
|
|||||||
|
|
||||||
Ref<Scene> scene;
|
Ref<Scene> scene;
|
||||||
|
|
||||||
public:
|
explicit Asset(IOSystem *io = nullptr) :
|
||||||
Asset(IOSystem *io = nullptr) :
|
|
||||||
mIOSystem(io),
|
mIOSystem(io),
|
||||||
asset(),
|
asset(),
|
||||||
accessors(*this, "accessors"),
|
accessors(*this, "accessors"),
|
||||||
@@ -979,7 +965,7 @@ public:
|
|||||||
skins(*this, "skins"),
|
skins(*this, "skins"),
|
||||||
textures(*this, "textures"),
|
textures(*this, "textures"),
|
||||||
lights(*this, "lights", "KHR_materials_common") {
|
lights(*this, "lights", "KHR_materials_common") {
|
||||||
memset(&extensionsUsed, 0, sizeof(extensionsUsed));
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Main function
|
//! Main function
|
||||||
@@ -995,10 +981,17 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void ReadBinaryHeader(IOStream &stream);
|
void ReadBinaryHeader(IOStream &stream);
|
||||||
|
|
||||||
void ReadExtensionsUsed(Document &doc);
|
void ReadExtensionsUsed(Document &doc);
|
||||||
|
|
||||||
IOStream *OpenFile(const std::string &path, const char *mode, bool absolute = false);
|
IOStream *OpenFile(const std::string &path, const char *mode, bool absolute = false);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IOSystem *mIOSystem;
|
||||||
|
std::string mCurrentAssetDir;
|
||||||
|
size_t mSceneLength;
|
||||||
|
size_t mBodyOffset, mBodyLength;
|
||||||
|
std::vector<LazyDictBase *> mDicts;
|
||||||
|
IdMap mUsedIds;
|
||||||
|
Ref<Buffer> mBodyBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace glTF
|
} // namespace glTF
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ struct aiNode;
|
|||||||
|
|
||||||
namespace glTF {
|
namespace glTF {
|
||||||
class Asset;
|
class Asset;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
@@ -58,7 +57,7 @@ namespace Assimp {
|
|||||||
* Load the glTF format.
|
* Load the glTF format.
|
||||||
* https://github.com/KhronosGroup/glTF/tree/master/specification
|
* https://github.com/KhronosGroup/glTF/tree/master/specification
|
||||||
*/
|
*/
|
||||||
class glTFImporter : public BaseImporter {
|
class glTFImporter final : public BaseImporter {
|
||||||
public:
|
public:
|
||||||
glTFImporter();
|
glTFImporter();
|
||||||
~glTFImporter() override = default;
|
~glTFImporter() override = default;
|
||||||
|
|||||||
@@ -401,6 +401,11 @@ ADD_ASSIMP_IMPORTER( IRR
|
|||||||
AssetLib/Irr/IRRShared.h
|
AssetLib/Irr/IRRShared.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ADD_ASSIMP_IMPORTER(JT
|
||||||
|
AssetLib/JT/JTImporter.cpp
|
||||||
|
AssetLib/JT/JTImporter.h
|
||||||
|
)
|
||||||
|
|
||||||
ADD_ASSIMP_IMPORTER( LWO
|
ADD_ASSIMP_IMPORTER( LWO
|
||||||
AssetLib/LWO/LWOAnimation.cpp
|
AssetLib/LWO/LWOAnimation.cpp
|
||||||
AssetLib/LWO/LWOAnimation.h
|
AssetLib/LWO/LWOAnimation.h
|
||||||
|
|||||||
@@ -156,8 +156,8 @@ private:
|
|||||||
std::string mCur{};
|
std::string mCur{};
|
||||||
const char *mEnd{nullptr};
|
const char *mEnd{nullptr};
|
||||||
StreamReaderLE &mStream;
|
StreamReaderLE &mStream;
|
||||||
bool mSwallow{false};
|
bool mSwallow{ false };
|
||||||
bool mSkip_empty_lines{ false };
|
bool mSkip_empty_lines{ false };1
|
||||||
bool mTrim{ false };
|
bool mTrim{ false };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -331,11 +331,11 @@ private:
|
|||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
// `static` StreamReaders. Their byte order is fixed and they might be a little bit faster.
|
// `static` StreamReaders. Their byte order is fixed and they might be a little bit faster.
|
||||||
#ifdef AI_BUILD_BIG_ENDIAN
|
#ifdef AI_BUILD_BIG_ENDIAN
|
||||||
typedef StreamReader<true> StreamReaderLE;
|
using StreamReaderLE = StreamReader<true> ;
|
||||||
typedef StreamReader<false> StreamReaderBE;
|
using StreamReaderBE = StreamReader<false> ;
|
||||||
#else
|
#else
|
||||||
typedef StreamReader<true> StreamReaderBE;
|
using StreamReaderBE = StreamReader<true> ;
|
||||||
typedef StreamReader<false> StreamReaderLE;
|
using StreamReaderLE = StreamReader<false> ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// `dynamic` StreamReader. The byte order of the input data is specified in the
|
// `dynamic` StreamReader. The byte order of the input data is specified in the
|
||||||
|
|||||||
Reference in New Issue
Block a user