Removed RAW support to compile for Emscripten, fixed bug in cache in online use
This commit is contained in:
parent
c685da008b
commit
f155905185
5 changed files with 21 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "SharedTypes.hpp"
|
#include "SharedTypes.hpp"
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
template <typename T, typename IDType> class CollabList {
|
template <typename T, typename IDType> class CollabList {
|
||||||
public:
|
public:
|
||||||
|
|
@ -24,7 +25,7 @@ template <typename T, typename IDType> class CollabList {
|
||||||
std::function<void(const ObjectInfoPtr& c)> clientInsertCallback;
|
std::function<void(const ObjectInfoPtr& c)> clientInsertCallback;
|
||||||
std::function<void(const ObjectInfoPtr& c)> clientEraseCallback;
|
std::function<void(const ObjectInfoPtr& c)> clientEraseCallback;
|
||||||
std::function<void(const std::vector<ObjectInfoPtr>& c)> clientInsertOrderedVectorCallback;
|
std::function<void(const std::vector<ObjectInfoPtr>& c)> clientInsertOrderedVectorCallback;
|
||||||
std::function<void(uint64_t oldPos)> clientServerLastPosShiftCallback;
|
std::function<void(uint64_t oldPos)> clientServerFirstPosShiftCallback;
|
||||||
|
|
||||||
void set_server_from_client_list() {
|
void set_server_from_client_list() {
|
||||||
serverSideList = clientSideList;
|
serverSideList = clientSideList;
|
||||||
|
|
@ -144,11 +145,11 @@ template <typename T, typename IDType> class CollabList {
|
||||||
bool erasedSomething = false;
|
bool erasedSomething = false;
|
||||||
std::erase_if(clientSideList, [&](const auto& obj) {
|
std::erase_if(clientSideList, [&](const auto& obj) {
|
||||||
if(objSet.contains(obj)) {
|
if(objSet.contains(obj)) {
|
||||||
obj->syncIgnore = true;
|
|
||||||
obj->obj->collabListInfo.reset();
|
|
||||||
idToObjectMap.erase(obj->id);
|
|
||||||
if(clientEraseCallback)
|
if(clientEraseCallback)
|
||||||
clientEraseCallback(obj);
|
clientEraseCallback(obj);
|
||||||
|
idToObjectMap.erase(obj->id);
|
||||||
|
obj->syncIgnore = true;
|
||||||
|
obj->obj->collabListInfo.reset();
|
||||||
erasedSomething = true;
|
erasedSomething = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -333,19 +334,19 @@ template <typename T, typename IDType> class CollabList {
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
void complete_client_pos_refresh(bool syncFromServer) {
|
void complete_client_pos_refresh(bool syncFromServer) {
|
||||||
uint64_t lastShiftPos = 0;
|
uint64_t firstShiftPos = std::numeric_limits<uint64_t>::max();
|
||||||
bool shiftHappened = false;
|
bool shiftHappened = false;
|
||||||
for(uint64_t i = 0; i < clientSideList.size(); i++) {
|
for(uint64_t i = 0; i < clientSideList.size(); i++) {
|
||||||
auto& c = clientSideList[i];
|
auto& c = clientSideList[i];
|
||||||
if(c->pos != i) {
|
if(c->pos != i) {
|
||||||
lastShiftPos = std::max(lastShiftPos, c->pos);
|
firstShiftPos = std::min(firstShiftPos, c->pos);
|
||||||
lastShiftPos = std::max(lastShiftPos, i);
|
firstShiftPos = std::min(firstShiftPos, i);
|
||||||
shiftHappened = true;
|
shiftHappened = true;
|
||||||
c->pos = i;
|
c->pos = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(syncFromServer && shiftHappened && clientServerLastPosShiftCallback)
|
if(syncFromServer && shiftHappened && clientServerFirstPosShiftCallback)
|
||||||
clientServerLastPosShiftCallback(lastShiftPos);
|
clientServerFirstPosShiftCallback(firstShiftPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_pos_refresh_after_insert(uint64_t posToRefreshAfter) {
|
void client_pos_refresh_after_insert(uint64_t posToRefreshAfter) {
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,9 @@ DrawingProgram::DrawingProgram(World& initWorld):
|
||||||
for(auto& c : comps)
|
for(auto& c : comps)
|
||||||
components.clientInsertCallback(c);
|
components.clientInsertCallback(c);
|
||||||
};
|
};
|
||||||
components.clientServerLastPosShiftCallback = [&](uint64_t lastShiftPos) {
|
components.clientServerFirstPosShiftCallback = [&](uint64_t firstShiftPos) {
|
||||||
compCache.invalidate_cache_before_pos(lastShiftPos);
|
compCache.clear_own_cached_surfaces();
|
||||||
|
selection.clear_own_cached_surfaces();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,10 @@ void DrawingProgramSelection::invalidate_cache_at_optional_aabb_before_pos(const
|
||||||
cache.invalidate_cache_at_optional_aabb_before_pos(aabb, placementToInvalidateAt);
|
cache.invalidate_cache_at_optional_aabb_before_pos(aabb, placementToInvalidateAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawingProgramSelection::clear_own_cached_surfaces() {
|
||||||
|
cache.clear_own_cached_surfaces();
|
||||||
|
}
|
||||||
|
|
||||||
void DrawingProgramSelection::preupdate_component(const CollabListType::ObjectInfoPtr& objToCheck) {
|
void DrawingProgramSelection::preupdate_component(const CollabListType::ObjectInfoPtr& objToCheck) {
|
||||||
cache.preupdate_component(objToCheck);
|
cache.preupdate_component(objToCheck);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class DrawingProgramSelection {
|
||||||
bool is_being_transformed();
|
bool is_being_transformed();
|
||||||
|
|
||||||
void invalidate_cache_at_optional_aabb_before_pos(const std::optional<SCollision::AABB<WorldScalar>>& aabb, uint64_t placementToInvalidateAt);
|
void invalidate_cache_at_optional_aabb_before_pos(const std::optional<SCollision::AABB<WorldScalar>>& aabb, uint64_t placementToInvalidateAt);
|
||||||
|
void clear_own_cached_surfaces();
|
||||||
void preupdate_component(const CollabListType::ObjectInfoPtr& objToCheck);
|
void preupdate_component(const CollabListType::ObjectInfoPtr& objToCheck);
|
||||||
private:
|
private:
|
||||||
std::function<bool(const std::shared_ptr<DrawingProgramCacheBVHNode>&, std::vector<CollabListType::ObjectInfoPtr>&)> erase_select_objects_in_bvh_func(std::unordered_set<CollabListType::ObjectInfoPtr>& selectedComponents, const SCollision::ColliderCollection<float>& cC, const SCollision::ColliderCollection<WorldScalar>& cCWorld);
|
std::function<bool(const std::shared_ptr<DrawingProgramCacheBVHNode>&, std::vector<CollabListType::ObjectInfoPtr>&)> erase_select_objects_in_bvh_func(std::unordered_set<CollabListType::ObjectInfoPtr>& selectedComponents, const SCollision::ColliderCollection<float>& cC, const SCollision::ColliderCollection<WorldScalar>& cCWorld);
|
||||||
|
|
|
||||||
|
|
@ -4,19 +4,19 @@
|
||||||
#include <include/codec/SkBmpDecoder.h>
|
#include <include/codec/SkBmpDecoder.h>
|
||||||
#include <include/codec/SkIcoDecoder.h>
|
#include <include/codec/SkIcoDecoder.h>
|
||||||
#include <include/codec/SkGifDecoder.h>
|
#include <include/codec/SkGifDecoder.h>
|
||||||
#include <include/codec/SkRawDecoder.h>
|
//#include <include/codec/SkRawDecoder.h>
|
||||||
#include <include/codec/SkWbmpDecoder.h>
|
#include <include/codec/SkWbmpDecoder.h>
|
||||||
#include <include/codec/SkWebpDecoder.h>
|
#include <include/codec/SkWebpDecoder.h>
|
||||||
#include "../MainProgram.hpp"
|
#include "../MainProgram.hpp"
|
||||||
#include <Helpers/Logger.hpp>
|
#include <Helpers/Logger.hpp>
|
||||||
|
|
||||||
std::array<const SkCodecs::Decoder, 8> decoders = {
|
std::array<const SkCodecs::Decoder, 7> decoders = {
|
||||||
SkBmpDecoder::Decoder(),
|
SkBmpDecoder::Decoder(),
|
||||||
SkGifDecoder::Decoder(),
|
SkGifDecoder::Decoder(),
|
||||||
SkIcoDecoder::Decoder(),
|
SkIcoDecoder::Decoder(),
|
||||||
SkJpegDecoder::Decoder(),
|
SkJpegDecoder::Decoder(),
|
||||||
SkPngDecoder::Decoder(),
|
SkPngDecoder::Decoder(),
|
||||||
SkRawDecoder::Decoder(),
|
// SkRawDecoder::Decoder(),
|
||||||
SkWbmpDecoder::Decoder(),
|
SkWbmpDecoder::Decoder(),
|
||||||
SkWebpDecoder::Decoder()
|
SkWebpDecoder::Decoder()
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue