| 26 | // --------------------------------------------------------------------------------------------------------------------- |
| 27 | |
| 28 | ProbeBatch::ProbeBatch(const Serialized::ProbeBatch* serializedObject) |
| 29 | { |
| 30 | assert(serializedObject); |
| 31 | assert(serializedObject->probes() && serializedObject->probes()->Length() > 0); |
| 32 | |
| 33 | auto numProbes = serializedObject->probes()->Length(); |
| 34 | |
| 35 | mProbes.resize(numProbes); |
| 36 | memcpy(mProbes.data(), serializedObject->probes()->data(), numProbes * sizeof(Probe)); |
| 37 | |
| 38 | auto numDataLayers = serializedObject->data_layers() ? serializedObject->data_layers()->Length() : 0; |
| 39 | |
| 40 | for (auto i = 0u; i < numDataLayers; ++i) |
| 41 | { |
| 42 | BakedDataIdentifier identifier; |
| 43 | identifier.variation = static_cast<BakedDataVariation>(serializedObject->data_layers()->Get(i)->identifier()->variation()); |
| 44 | identifier.type = static_cast<BakedDataType>(serializedObject->data_layers()->Get(i)->identifier()->type()); |
| 45 | identifier.endpointInfluence = *reinterpret_cast<const Sphere*>(serializedObject->data_layers()->Get(i)->identifier()->influence()); |
| 46 | |
| 47 | unique_ptr<IBakedData> data; |
| 48 | |
| 49 | if (identifier.type == BakedDataType::Reflections) |
| 50 | { |
| 51 | data = ipl::make_unique<BakedReflectionsData>(identifier, numProbes, serializedObject->data_layers()->Get(i)->reflections_data()); |
| 52 | } |
| 53 | else if (identifier.type == BakedDataType::Pathing) |
| 54 | { |
| 55 | data = ipl::make_unique<BakedPathData>(serializedObject->data_layers()->Get(i)->pathing_data()); |
| 56 | static_cast<BakedPathData*>(data.get())->updateVisGraphCosts(*this); |
| 57 | } |
| 58 | |
| 59 | addData(identifier, std::move(data)); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | ProbeBatch::ProbeBatch(SerializedObject& serializedObject) |
| 64 | : ProbeBatch(Serialized::GetProbeBatch(serializedObject.data())) |