ソースを参照

Add prototypes for jt

Kim Kulling 1 ヶ月 前
コミット
bb1eaad91c

+ 10 - 1
.github/workflows/ccpp.yml

@@ -197,4 +197,13 @@ jobs:
         with:
           files: |
             *.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 }}'

+ 82 - 0
code/AssetLib/JT/JTImporter.cpp

@@ -1 +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

+ 13 - 0
code/AssetLib/JT/JTImporter.h

@@ -1,4 +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;
 }

+ 2 - 2
include/assimp/LineSplitter.h

@@ -156,8 +156,8 @@ private:
     std::string mCur{};
     const char *mEnd{nullptr};
     StreamReaderLE &mStream;
-    bool mSwallow{false};
-    bool mSkip_empty_lines{ false };
+    bool mSwallow{ false };
+    bool mSkip_empty_lines{ false };1
     bool mTrim{ false };
 };
 

+ 4 - 4
include/assimp/StreamReader.h

@@ -331,11 +331,11 @@ private:
 // --------------------------------------------------------------------------------------------
 // `static` StreamReaders. Their byte order is fixed and they might be a little bit faster.
 #ifdef AI_BUILD_BIG_ENDIAN
-typedef StreamReader<true> StreamReaderLE;
-typedef StreamReader<false> StreamReaderBE;
+using StreamReaderLE = StreamReader<true> ;
+using StreamReaderBE = StreamReader<false> ;
 #else
-typedef StreamReader<true> StreamReaderBE;
-typedef StreamReader<false> StreamReaderLE;
+using StreamReaderBE = StreamReader<true> ;
+using StreamReaderLE = StreamReader<false> ;
 #endif
 
 // `dynamic` StreamReader. The byte order of the input data is specified in the