Skip to content

Commit 16d3a18

Browse files
committed
Improve c3t, c3b load
- Use simdjson to load c3t - Use yasio::ibstream to c3b
1 parent f25b462 commit 16d3a18

File tree

13 files changed

+945
-1390
lines changed

13 files changed

+945
-1390
lines changed

core/3d/Bundle3D.cpp

Lines changed: 901 additions & 886 deletions
Large diffs are not rendered by default.

core/3d/Bundle3D.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929

3030
#include "base/Data.h"
3131
#include "3d/Bundle3DData.h"
32-
#include "3d/BundleReader.h"
33-
#include "rapidjson/rapidjson.h"
34-
#include "rapidjson/document.h"
35-
32+
#include "base/json.h"
33+
#include "yasio/ibstream.hpp"
3634

3735
namespace ax
3836
{
@@ -151,7 +149,7 @@ class AX_DLL Bundle3D
151149
* load nodes of json
152150
*/
153151
bool loadNodesJson(NodeDatas& nodedatas);
154-
NodeData* parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bool singleSprite);
152+
NodeData* parseNodesRecursivelyJson(simdjson::simdjson_result<simdjson::ondemand::value> jvalue, bool singleSprite);
155153

156154
/**
157155
* load nodes of binary
@@ -190,12 +188,13 @@ class AX_DLL Bundle3D
190188
std::string _version; // the c3b or c3t version
191189

192190
// for json reading
193-
std::string _jsonBuffer;
194-
rapidjson::Document _jsonReader;
191+
simdjson::PaddedString _jsonBuffer;
192+
simdjson::ondemand::parser _jsonParser;
193+
simdjson::ondemand::document _jsonReader;
195194

196195
// for binary reading
197196
Data _binaryBuffer;
198-
BundleReader _binaryReader;
197+
yasio::fast_ibstream_view _binaryReader;
199198
unsigned int _referenceCount;
200199
Reference* _references;
201200
bool _isBinary;

core/3d/Bundle3DData.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
#include <string>
4040

4141
#include "3d/3DProgramInfo.h"
42-
43-
#include "yasio/byte_buffer.hpp"
42+
#include "base/axstd.h"
4443

4544
namespace ax
4645
{
@@ -319,7 +318,7 @@ struct MeshData
319318
std::vector<std::string> subMeshIds; // subMesh Names (since 3.3)
320319
std::vector<AABB> subMeshAABB;
321320
int numIndex;
322-
std::vector<MeshVertexAttrib> attribs;
321+
axstd::pod_vector<MeshVertexAttrib> attribs;
323322
int attribCount;
324323

325324
public:
@@ -539,9 +538,9 @@ struct Animation3DData
539538
};
540539

541540
public:
542-
std::map<std::string, std::vector<Vec3Key>> _translationKeys;
543-
std::map<std::string, std::vector<QuatKey>> _rotationKeys;
544-
std::map<std::string, std::vector<Vec3Key>> _scaleKeys;
541+
hlookup::string_map<std::vector<Vec3Key>> _translationKeys;
542+
hlookup::string_map<std::vector<QuatKey>> _rotationKeys;
543+
hlookup::string_map<std::vector<Vec3Key>> _scaleKeys;
545544

546545
float _totalTime;
547546

core/3d/BundleReader.cpp

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)