Revert the previous change for now.

This commit is contained in:
Relintai 2022-04-22 00:50:57 +02:00
parent e7b3819103
commit 6c6e9599c2
2 changed files with 24 additions and 9 deletions

View File

@ -230,11 +230,13 @@ void WaveFormCollapse::propagate() {
while (propagating.size() != 0) {
// The cell and pattern that has been set to false.
uint32_t y1 = propagating[propagating.size() - 1];
uint32_t x1 = propagating[propagating.size() - 2];
uint32_t pattern = propagating[propagating.size() - 3];
const PropagatingEntry &e = propagating[propagating.size() - 1];
propagating.resize(propagating.size() - 3);
uint32_t y1 = e.data[0];
uint32_t x1 = e.data[1];
uint32_t pattern = e.data[2];
propagating.resize(propagating.size() - 1);
// We propagate the information in all 4 directions.
for (uint32_t direction = 0; direction < 4; direction++) {

View File

@ -7,7 +7,6 @@
#include "array_2d.h"
#include "array_3d.h"
#include "core/vector.h"
#include "core/pool_vector.h"
#include "core/reference.h"
@ -25,6 +24,22 @@ public:
Vector<uint32_t> directions[4];
};
struct PropagatingEntry {
uint32_t data[3];
PropagatingEntry() {
for (int i = 0; i < 3; ++i) {
data[i] = 0;
}
}
PropagatingEntry(uint32_t x, uint32_t y, uint32_t z) {
data[0] = x;
data[1] = y;
data[2] = z;
}
};
struct CompatibilityEntry {
int direction[4];
@ -90,9 +105,7 @@ public:
CompatibilityEntry temp;
compatible.get(y, x, pattern) = temp;
propagating.push_back(pattern);
propagating.push_back(x);
propagating.push_back(y);
propagating.push_back(PropagatingEntry(y, x, pattern));
}
constexpr uint32_t get_opposite_direction(uint32_t direction) {
@ -159,7 +172,7 @@ private:
// All the tuples (y, x, pattern) that should be propagated.
// The tuple should be propagated when wave.get(y, x, pattern) is set to false.
Vector<uint32_t> propagating;
Vector<PropagatingEntry> propagating;
// compatible.get(y, x, pattern)[direction] contains the number of patterns
// present in the wave that can be placed in the cell next to (y,x) in the