Skip to content
Closed
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
4 changes: 3 additions & 1 deletion core/frontend/src/common/gltf/GltfSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ export interface Gltf2Material extends GltfChildOfRootProperty {
doubleSided?: boolean;
extensions?: GltfExtensions & {
// eslint-disable-next-line @typescript-eslint/naming-convention
BENTLEY_materials_point_style?: { diameter: number };
BENTLEY_materials_point_style?: { diameter: number; };
// eslint-disable-next-line @typescript-eslint/naming-convention
BENTLEY_materials_line_style?: { width?: number; pattern?: number; };
/** The [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_unlit) extension
* indicates that the material should be displayed without lighting. The extension adds no additional properties; it is effectively a boolean flag.
*/
Expand Down
26 changes: 20 additions & 6 deletions core/frontend/src/tile/GltfReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1191,14 +1191,28 @@ export abstract class GltfReader {
}

let width = 1;
if (isPointPrimitive && !isGltf1Material(material)) {
const pointStyle = material.extensions?.BENTLEY_materials_point_style;
if (pointStyle && pointStyle.diameter > 0 && Math.floor(pointStyle.diameter) === pointStyle.diameter) {
width = pointStyle.diameter;
let pattern = LinePixels.Solid;
if (!isGltf1Material(material)) {
if (isPointPrimitive) {
const pointStyle = material.extensions?.BENTLEY_materials_point_style;
if (pointStyle && pointStyle.diameter > 0 && Math.floor(pointStyle.diameter) === pointStyle.diameter) {
width = pointStyle.diameter;
}
} else {
const lineStyle = material.extensions?.BENTLEY_materials_line_style;
if (lineStyle) {
if (lineStyle.width && Math.floor(lineStyle.width) === lineStyle.width) {
width = lineStyle.width;
}

if (undefined !== lineStyle.pattern) {
pattern = (lineStyle.pattern | (lineStyle.pattern << 16)) >>> 0;
}
}
}
}

return new DisplayParams(DisplayParams.Type.Mesh, color, color, width, LinePixels.Solid, FillFlags.None, renderMaterial, undefined, hasBakedLighting, textureMapping);
return new DisplayParams(DisplayParams.Type.Mesh, color, color, width, pattern, FillFlags.None, renderMaterial, undefined, hasBakedLighting, textureMapping);
}

private readMeshPrimitives(node: GltfNode, featureTable?: FeatureTable, thisTransform?: Transform, thisBias?: Vector3d, instances?: InstancedGraphicParams): GltfPrimitiveData[] {
Expand Down Expand Up @@ -1251,7 +1265,7 @@ export abstract class GltfReader {

protected readMeshPrimitive(primitive: GltfMeshPrimitive, featureTable?: FeatureTable, pseudoRtcBias?: Vector3d): GltfPrimitiveData | undefined {
const meshMode = JsonUtils.asInt(primitive.mode, GltfMeshMode.Triangles);
if (meshMode === GltfMeshMode.Points /* && !this._vertexTableRequired */) {
if (meshMode === GltfMeshMode.Points && !this._vertexTableRequired) {
const pointCloud = this.readPointCloud2(primitive, undefined !== featureTable);
if (pointCloud)
return pointCloud;
Expand Down
2 changes: 2 additions & 0 deletions test-apps/display-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"lint-fix": "eslint --fix -f visualstudio \"./src/**/*.ts\" 1>&2",
"lint-deprecation": "",
"start": "cross-env NODE_ENV=development run-p start:webserver start:electron",
"start-no-sandbox": "cross-env NODE_ENV=development run-p start:webserver start:electron-no-sandbox",
"start:electron": "electron ./lib/backend/DtaElectronMain.js --inspect --remote-debugging-port=9223",
"start:electron-no-sandbox": "electron ./lib/backend/DtaElectronMain.js --inspect --remote-debugging-port=9223 --no-sandbox",
"start:webserver": "cross-env NODE_ENV=development vite",
"start:mobile": "cross-env NODE_ENV=development vite --host",
"start:backend": "node --max-http-header-size=16000 lib/backend/WebMain.js",
Expand Down
Loading