Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | /*!
* Copyright 2020 Cognite AS
*/
import { Box3 } from '../../utils/Box3';
import { mat4, vec3 } from 'gl-matrix';
import { PrimitiveAttributes } from '../../workers/types/parser.types';
import { CadLoadingHints } from './CadLoadingHints';
/**
* Input to DetermineSectorsDelegate.
*/
export interface DetermineSectorsInput {
readonly scene: SectorScene;
readonly cameraFov: number;
readonly cameraPosition: vec3;
readonly cameraModelMatrix: mat4;
readonly projectionMatrix: mat4;
readonly loadingHints?: CadLoadingHints;
}
// TODO 2019-11-12 larsmoa: Move and rename to something general (not specific
// for sector data).
export type SectorModelTransformation = {
readonly modelMatrix: mat4;
readonly inverseModelMatrix: mat4;
};
export interface SectorMetadata {
readonly id: number;
readonly path: string;
readonly bounds: Box3;
readonly simple?: {
readonly gridSize: vec3;
readonly gridOrigin: vec3;
readonly gridIncrement: number;
readonly nodeCount: number;
};
readonly children: SectorMetadata[];
// TODO 2019-12-21 larsmoa: Make readonly
parent?: SectorMetadata;
}
export interface SectorScene {
readonly root: SectorMetadata;
readonly sectors: Map<number, SectorMetadata>;
}
export type Color = number;
export type TriangleMesh = {
readonly fileId: number;
readonly indices: Uint32Array;
readonly treeIndices: Float32Array;
readonly vertices: Float32Array;
readonly normals: Float32Array | undefined;
readonly colors: Float32Array;
};
export type InstancedMeshFile = {
readonly fileId: number;
readonly indices: Uint32Array;
readonly vertices: Float32Array;
readonly normals: Float32Array | undefined;
readonly instances: InstancedMesh[];
};
export type InstancedMesh = {
readonly triangleCount: number;
readonly triangleOffset: number;
readonly colors: Uint8Array;
readonly instanceMatrices: Float32Array;
readonly treeIndices: Float32Array;
};
// TODO 2019-12-05 larsmoa: Rename to e.g. SectorGeometry to avoid
// confusion with other Sector-class
export interface Sector {
readonly instanceMeshes: InstancedMeshFile[];
readonly triangleMeshes: TriangleMesh[];
readonly boxes: PrimitiveAttributes;
readonly circles: PrimitiveAttributes;
readonly cones: PrimitiveAttributes;
readonly eccentricCones: PrimitiveAttributes;
readonly ellipsoidSegments: PrimitiveAttributes;
readonly generalCylinders: PrimitiveAttributes;
readonly generalRings: PrimitiveAttributes;
readonly nuts: PrimitiveAttributes;
readonly quads: PrimitiveAttributes;
readonly sphericalSegments: PrimitiveAttributes;
readonly torusSegments: PrimitiveAttributes;
readonly trapeziums: PrimitiveAttributes;
}
export interface SectorQuads {
readonly buffer: Float32Array;
}
export enum LoadSectorStatus {
Awaiting,
InFlight,
Cancelled,
Resolved
}
export type LoadSectorRequest = {
readonly promise: Promise<void>;
cancel: () => void;
status: () => LoadSectorStatus;
};
// TODO move somewhere else?
export interface CtmWorkerResult {
readonly indices: Uint32Array;
readonly vertices: Float32Array;
readonly normals: Float32Array | undefined;
}
export interface WantedSectors {
readonly detailed: Set<number>;
readonly simple: Set<number>;
}
|