2#include "ViewContext.h"
3#include "Resources/DataFetcherManager.h"
4#include "Resources/MaterialManager.h"
5#include "ExtensionRegistry.h"
6#include "Services/DPIService.h"
8#include "Services/Services.h"
9#include "Generators/TextureGenerator.h"
11#include "Systems/Core/TransformSystem.h"
12#include "Systems/Core/ClipShapeSystem.h"
14#include "PotreeSystem.h"
15#include "PotreeRenderer.h"
17#include "Rendering/IGraphicsDevice.h"
18#include "Rendering/ICapabilities.h"
19#include "Foundation/Logging/Logger.h"
20#include "Foundation/Platform/IO.h"
24 const Cogs::StringView spacingGlobalScaleName =
"potree.spacing.globalScale";
25 const Cogs::StringView pointSizeGlobalMinScaleName =
"potree.pointSize.globalMinScale";
26 const Cogs::StringView pointSizeGlobalMaxScaleName =
"potree.pointSize.globalMaxScale";
27 const Cogs::StringView pointSizeGlobalScaleName =
"potree.pointSize.globalScale";
41 static uint32_t idCounter = 1;
42 if (idCounter == 0) idCounter++;
50 unsigned popcount(uint8_t x)
52 x = (x & 0x55u) + ((x >> 1) & 0x55u);
53 x = (x & 0x33u) + ((x >> 2) & 0x33u);
54 x = (x & 0x0Fu) + ((x >> 4) & 0x0Fu);
66 poSystem->requestsInFlight++;
67 poData->fetch_id = DataFetcherManager::fetchAsync(context, poData->
jsonPath, [context, instanceId=poData->instanceId](std::unique_ptr<Cogs::FileContents> data)
69 auto task = [context, instanceId, dataPtr = data.release()]()
71 std::unique_ptr<Cogs::FileContents> data(dataPtr);
72 PotreeSystem* poSystem = nullptr;
73 PotreeComponent* poComp = nullptr;
74 PotreeData* poData = nullptr;
75 bool ret = PotreeSystem::lookupAndCheckForStaleness(context, poSystem, poData, poComp, instanceId);
76 poSystem->requestsInFlight--;
77 PotreeSystem::endFetch(context, poComp, poData);
81 LOG_TRACE(logger,
"[instance=%u] Received stale metadata file, ignoring: %.*s", instanceId, StringViewFormat(data->origin()));
85 else if (poData->state != PotreeState::RequestedCloudJS) {
87 LOG_ERROR(logger,
"[instance=%u] Unexpected metadata file, ignoring: %.*s", instanceId, StringViewFormat(data->origin()));
90 LOG_ERROR(logger,
"[instance=%u] Unexpected metadata file", instanceId);
94 LOG_ERROR(logger,
"[instance=%u] Failed to get metadata file: %s", instanceId, poData ? poData->jsonPath.c_str() :
"");
95 poData->state = PotreeState::Error;
97 else if (!parseCloudJs(context, poSystem, poData, data.get())) {
98 LOG_ERROR(logger,
"[instance=%u] Error while parsing metadata file", instanceId);
99 poData->state = PotreeState::Error;
102 LOG_TRACE(logger,
"[instance=%u] metadata parsed successfully", instanceId);
103 poData->state = PotreeState::ParsedCloudJs;
106 poData->fetch_id = DataFetcherManager::NoFetchId;
107 context->engine->setDirty();
110 context->
engine->runTaskInMainThread(std::move(task));
111 }, 0, 0,
true, Cogs::FileContentsHints::None);
119 poData->pointMaterial.instance->setVariant(
"UseInstancing", poSystem->useInstancing);
121 poData->pointMaterial.pointSize = PM->getFloatKey(
"pointSize");
122 poData->pointMaterial.shadingIntensity = PM->getFloatKey(
"shadingIntensity");
123 poData->pointMaterial.octTexScale = PM->getFloatKey(
"octTexScale");
124 poData->pointMaterial.minPointSize = PM->getFloatKey(
"minPointSize");
125 poData->pointMaterial.maxPointSize = PM->getFloatKey(
"maxPointSize");
126 poData->pointMaterial.outlineSize = PM->getFloatKey(
"outlineSize");
127 poData->pointMaterial.outlineColor = PM->getVec3Key(
"outlineColor");
128 poData->pointMaterial.baseColor = PM->getVec4Key(
"baseColor");
129 poData->pointMaterial.invShift = PM->getVec3Key(
"invShift");
130 poData->pointMaterial.invScale = PM->getVec3Key(
"invScale");
131 poData->pointMaterial.gradient = PM->getTextureKey(
"Gradient");
133 auto* BM = poData->boxMaterial.instance->
material;
134 poData->boxMaterial.scale = BM->getVec3Key(
"scale");
135 poData->boxMaterial.offset = BM->getVec3Key(
"offset");
140 float minPointSize = poData->pointSize.
min;
141 float maxPointSize = poData->pointSize.
max;
142 float pointSize = poData->pointSize.
val;
146 float rawPointSize = pointSize / context->getDefaultView()->
dpiService->getScaleFactor();
147 float pointSizeScale = glm::clamp(rawPointSize / 10.f, 1e-2f, 1e2f);
148 poData->modelSpaceRadius = 0.5f * pointSizeScale * poData->spacing;
150 auto& PM = poData->pointMaterial;
151 bool hasFragDepth = context->device->getCapabilities()->getDeviceCapabilities().FragDepth;
153 case PotreePointShape::Square:
154 PM.instance->setVariant(
"Shape",
"Square");
155 hasFragDepth =
false;
157 case PotreePointShape::Disc:
158 PM.instance->setVariant(
"Shape",
"Disc");
159 hasFragDepth =
false;
161 case PotreePointShape::Paraboloid:
162 PM.instance->setVariant(
"Shape", hasFragDepth ?
"Paraboloid" :
"Square");
164 case PotreePointShape::Sphere:
165 PM.instance->setVariant(
"Shape", hasFragDepth ?
"Sphere" :
"Disc");
168 LOG_FATAL(logger,
"Component member pointShape has illegal enum value: %u",
unsigned(poComp->
pointShape));
169 poComp->
pointShape = PotreePointShape::Square;
170 PM.instance->setVariant(
"Shape",
"Square");
171 hasFragDepth =
false;
176 PM.instance->setVariant(
"CustomDepth", hasFragDepth);
180 case PotreePointSizing::FixedSize:
181 PM.instance->setVariant(
"PointSizing",
"FixedSize");
183 case PotreePointSizing::DistanceScaled:
184 PM.instance->setVariant(
"PointSizing",
"DistanceScaled");
186 case PotreePointSizing::DistanceAndDensityScaled:
187 PM.instance->setVariant(
"PointSizing",
"DistanceAndDensityScaled");
190 LOG_FATAL(logger,
"Component member pointSizing has illegal enum value: %u",
unsigned(poComp->
pointSizing));
191 poComp->
pointSizing = PotreePointSizing::FixedSize;
192 PM.instance->setVariant(
"PointSizing",
"FixedSize");
198 case PotreeShading::Flat:
199 PM.instance->setVariant(
"BasicShading",
false);
201 case PotreeShading::Basic:
202 PM.instance->setVariant(
"BasicShading",
true);
205 LOG_FATAL(logger,
"Component member shading has illegal enum value: %u",
unsigned(poComp->
shading));
206 poComp->
shading = PotreeShading::Flat;
207 PM.instance->setVariant(
"BasicShading",
false);
212 case PotreeColoring::Base:
213 PM.instance->setVariant(
"HasColor",
false);
214 PM.instance->setVariant(
"HasIntensity",
false);
215 PM.instance->setVariant(
"Coloring",
"Base");
217 case PotreeColoring::Color:
218 PM.instance->setVariant(
"HasColor", poData->hasColor);
219 PM.instance->setVariant(
"HasIntensity",
false);
220 PM.instance->setVariant(
"Coloring", poData->hasColor ?
"Color" :
"Base");
222 case PotreeColoring::Intensity:
223 PM.instance->setVariant(
"HasColor",
false);
224 PM.instance->setVariant(
"HasIntensity", poData->hasIntensity);
225 PM.instance->setVariant(
"Coloring", poData->hasIntensity ?
"Intensity" :
"Base");
227 case PotreeColoring::Level:
228 PM.instance->setVariant(
"HasColor",
false);
229 PM.instance->setVariant(
"HasIntensity",
false);
230 PM.instance->setVariant(
"Coloring",
"Level");
233 LOG_FATAL(logger,
"Component member coloring has illegal enum value: %u",
unsigned(poComp->
coloring));
234 poComp->
coloring = PotreeColoring::Base;
235 PM.instance->setVariant(
"Coloring",
"Base");
238 PM.instance->setVariant(
"Outline", poComp->
outlineSize != 0.f);
239 PM.instance->setVariant(
"ClipPlanes",
static_cast<int>(poData->clipPlaneCount));
241 if (PM.pointSize != NoProperty) PM.instance->
setFloatProperty(PM.pointSize, pointSize);
243 if (PM.octTexScale != NoProperty) PM.instance->
setFloatProperty(PM.octTexScale, 1.f / poData->octtreeTextureData.size());
244 if (PM.minPointSize != NoProperty) PM.instance->
setFloatProperty(PM.minPointSize, minPointSize);
245 if (PM.maxPointSize != NoProperty) PM.instance->
setFloatProperty(PM.maxPointSize, maxPointSize);
251 if (PM.invShift != NoProperty) PM.instance->
setVec3Property(PM.invShift, 0.5f * (poData->octtreeFrame.tightBBoxMax - poData->octtreeFrame.tightBBoxMin));
252 if (PM.invScale != NoProperty) PM.instance->
setVec3Property(PM.invScale, glm::vec3(1.f) / (poData->octtreeFrame.fullBBoxMax - poData->octtreeFrame.fullBBoxMin));
254 auto& BM = poData->boxMaterial;
255 if (BM.scale != NoProperty) BM.instance->
setVec3Property(BM.scale, poData->octtreeFrame.fullBBoxSize);
256 if (BM.offset != NoProperty) BM.instance->setVec3Property(BM.offset,-poData->octtreeFrame.currentPositionInEntityFrame);
261 poData->instanceId = createId();
262 poData->pointMaterial.instance = context->materialInstanceManager->createMaterialInstance(system->defaultPointMaterial);
263 poData->boxMaterial.instance = context->materialInstanceManager->createMaterialInstance(system->defaultBoxMaterial);
264 setUpMaterial(context, system, poComp, poData);
269 LOG_DEBUG(logger,
"[instance=%u] Releasing resources (%s)", poData->instanceId, poData->
jsonPath.c_str());
270 while (!poData->subtrees.empty()) {
271 auto* subtree = poData->subtrees.shift();
272 subtree->release(context, poData);
273 poData->subtreeStore.destroy(subtree);
275 DataFetcherManager::cancelAsyncFetch(context, poData->fetch_id);
276 poData->fetch_id = DataFetcherManager::NoFetchId;
277 assert(poData->subtrees.empty());
278 assert(poData->cellStore.size() == 0);
279 assert(poData->subtreeStore.size() == 0);
280 poData->~PotreeData();
282 initComponentData(context, system, poComp, poData);
287PotreeVertexLayoutInfo Cogs::Core::PotreeSystem::vertexLayoutInfo[
static_cast<size_t>(PotreeVertexLayout::COUNT)] =
290 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
292 { 0, 3 * 4, ~0u, ~0u, ~0u, 4 * 4, {
297 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
299 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
301 { 0, ~0u, ~0u, 3 * 4, ~0u, 4 * 4, {
306 { 0, 4 * 4, ~0u, 3 * 4, ~0u, 5 * 4, {
312 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
314 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
316 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
318 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
320 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
322 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
324 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
326 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
328 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
330 { ~0u, ~0u, ~0u, ~0u, ~0u, ~0u, {}},
338 if (parent ==
nullptr && !poData->subtrees.empty()) {
339 LOG_FATAL(logger,
"[instanceId=%u] Fetching root node but subtree array is not empty.", poData->instanceId);
340 assert(parent !=
nullptr || poData->subtrees.empty());
343 subtree = poData->subtrees.push(poData->subtreeStore.create());
344 subtree->subtreeId = createId();
345 subtree->fetchLayoutAndInitialize(
context,
this, poComp, poData, parent);
350 potreeSystem = ExtensionRegistry::getExtensionSystem<PotreeSystem>(context);
351 for (
auto& poComp_ : potreeSystem->
pool) {
354 PotreeData* poData_ = poDataHolder.poData.get();
357 if (poData_->instanceId == instanceId) {
363 LOG_TRACE(logger,
"[instance=%u] Failed to lookup instance, doesn't exist anymore.", instanceId);
369 if (lookupAndCheckForStaleness(context, potreeSystem, poData, poComp, instanceId)) {
370 for (
auto* item : poData->subtrees) {
371 if (item->subtreeId == subtreeId) {
377 LOG_TRACE(logger,
"[instance=%u,tree=%u] Failed to lookup subtree, doesn't exist anymore.", instanceId, subtreeId);
385 useInstancing =
true;
387 if (
Variable* var = context->
variables->getIfExists(
"potree.renderAsPoints"); var) {
388 useInstancing = !var->getBool(useInstancing);
391 LOG_DEBUG(logger,
"Render points as %s", useInstancing ?
"instanced quads" :
"points");
404 defaultGradient = texGen->getTexture(Cogs::Core::ImageType::GradientHeat);
406 if (!context->
variables->exist(spacingGlobalScaleName)) {
407 context->
variables->set(spacingGlobalScaleName, 1.f);
410 if (!context->
variables->exist(pointSizeGlobalScaleName)) {
411 context->
variables->set(pointSizeGlobalScaleName, 1.f);
414 if (!context->
variables->exist(pointSizeGlobalMinScaleName)) {
415 context->
variables->set(pointSizeGlobalMinScaleName, 1.f);
418 if (!context->
variables->exist(pointSizeGlobalMaxScaleName)) {
419 context->
variables->set(pointSizeGlobalMaxScaleName, 1.f);
432 if (!materialLoaded) {
433 context->materialManager->loadMaterial(
"Materials/PotreeBoxCore.material");
434 context->materialManager->loadMaterial(
"Materials/PotreePointCore.material");
435 defaultBoxMaterial = context->materialManager->loadMaterial(
"Materials/PotreeBoxDefault.material");
436 defaultPointMaterial = context->materialManager->loadMaterial(
"Materials/PotreePointDefault.material");
437 context->materialManager->processLoading();
439 materialLoaded =
true;
444 auto& poDataHolder = getData(poComp);
445 poDataHolder.poData = std::make_unique<PotreeData>();
446 initComponentData(context,
this, poComp, poDataHolder.poData.get());
448 if(pool.size() == 1) {
449 assert(bounds ==
nullptr);
451 context->
bounds->addBoundsExtension(bounds);
453 assert(picker ==
nullptr);
457 LOG_DEBUG(logger,
"Registered potree bounds and picker extensions");
468 if (pool.size() == 0) {
470 context->
bounds->removeBoundsExtension(bounds);
479 LOG_DEBUG(logger,
"Last component destroyed, unregistered potree bounds and picker extensions");
486 CpuInstrumentationScope(SCOPE_POTREE,
"PotreeSystem::preUpdate");
488 for (
auto& poComp : pool) {
493 PotreeData* poData = poDataHolder.poData.get();
497 poData->octtreeFrame.currentPositionInEntityFrame = poData->octtreeFrame.positionInEntityFrame;
500 poData->octtreeFrame.currentPositionInEntityFrame = glm::vec3(0.f);
503 poData->octtreeFrame.currentPositionInEntityFrame = glm::vec3(0.f);
504 if (trComp->
coordinates != poData->octtreeFrame.positionInEntityFrame) {
505 trComp->
coordinates = poData->octtreeFrame.positionInEntityFrame;
518 const glm::vec3& o = poData.octtreeFrame.currentPositionInEntityFrame;
520 poData.worldFromOcttreeFrame = context->transformSystem->getLocalToWorld(transformComp) * glm::mat4(1.f, 0.f, 0.f, 0.f,
530 CpuInstrumentationScope(SCOPE_POTREE,
"PotreeSystem::update");
532 const float spacingGlobalScale = context->
variables->get(spacingGlobalScaleName, 1.f);
533 const float pointSizeGlobalMinScale = context->
variables->get(pointSizeGlobalMinScaleName, 1.f);
534 const float pointSizeGlobalMaxScale = context->
variables->get(pointSizeGlobalMaxScaleName, 1.f);
535 const float pointSizeGlobalScale = context->
variables->get(pointSizeGlobalScaleName, 1.f);
537 for (
auto& poComp : pool) {
539 bool notifyRunning =
false;
541 PotreeData* poData = poDataHolder.poData.get();
544 if (poData->state != PotreeState::Uninitialized) {
545 resetComponentData(context,
this, &poComp, poData);
546 assert(poData->state == PotreeState::Uninitialized);
552 if (poData->state != PotreeState::Uninitialized &&
556 resetComponentData(context,
this, &poComp, poData);
557 assert(poData->state == PotreeState::Uninitialized);
560 if (poData->state == PotreeState::Uninitialized) {
564 if (
size_t o = poData->
jsonPath.find_last_of(
"\\/"); o != std::string::npos) {
571 poData->instanceId = createId();
572 poData->state = PotreeState::RequestedCloudJS;
573 issueCloudJSFetch(context,
this, &poComp, poData);
578 if (poData->state == PotreeState::ParsedCloudJs) {
579 poData->state = PotreeState::Running;
580 notifyRunning =
true;
581 issueSubtreeFetch(context, &poComp, poData,
nullptr);
585 bool materialChanged =
false;
588 materialChanged = materialChanged || (poData->clipPlaneCount != 0);
592 if (
EntityPtr clipCompEntity = clipRefComp->clipShape.lock(); clipCompEntity) {
606 for (
size_t i = 0; i < clipPlaneCount; i++) {
610 materialChanged = materialChanged || (poData->clipPlaneCount != clipPlaneCount);
611 poData->clipPlaneCount = clipPlaneCount;
616 if (poData->pointMaterial.instance != poComp.
pointMaterial) {
617 LOG_DEBUG(logger,
"Using point material instance from component, state=%u", uint32_t(poData->state));
619 materialChanged =
true;
623 if (!poData->pointMaterial.instance || poData->pointMaterial.instance->
material != defaultPointMaterial.resolve()) {
624 LOG_DEBUG(logger,
"Creating default point material instance, state=%u", uint32_t(poData->state));
625 poData->pointMaterial.instance = context->materialInstanceManager->createMaterialInstance(defaultPointMaterial);
626 materialChanged =
true;
631 if (poData->boxMaterial.instance != poComp.
boxMaterial) {
632 LOG_DEBUG(logger,
"Using box material instance from component, state=%u", uint32_t(poData->state));
634 materialChanged =
true;
638 if (!poData->boxMaterial.instance || poData->boxMaterial.instance->
material != defaultBoxMaterial.resolve()) {
639 LOG_DEBUG(logger,
"Creating default box material instance, state=%u", uint32_t(poData->state));
640 poData->boxMaterial.instance = context->materialInstanceManager->createMaterialInstance(defaultBoxMaterial);
641 materialChanged =
true;
644 if (materialChanged) setUpMaterial(context,
this, &poComp, poData);
647 updateOcttreeFrame(context, *poData, poComp);
649 float gridSize = std::max(1.f, poData->octtreeFrame.fullBBoxSize.x / poData->spacing);
650 float dpiScale = context->getDefaultView()->
dpiService->getScaleFactor();
651 poData->tolerance = std::max(1.f, dpiScale * gridSize * spacingGlobalScale * poComp.
pointScreenSpacing);
658 poData->pointSize.
min = pointSizeGlobalMinScale * dpiScale * poComp.
minPointSize;
659 poData->pointSize.
max = pointSizeGlobalMaxScale * dpiScale * poComp.
maxPointSize;
660 poData->pointSize.
val = glm::clamp(pointSizeGlobalScale * dpiScale * poComp.
pointSize, poData->pointSize.
min, poData->pointSize.
max);
667 refreshMaterialInstances(context,
this, &poComp, poData);
673 updateLodLevels(context);
693 if (poComp && poData) {
698 LOG_ERROR(logger,
"endFetch: Too many endFetch received");
void setChanged()
Sets the component to the ComponentFlags::Changed state with carry.
ComponentType * getComponent() const
Sets up a clipping shape that can be used by multiple entities.
Component that attaches a ClipShape to an entity.
virtual ComponentHandle createComponent()
Create a new component instance.
Context * context
Pointer to the Context instance the system lives in.
virtual void initialize(Context *context)
Initialize the system.
virtual void destroyComponent(ComponentHandle)
Destroy the component held by the given handle.
void update()
Updates the system state to that of the current frame.
void preUpdate()
Run the pre-update method of the system.
ComponentPool< ComponentType > pool
Pool of components managed by the system.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
std::unique_ptr< class Services > services
Services.
class IRenderer * renderer
Renderer.
std::unique_ptr< class Bounds > bounds
Bounds service instance.
std::unique_ptr< class RayPicking > rayPicking
RayPicking service instance.
std::unique_ptr< class Variables > variables
Variables service instance.
std::unique_ptr< class Engine > engine
Engine instance.
virtual void registerExtension(IRendererExtension *extension)=0
Register an extension with the renderer.
virtual void unregisterExtension(IRendererExtension *extension)=0
Unregister an extension with the renderer.
ComponentModel::ComponentHandle clipShapeComponent
Handle to the currently active clip component, if any.
constexpr bool isVisible() const
Check if the entity is visible or not.
std::unique_ptr< class DPIService > dpiService
DPI service instance.
Log implementation class.
Provides a weakly referenced view over the contents of a string.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
std::shared_ptr< ComponentModel::Entity > EntityPtr
Smart pointer for Entity access.
@ FetchingBegin
Loading queue transitions from empty to non-empty, that is, instance needs data.
@ FetchingEnd
Loading queue transitions from non-empty to empty, that is, instance has all data it currently needs.
@ Ready
CloudJS has been parsed and we know bounds etc.
bool HandleIsValid(const ResourceHandle_t< T > &handle)
Check if the given resource is valid, that is not equal to NoHandle or InvalidHandle.
@ CenterOnOrigin
Adjust offset s.t. point cloud is centered around entity origin.
@ None
Just use scale and offset as is.
@ CenterOnOriginAdjustCoordinate
Adjust offset s.t. point cloud is centered around enttiy origin and adjust transformcomponent coordin...
constexpr Log getLogger(const char(&name)[LEN]) noexcept
@ OpenGLES30
Graphics device using the OpenGLES 3.0 API.
@ InstanceData
Per instance data.
@ VertexData
Per vertex data.
@ Position
Position semantic.
@ TextureCoordinate
Texture coordinate semantic.
Handle to a Component instance.
COGSFOUNDATION_API class Component * resolve() const
Resolve the handle, returning a pointer to the held Component instance.
static ComponentHandle Empty()
Returns an empty, invalid handle. Will evaluate to false if tested against using operator bool().
void setVec3Property(const VariableKey key, glm::vec3 value)
Set the vec3 property with the given key to value.
Material * material
Material resource this MaterialInstance is created from.
Material resources define the how of geometry rendering (the what is defined by Mesh and Texture reso...
void setFloatProperty(const VariableKey key, float value)
Set the float property with the given key to value.
void setVec4Property(const VariableKey key, glm::vec4 value)
Set the vec4 property with the given key to value.
void setTextureProperty(const VariableKey key, TextureHandle value)
Set the texture property with the given key to the texture resource held by value.
void setVec3Property(const VariableKey key, glm::vec3 value)
Set the vec3 property with the given key to value.
void setTextureAddressMode(const VariableKey key, SamplerState::AddressMode mode)
Set the address mode used for the texture property with the given key to mode.
Component for Point Cloud Display.
float maxPointSize
Maximum point size in pixels regardless of point size strategy, gets DPI scaled.
std::vector< glm::vec4 > clipPlanes
Deprecated, use clip shapes instead.
MaterialInstanceHandle boxMaterial
Optional debug material override, material should inherit from PotreeBoxCore.material.
float shadingIntensity
Intensity of point shading effect, if enabled.
float pointSize
Base point size in pixels, gets DPI scaled.
float outlineSize
Size of point outlines, set to 0.0 to disable point outlines.
PotreeColoring coloring
Specify coloring strategy.
TextureHandle gradient
Optional gradient texture to colorize scalar values.
std::string source
URL of path where metadata.js(OLD format: cloud.js) resides.
MaterialInstanceHandle pointMaterial
Optional point material override, material should inherit from PotreePointCore.material.
glm::vec3 outlineColor
Color of point outlines if enabled.
float rootNodeMinScreenSize
Minimal screen-space size root node can have before being eligble for distance-based culling.
PotreeShading shading
Specify optional shading.
PotreePointShape pointShape
Specify point shape.
glm::vec4 baseColor
Base color to use when Base coloring strategy is used.
float densityBias
DistanceAndDensityScaled: Offset where depth and density starts to affectg point size calc.
PotreePointSizing pointSizing
Specify point sizing strategy.
bool disableCustomClipping
Debug switch to disable clipping of points against custom clipping planes.
float densityLevelScale
DistanceAndDensityScaled: Strength of level depth in point size calc.
bool supportPicking
If true, an extra CPU side copy of the point positions are maintained to enable CPU picking.
float pointScreenSpacing
Maximal screen space distance between points before refining, gets adjusted by DPI scaling.
float densityScale
DistanceAndDensityScaled: Strength of local point density in point size calc.
PotreeOriginPolicy originPolicy
Specify origin policy, see enum for details.
PotreeDebugBoxes debugBoxes
Specify optional debug graphics.
float minPointSize
Minimum point size in pixels regardless of point size strategy, gets DPI scaled.
uint32_t requestsInFlight
Number of outstanding data fetch requests.
float val
Current dpi-scaled and min-max clamped point-size.
float min
Current dpi-scaled minimum point-size.
float max
Current dpi-scaled maximum point-size.
static constexpr size_t MaxClipPlanes
Max available in shader.
std::string jsonPath
URL to metadata file.
PotreeNotification potreeNotificationState
Current notification state for this PoTree Component.
std::string rootPath
URL to folder containing metadata file.
ComponentHandle createComponent() override
static void startFetch(Context *context, const PotreeComponent *poComp, PotreeData *poData)
Update Component request count and notify client when starting data fetch.
void destroyComponent(ComponentHandle component) override
void cleanup(Context *context) override
Provided for custom cleanup logic in derived systems.
void initialize(Context *context) override
Initialize the system.
static void endFetch(Context *context, const PotreeComponent *poComp, PotreeData *poData)
Runtime control variable.
Abstract base class storing data read from a file.
@ Clamp
Texture coordinates are clamped to the [0, 1] range.
Vertex element structure used to describe a single data element in a vertex for the input assembler.
InputType inputType
Input type of the element, vertex or instance data.
uint16_t instanceStep
Instance step factor.