2#include <glm/gtc/type_ptr.hpp>
5#include "EntityStore.h"
6#include "Resources/MeshManager.h"
7#include "Components/Core/MeshComponent.h"
8#include "Components/Core/MeshRenderComponent.h"
9#include "Components/Core/SceneComponent.h"
10#include "Components/Appearance/MaterialComponent.h"
12#include "../Components/BeamGroupComponent.h"
13#include "../Components/DataSetComponent.h"
14#include "../Components/WindowComponent.h"
15#include "../Components/DataRefComponent.h"
16#include "DataSetSystem.h"
17#include "SwathBottomSystem.h"
19#include "../Tasks/SwathSeabedBuildMeshTask.h"
28 bool activateMeshes =
false;
29 for (
auto & surfComp : pool) {
30 auto & surfData = getData(&surfComp);
34 if (!winComp || !groupComp || !groupComp->sane || groupComp->majorCount != 1)
continue;
39 const auto & dataData = dataSetSystem->getData(dataComp);
41 if ((surfData.beamGroupGen != groupComp->gen)
42 || (surfData.pathSpacing != winComp->pathSpacing)
43 || (surfData.beamSpacing != winComp->beamSpacing))
45 surfData.pathSpacing = winComp->pathSpacing;
46 surfData.beamSpacing = winComp->beamSpacing;
47 surfData.beamGroupGen = groupComp->gen;
48 surfData.resamplingPositions.clear(surfData.pathSpacing, context->
variables->get(
"echo.maxPathUpsample")->getFloat());
49 surfData.chunks.clear();
50 surfData.meshManager.clear();
51 surfData.runMeshManager =
true;
56 bool resampleSitesChanged;
57 if (sceneComp->visible) {
58 resampleSitesChanged = surfData.resamplingPositions.update(winComp, dataComp, &dataData);
61 resampleSitesChanged = surfData.resamplingPositions.clear(surfData.pathSpacing, context->
variables->get(
"echo.maxPathUpsample")->getFloat());
63 if (resampleSitesChanged) {
64 if (surfData.chunks.update(surfData.resamplingPositions)) {
65 surfData.runMeshManager =
true;
69 if (surfData.meshManager.ready() && surfData.runMeshManager) {
73 SwathPathMeshManager::CreateBuildFunc createBuildFunc = [context, groupComp, &surfComp, &surfData, &dataData](
MeshHandle& mesh, uint32_t chunkIndex) ->
TaskFunction
78 SwathPathMeshManager::CreateEntity createEntity = [context, containerPtr]() ->
EntityPtr
86 SwathPathMeshManager::ActivateEntity activateEntity = [](
EntityPtr , uint32_t )
93 surfData.runMeshManager = surfData.meshManager.update(context,
98 activateMeshes =
true;
101 if (!surfData.meshManager.ready()) {
102 context->
engine->triggerUpdate();
108 if (activateMeshes) {
109 context->
engine->swapResources();
ComponentType * getComponent() const
class Entity * getContainer() const
Get the container currently owning this component instance.
Context * context
Pointer to the Context instance the system lives in.
virtual void initialize(Context *context)
Initialize the system.
void update()
Updates the system state to that of the current frame.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
class EntityStore * store
Entity store.
std::unique_ptr< class Variables > variables
Variables service instance.
std::unique_ptr< class Engine > engine
Engine instance.
EntityPtr getEntity(const StringView &name, bool logIfNotFound=true) const
Retrieve a reference to the shared entity pointer to the Entity with the given name.
EntityPtr createChildEntity(const StringView &type, ComponentModel::Entity *parent, const StringView &name=StringView())
Create a new Entity, parenting it to the given parent.
Contains information on how the entity behaves in the scene.
std::function< void()> TaskFunction
Type of task function used by the task manager.
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
void initialize(Context *context) override
Initialize the system.
Exposes material properties for legacy entities and code.