From 5bc2bd3bb6788820cbafbb6a708abe4c08719cb4 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Wed, 27 Dec 2017 00:57:56 +0100 Subject: [PATCH] hair particle system hotfix --- WickedEngine/ArchiveVersionHistory.txt | 1 + WickedEngine/wiArchive.cpp | 2 +- WickedEngine/wiHairParticle.cpp | 13 +++++++++---- WickedEngine/wiVersion.cpp | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/WickedEngine/ArchiveVersionHistory.txt b/WickedEngine/ArchiveVersionHistory.txt index e80a2f6b6..5630fc6de 100644 --- a/WickedEngine/ArchiveVersionHistory.txt +++ b/WickedEngine/ArchiveVersionHistory.txt @@ -1,5 +1,6 @@ This file contains changelog of wiArchive versions +15: removed redundant matrix store from hair paticle serializator 14: serialize emitter property: shaderType 13: serialize object property: renderable 12: serialize emitter property: DEPTHCOLLISIONS diff --git a/WickedEngine/wiArchive.cpp b/WickedEngine/wiArchive.cpp index ce9f9d279..165fc19aa 100644 --- a/WickedEngine/wiArchive.cpp +++ b/WickedEngine/wiArchive.cpp @@ -7,7 +7,7 @@ using namespace std; // this should always be only INCREMENTED and only if a new serialization is implemeted somewhere! -uint64_t __archiveVersion = 14; +uint64_t __archiveVersion = 15; // this is the version number of which below the archive is not compatible with the current version uint64_t __archiveVersionBarrier = 1; diff --git a/WickedEngine/wiHairParticle.cpp b/WickedEngine/wiHairParticle.cpp index bb0b7fb10..56f074c2e 100644 --- a/WickedEngine/wiHairParticle.cpp +++ b/WickedEngine/wiHairParticle.cpp @@ -57,7 +57,6 @@ wiHairParticle::wiHairParticle(const std::string& newName, float newLen, int new object = newObject; materialName = newMat; particleCount = 0; - XMStoreFloat4x4(&OriginalMatrix_Inverse, XMMatrixInverse(nullptr, object->getMatrix())); for (MeshSubset& subset : object->mesh->subsets) { if (!newMat.compare(subset.material->name)) { @@ -87,7 +86,6 @@ wiHairParticle::wiHairParticle(const wiHairParticle& other) object = other.object; materialName = other.materialName; particleCount = other.particleCount; - XMStoreFloat4x4(&OriginalMatrix_Inverse, XMMatrixInverse(nullptr, object->getMatrix())); material = other.material; if (material) @@ -302,6 +300,7 @@ void wiHairParticle::Generate() Mesh* mesh = object->mesh; XMMATRIX matr = object->getMatrix(); + XMStoreFloat4x4(&OriginalMatrix_Inverse, XMMatrixInverse(nullptr, matr)); int dVG = -1, lVG = -1; if (densityG.compare("")) { @@ -659,7 +658,10 @@ void wiHairParticle::Serialize(wiArchive& archive) archive >> densityG; archive >> lenG; archive >> materialName; - archive >> OriginalMatrix_Inverse; + if (archive.GetVersion() < 15) + { + archive >> OriginalMatrix_Inverse; + } } else { @@ -669,6 +671,9 @@ void wiHairParticle::Serialize(wiArchive& archive) archive << densityG; archive << lenG; archive << materialName; - archive << OriginalMatrix_Inverse; + if (archive.GetVersion() < 15) + { + archive << OriginalMatrix_Inverse; + } } } diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 2594351c6..93564868f 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 14; // minor bug fixes, alterations, refactors, updates - const int revision = 13; + const int revision = 14; long GetVersion()