Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/materials/point-cloud-material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export interface IPointCloudMaterialUniforms {
wSourceID: IUniform<number>;
opacityAttenuation: IUniform<number>;
filterByNormalThreshold: IUniform<number>;
classificationFilter: IUniform<boolean[]>;
highlightedPointCoordinate: IUniform<Vector3>;
highlightedPointColor: IUniform<Vector4>;
enablePointHighlighting: IUniform<boolean>;
Expand Down Expand Up @@ -236,6 +237,7 @@ export class PointCloudMaterial extends RawShaderMaterial {
wSourceID: makeUniform('f', 0),
opacityAttenuation: makeUniform('f', 1),
filterByNormalThreshold: makeUniform('f', 0),
classificationFilter: makeUniform('iv', new Array(256).fill(false)),
highlightedPointCoordinate: makeUniform('fv', new Vector3()),
highlightedPointColor: makeUniform('fv', DEFAULT_HIGHLIGHT_COLOR.clone()),
enablePointHighlighting: makeUniform('b', true),
Expand Down Expand Up @@ -283,6 +285,7 @@ export class PointCloudMaterial extends RawShaderMaterial {
@uniform('wSourceID') weightSourceID!: number;
@uniform('opacityAttenuation') opacityAttenuation!: number;
@uniform('filterByNormalThreshold') filterByNormalThreshold!: number;
@uniform('classificationFilter') classificationFilter!: boolean[];
@uniform('highlightedPointCoordinate') highlightedPointCoordinate!: Vector3;
@uniform('highlightedPointColor') highlightedPointColor!: Vector4;
@uniform('enablePointHighlighting') enablePointHighlighting!: boolean;
Expand All @@ -308,6 +311,7 @@ export class PointCloudMaterial extends RawShaderMaterial {
@requiresShaderUpdate() treeType: TreeType = TreeType.OCTREE;
@requiresShaderUpdate() pointOpacityType: PointOpacityType = PointOpacityType.FIXED;
@requiresShaderUpdate() useFilterByNormal: boolean = false;
@requiresShaderUpdate() useFilterByClassification: boolean = false;
@requiresShaderUpdate() useTextureBlending: boolean = false;
@requiresShaderUpdate() usePointCloudMixing: boolean = false;
@requiresShaderUpdate() highlightPoint: boolean = false;
Expand Down Expand Up @@ -443,6 +447,10 @@ export class PointCloudMaterial extends RawShaderMaterial {
define('use_filter_by_normal');
}

if (this.useFilterByClassification) {
define('use_filter_by_classification');
}

if (this.useEDL) {
define('use_edl');
}
Expand Down
18 changes: 18 additions & 0 deletions src/materials/shaders/pointcloud.vert
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ uniform sampler2D depthMap;
uniform int normalFilteringMode;
#endif

#ifdef use_filter_by_classification
uniform bool classificationFilter[256];
#endif

out vec3 vColor;

#if !defined(color_type_point_index)
Expand Down Expand Up @@ -511,6 +515,20 @@ void main() {
}
#endif

#ifdef use_filter_by_classification

int classIndex = int(classification);
bool discardPoint = !classificationFilter[classIndex];

if (discardPoint) {
gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
return;
}



#endif

// ---------------------
// POINT COLOR
// ---------------------
Expand Down
2 changes: 2 additions & 0 deletions src/point-cloud-octree-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ export class PointCloudOctreePicker {
pickMaterial.maxSize = nodeMaterial.maxSize;
pickMaterial.classification = nodeMaterial.classification;
pickMaterial.useFilterByNormal = nodeMaterial.useFilterByNormal;
pickMaterial.classificationFilter = nodeMaterial.classificationFilter;
pickMaterial.useFilterByClassification = nodeMaterial.useFilterByClassification;
pickMaterial.filterByNormalThreshold = nodeMaterial.filterByNormalThreshold;

if (params.pickOutsideClipRegion) {
Expand Down