common improvements (#366)

- std container replacements for vector, unordered_map, unordered_set
  - unordered_map and unordered_set replaced with ska::flat_hash_map
  - vector replacement is still std::
- unordered_map performance test (std:: vs ska::)
- backlog improvements
- wiArchive improvements
- editor: added option to dump scene to C++ header file
- common improvements, refactors
This commit is contained in:
Turánszki János
2021-11-28 22:12:05 +01:00
committed by GitHub
parent 3a08a2bfc6
commit 16d9a8de74
96 changed files with 2680 additions and 944 deletions
+12 -14
View File
@@ -5,9 +5,7 @@
#include "xatlas.h"
#include <sstream>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace wiECS;
using namespace wiScene;
@@ -115,15 +113,15 @@ static Atlas_Dim GenerateMeshAtlas(MeshComponent& meshcomponent, uint32_t resolu
// Note: we must recreate all vertex buffers, because the index buffer will be different (the atlas could have removed shared vertices)
meshcomponent.indices.clear();
meshcomponent.indices.resize(mesh.indexCount);
std::vector<XMFLOAT3> positions(mesh.vertexCount);
std::vector<XMFLOAT2> atlas(mesh.vertexCount);
std::vector<XMFLOAT3> normals;
std::vector<XMFLOAT4> tangents;
std::vector<XMFLOAT2> uvset_0;
std::vector<XMFLOAT2> uvset_1;
std::vector<uint32_t> colors;
std::vector<XMUINT4> boneindices;
std::vector<XMFLOAT4> boneweights;
wi::vector<XMFLOAT3> positions(mesh.vertexCount);
wi::vector<XMFLOAT2> atlas(mesh.vertexCount);
wi::vector<XMFLOAT3> normals;
wi::vector<XMFLOAT4> tangents;
wi::vector<XMFLOAT2> uvset_0;
wi::vector<XMFLOAT2> uvset_1;
wi::vector<uint32_t> colors;
wi::vector<XMUINT4> boneindices;
wi::vector<XMFLOAT4> boneweights;
if (!meshcomponent.vertex_normals.empty())
{
normals.resize(mesh.vertexCount);
@@ -651,8 +649,8 @@ void ObjectWindow::Create(EditorComponent* editor)
};
UV_GEN_TYPE gen_type = (UV_GEN_TYPE)lightmapSourceUVSetComboBox.GetSelected();
std::unordered_set<ObjectComponent*> gen_objects;
std::unordered_map<MeshComponent*, Atlas_Dim> gen_meshes;
wi::unordered_set<ObjectComponent*> gen_objects;
wi::unordered_map<MeshComponent*, Atlas_Dim> gen_meshes;
for (auto& x : this->editor->translator.selected)
{