Commit f0a50cf9 authored by Adrien Boucaud's avatar Adrien Boucaud

vtkGLTFDocumentLoader: Create cells arrays more efficiently

parent 64287925
......@@ -74,6 +74,54 @@ vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderMultipleAnimations,TestGLTFReaderAnimation.cxx 75 DATA{../Data/glTF/InterpolationTest/InterpolationTest.gltf,interpolation.bin,InterpolationTest_data.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderGeneratePointIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_POINTS.gltf,Mesh_PrimitiveMode_00.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderReadPointIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_POINTS_2.gltf,Mesh_PrimitiveMode_07.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderGenerateLineIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_LINES.gltf,Mesh_PrimitiveMode_01.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderReadLineIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_LINES_2.gltf,Mesh_PrimitiveMode_08.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderGenerateLineLoopIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_LINE_LOOP.gltf,Mesh_PrimitiveMode_02.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderReadLineLoopIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_LINE_LOOP_2.gltf,Mesh_PrimitiveMode_09.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderGenerateLineStripIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_LINE_STRIP.gltf,Mesh_PrimitiveMode_03.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderReadLineStripIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_LINE_STRIP_2.gltf,Mesh_PrimitiveMode_10.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderGenerateTriangleFanIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_TRIANGLE_FAN.gltf,Mesh_PrimitiveMode_05.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderReadTriangleFanIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_TRIANGLE_FAN_2.gltf,Mesh_PrimitiveMode_12.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderGenerateTriangleStripIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_TRIANGLE_STRIP.gltf,Mesh_PrimitiveMode_04.bin}
)
vtk_add_test_cxx(vtkIOGeometryCxxTests tests
TestGLTFReaderReadTriangleStripIndices,TestGLTFReaderGeometry.cxx DATA{../Data/glTF/PrimitiveModes/Mesh_PrimitiveMode_TRIANGLE_STRIP_2.gltf,Mesh_PrimitiveMode_11.bin}
)
if(enable_large_data_tests)
vtk_add_test_cxx(vtkIOGeometryCxxTests large_data_tests
TestWindBladeReader.cxx
......
97451645f3a682cb536acd4c37e73a4b2626cce13d47e9d6140777a49507d004c7191981405da2b8bbf7b1f77ccadb18b4bbf78d8d094d1c232f952059cf50fc
97451645f3a682cb536acd4c37e73a4b2626cce13d47e9d6140777a49507d004c7191981405da2b8bbf7b1f77ccadb18b4bbf78d8d094d1c232f952059cf50fc
97451645f3a682cb536acd4c37e73a4b2626cce13d47e9d6140777a49507d004c7191981405da2b8bbf7b1f77ccadb18b4bbf78d8d094d1c232f952059cf50fc
27138f675352c241f5ad71315251c39a68e3170f355e2746af22c3bbf6312a31c1dd11b908249d6a26ce3e7d650cc8fee970a0d78f47b87dd629259a81359a02
06d12498d7d28b6919de1228a0f3be90f9c8cbf011867e62b74c18c794b37475ef7ce1bf8e34669bc0df8e8134217e8e76b7441e6f84f8904e46087f2ab07eea
06d12498d7d28b6919de1228a0f3be90f9c8cbf011867e62b74c18c794b37475ef7ce1bf8e34669bc0df8e8134217e8e76b7441e6f84f8904e46087f2ab07eea
97451645f3a682cb536acd4c37e73a4b2626cce13d47e9d6140777a49507d004c7191981405da2b8bbf7b1f77ccadb18b4bbf78d8d094d1c232f952059cf50fc
97451645f3a682cb536acd4c37e73a4b2626cce13d47e9d6140777a49507d004c7191981405da2b8bbf7b1f77ccadb18b4bbf78d8d094d1c232f952059cf50fc
97451645f3a682cb536acd4c37e73a4b2626cce13d47e9d6140777a49507d004c7191981405da2b8bbf7b1f77ccadb18b4bbf78d8d094d1c232f952059cf50fc
27138f675352c241f5ad71315251c39a68e3170f355e2746af22c3bbf6312a31c1dd11b908249d6a26ce3e7d650cc8fee970a0d78f47b87dd629259a81359a02
06d12498d7d28b6919de1228a0f3be90f9c8cbf011867e62b74c18c794b37475ef7ce1bf8e34669bc0df8e8134217e8e76b7441e6f84f8904e46087f2ab07eea
06d12498d7d28b6919de1228a0f3be90f9c8cbf011867e62b74c18c794b37475ef7ce1bf8e34669bc0df8e8134217e8e76b7441e6f84f8904e46087f2ab07eea
1202297a2c32fc28d75dfdbaa9d316faf284d7e0d3ca400d3f954178f4333c9f0a0a9d73126456fc63afb20829f32cb301b1d4a633cce02423e667f3460f9df2
d71846cd91d9041cf77f290235671e033d6769a567604872e5580149da228ba36c5e227060c01cba27ad76ae5fa717544f4c81262b6bc05506da6b1686c2ddfc
51d388440d263a15f912140bd7d87d08414ba72691bc40749008ca5548d2c2f8cc4ef98fb7d2a8a4f659d9346f8a11c40650b890c366b9799c47120b6c65d182
bc4320ed645a0f2dc1346868ff43b8ac916fcc27235f802b83822680adc3bfd39cb205e26cbbc6759fb95cb6e2542e85f6f0d4753247d4a26a3de5d6bc9f334a
40c7b8b037afa69007d70205916264342d84c501514dd63346430749b146f0250956196d97d2cbac826af8b7c0bddd012bd4e6746c5049e74ab187bd8ee26cbb
fe2c6bf16d6df46e401da61443a93aa8bdfa3a87635fbf71d16ea7321df0886bee753445d7e1346d9922cdac0fde47cbe01677d2e674f54ff1754c47e53b73b1
1aa7fe6cd0aadf675256bfafbb085830a8fadbb3465250ec7ffa78ea5e1bc9d7a927894103f00b80f6a5ae21d21053ace0eea72768c8851cfc536b6d4109b1c0
5137302dc217493b5dff99dcc4e205d9d2120fe30534efa6776068a184a2c88096a6a0bb8686f5b7060dbf859d1d9fa2c28fb8142a7093713092a7539247e570
d8486fc797e6fb757b91e6864dfba7d4385d9b10bfb4a08d467662e8ee4f8e2f746ba307300042fdbddc1eb02b053d4c6a7eb11991b811d0d782805b8a9a1bb1
a2059174aa59247242f437da4dd9504025ea1959a5ac25653e45be776031f3eb77d26dd6c70f122cc7e7cef4df515961468aa8e5f8cf10683d5b8ea9f18c0415
bc9ac1eafef784b02763cb64f842273631569a8d98aa1b6bd1d36c360fb3dedd8f6f890b69603611ee19d724e248e7610067bc0cd053be0aaa9c4a0159bb69c2
891fb0ecd4add2374430d251ffed06d071e9f00a59d3a8a91545d94ba9c3cd6a8b109cd4f56b1aa33a07f525bae0f594b608e8f394f7a2cb0ce0dab7f53712ae
003ec8bf7047a9990769444733fcbdce118b59ee6e67e92a512c807dfc3527686297e705137601c31953b5ff8e8c77a68ea75a28e97e8d0f3afdd3db498099eb
b4697fbd65736ac97d1f34abda10523394378d353a2d53e72cc9ea78627d566b5c85dd48cd5bd455cf3bd5bea5196ebc3730d72c2c37cc0f313a0c43b07a0b64
88b98652ebe93c1bf8de0925107d7d44371ebab26549923778a9ae64cb06763b82b2c7ef9fec048c6a4382a1b63d827e13af72b05c77c0c30dc0dcb93ed2869a
614c06d6bfd17dd1fd485bbc2691ff35c28038814fc281b92e3a212ae5182121bedf0329019d44e5dfdc27d3a1e51950e27eba0b7ae437d16cace4522f0317f0
232c19770995f5e765ed12152d9ac31774de9da33a37dfba3a22e53d97b7bdfbd2d827dfbbb8ae5e2abb6795071deeaaf2b7768b71e292b9d235cfb87635874f
d5060ca0a6b6491c0af248d5cf9cb510245ed48295d1057d409b2d8dfadc8f0452f4b8c14c2621ea172400673e7c36b456dc6f03b67b8e1ede322eda04ef6524
2ed1cd1dfe49dc6b6d9c3ebb6b2d8998e0fabdad2f8e177636f9f077205f47cdf5ce53076de9b44a6fc27f2d942436895d91104956a5032d927192c8f14687ac
3284d347aebec75612bc703637832f02e132d8e2f1f2c137d32bdbeb250b8b0bde9d7891f588483473fbec1e7680e981f405d7349bd14b627ea5b94db70903df
0f3eec3d065b756f773732f01c2178f1c9c5bf7c2c34484d3d271baf83b0e3e389ea80b13e5136977a0181484f10ff35d06b571d601e104b0e3770dccb87632b
aee2ea48c35798dc1d48ec0b31e1df2ee123419b39b6a90d51222e4754ca848e736c46c115a778ed58e93029bc991f998cdeab604818c254cdeab72b4035ff46
1750d200aa9cfc9fb1978949d8fd7b1b79aae9fca331ea338d5001606b987e3c90a2e227c8cca5b1c1f782720ce6506b93880ff7861007596caebb32e50c49c7
a13eea42a7fd81e7ca426f02c5379e3238a9c4c0d2a325e7e96f92a848639c531f4a26b4c350786a50c7a3c7242fba78cc29f5da2cb758cfdcc352e2630efbc2
This diff is collapsed.
......@@ -46,9 +46,9 @@
#include <string> // For std::string
#include <vector> // For std::vector
class vtkCellArray;
class vtkDataArray;
class vtkFloatArray;
class vtkIdTypeArray;
class vtkImageData;
class vtkTupleInterpolator;
class vtkMatrix4x4;
......@@ -187,7 +187,7 @@ public:
// accessor indices from the .glTF file, the map's keys correspond to attribute names
std::map<std::string, int> AttributeIndices;
int IndicesId;
vtkSmartPointer<vtkIdTypeArray> Indices;
vtkSmartPointer<vtkCellArray> Indices;
// attribute values from buffer data
std::map<std::string, vtkSmartPointer<vtkDataArray> > AttributeValues;
......
......@@ -24,12 +24,6 @@
#include <algorithm>
#include <sstream>
//----------------------------------------------------------------------------
vtkGLTFDocumentLoaderInternals::vtkGLTFDocumentLoaderInternals()
{
this->Self = nullptr;
}
//----------------------------------------------------------------------------
bool vtkGLTFDocumentLoaderInternals::LoadBuffer(
const Json::Value& root, std::vector<char>& buffer, const std::string& glTFFileName)
......
......@@ -32,7 +32,7 @@
class vtkGLTFDocumentLoaderInternals
{
public:
vtkGLTFDocumentLoaderInternals();
vtkGLTFDocumentLoaderInternals() = default;
/**
* Reset internal Model struct, and serialize glTF metadata (all json information) into it.
......@@ -40,7 +40,7 @@ public:
* To load buffers, use LoadModelData
*/
bool LoadModelMetaDataFromFile(std::string& FileName, std::vector<std::string>& usedExtensions);
vtkGLTFDocumentLoader* Self;
vtkGLTFDocumentLoader* Self = nullptr;
/**
* Reads the model's buffer metadata, then uses it to load all buffers into the model.
......
......@@ -653,11 +653,7 @@ vtkStandardNewMacro(vtkGLTFReader);
//----------------------------------------------------------------------------
vtkGLTFReader::vtkGLTFReader()
{
this->FileName = nullptr;
this->SetNumberOfInputPorts(0);
this->SetFrameRate(60);
this->IsModelLoaded = false;
this->IsMetaDataLoaded = false;
}
//----------------------------------------------------------------------------
......
......@@ -193,16 +193,17 @@ protected:
*/
void StoreTextureData();
char* FileName;
char* FileName = nullptr;
vtkIdType CurrentScene;
unsigned int FrameRate;
vtkIdType NumberOfAnimations;
vtkIdType NumberOfScenes;
vtkIdType CurrentScene = 0;
unsigned int FrameRate = 60;
vtkIdType NumberOfAnimations = 0;
vtkIdType NumberOfScenes = 0;
bool IsModelLoaded;
bool IsMetaDataLoaded;
bool ApplyDeformationsToGeometry;
bool IsModelLoaded = false;
bool IsMetaDataLoaded = false;
bool ApplyDeformationsToGeometry = true;
vtkSmartPointer<vtkStringArray> SceneNames;
......
......@@ -193,12 +193,6 @@ void ApplyGLTFMaterialToVTKActor(std::shared_ptr<vtkGLTFDocumentLoader::Model> m
}
};
//----------------------------------------------------------------------------
vtkGLTFImporter::vtkGLTFImporter()
{
this->FileName = nullptr;
}
//----------------------------------------------------------------------------
vtkGLTFImporter::~vtkGLTFImporter()
{
......
......@@ -88,7 +88,7 @@ public:
size_t GetNumberOfCameras();
protected:
vtkGLTFImporter();
vtkGLTFImporter() = default;
~vtkGLTFImporter() override;
int ImportBegin() override;
......@@ -96,7 +96,7 @@ protected:
void ImportCameras(vtkRenderer* renderer) override;
void ImportLights(vtkRenderer* renderer) override;
char* FileName;
char* FileName = nullptr;
std::vector<vtkSmartPointer<vtkCamera> > Cameras;
std::map<int, vtkSmartPointer<vtkTexture> > Textures;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment