#827 Fixed another issue related to point clouds and materials
This commit is contained in:
@@ -47,6 +47,10 @@ export default class Batcher {
|
||||
matRef = batch[0].renderData.renderMaterial
|
||||
} else if (batchType === GeometryType.LINE) {
|
||||
matRef = batch[0].renderData.displayStyle
|
||||
} else if (batchType === GeometryType.POINT) {
|
||||
matRef = batch[0].renderData.renderMaterial
|
||||
} else if (batchType === GeometryType.POINT_CLOUD) {
|
||||
matRef = batch[0].renderData.renderMaterial
|
||||
}
|
||||
|
||||
const material = this.materials.updateMaterialMap(
|
||||
|
||||
@@ -241,7 +241,7 @@ export default class Materials {
|
||||
sizeAttenuation: false
|
||||
// clippingPlanes: this.viewer.sectionBox.planes
|
||||
})
|
||||
this.materialMap[NodeRenderView.NullPointCloudMaterialHash] =
|
||||
this.materialMap[NodeRenderView.NullPointCloudVertexColorsMaterialHash] =
|
||||
new SpecklePointMaterial({
|
||||
color: 0xffffff,
|
||||
vertexColors: true,
|
||||
@@ -249,6 +249,14 @@ export default class Materials {
|
||||
sizeAttenuation: false
|
||||
// clippingPlanes: this.viewer.sectionBox.planes
|
||||
})
|
||||
this.materialMap[NodeRenderView.NullPointCloudMaterialHash] =
|
||||
new SpecklePointMaterial({
|
||||
color: 0xffffff,
|
||||
vertexColors: false,
|
||||
size: 2,
|
||||
sizeAttenuation: false
|
||||
// clippingPlanes: this.viewer.sectionBox.planes
|
||||
})
|
||||
}
|
||||
|
||||
private makeMeshMaterial(materialData: RenderMaterial): Material {
|
||||
@@ -289,6 +297,21 @@ export default class Materials {
|
||||
return mat
|
||||
}
|
||||
|
||||
private makePointMaterial(materialData: RenderMaterial): Material {
|
||||
const mat = new SpecklePointMaterial({
|
||||
color: materialData.color,
|
||||
opacity: materialData.opacity,
|
||||
vertexColors: false,
|
||||
size: 2,
|
||||
sizeAttenuation: false
|
||||
// clippingPlanes: this.viewer.sectionBox.planes
|
||||
})
|
||||
mat.transparent = mat.opacity < 1 ? true : false
|
||||
mat.depthWrite = mat.transparent ? false : true
|
||||
mat.color.convertSRGBToLinear()
|
||||
return mat
|
||||
}
|
||||
|
||||
public updateMaterialMap(
|
||||
hash: number,
|
||||
material: RenderMaterial | DisplayStyle,
|
||||
@@ -309,7 +332,7 @@ export default class Materials {
|
||||
this.materialMap[hash] = this.makeLineMaterial(material as DisplayStyle)
|
||||
break
|
||||
case GeometryType.POINT:
|
||||
console.error(`No material definition for points!`)
|
||||
this.materialMap[hash] = this.makePointMaterial(material as RenderMaterial)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,10 @@ export class NodeRenderView {
|
||||
public static readonly NullPointMaterialHash = this.hashCode(
|
||||
GeometryType.POINT.toString()
|
||||
)
|
||||
|
||||
public static readonly NullPointCloudMaterialHash = this.hashCode(
|
||||
GeometryType.POINT_CLOUD.toString()
|
||||
)
|
||||
public static readonly NullPointCloudVertexColorsMaterialHash = this.hashCode(
|
||||
GeometryType.POINT_CLOUD.toString() + 'vertexColors'
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user