Initial commit

This commit is contained in:
2026-04-15 17:08:39 +02:00
parent ae164c47a8
commit 47fd1c2b7a
1819 changed files with 685388 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { GeometryVector, type MortonSettings } from "./geometryVector";
import { VertexBufferType } from "./vertexBufferType";
import type { TopologyVector } from "../../vector/geometry/topologyVector";
export declare function createConstGeometryVector(numGeometries: number, geometryType: number, topologyVector: TopologyVector, vertexOffsets: Uint32Array | undefined, vertexBuffer: Int32Array | Uint32Array): ConstGeometryVector;
export declare function createMortonEncodedConstGeometryVector(numGeometries: number, geometryType: number, topologyVector: TopologyVector, vertexOffsets: Uint32Array | undefined, vertexBuffer: Int32Array | Uint32Array, mortonInfo: MortonSettings): ConstGeometryVector;
export declare class ConstGeometryVector extends GeometryVector {
private readonly _numGeometries;
private readonly _geometryType;
constructor(_numGeometries: number, _geometryType: number, vertexBufferType: VertexBufferType, topologyVector: TopologyVector, vertexOffsets: Uint32Array | undefined, vertexBuffer: Int32Array | Uint32Array, mortonSettings?: MortonSettings);
geometryType(_index: number): number;
get numGeometries(): number;
containsPolygonGeometry(): boolean;
containsSingleGeometryType(): boolean;
}

View File

@@ -0,0 +1,29 @@
import { GeometryVector } from "./geometryVector";
import { GEOMETRY_TYPE } from "./geometryType";
import { VertexBufferType } from "./vertexBufferType";
export function createConstGeometryVector(numGeometries, geometryType, topologyVector, vertexOffsets, vertexBuffer) {
return new ConstGeometryVector(numGeometries, geometryType, VertexBufferType.VEC_2, topologyVector, vertexOffsets, vertexBuffer);
}
export function createMortonEncodedConstGeometryVector(numGeometries, geometryType, topologyVector, vertexOffsets, vertexBuffer, mortonInfo) {
return new ConstGeometryVector(numGeometries, geometryType, VertexBufferType.MORTON, topologyVector, vertexOffsets, vertexBuffer, mortonInfo);
}
export class ConstGeometryVector extends GeometryVector {
constructor(_numGeometries, _geometryType, vertexBufferType, topologyVector, vertexOffsets, vertexBuffer, mortonSettings) {
super(vertexBufferType, topologyVector, vertexOffsets, vertexBuffer, mortonSettings);
this._numGeometries = _numGeometries;
this._geometryType = _geometryType;
}
geometryType(_index) {
return this._geometryType;
}
get numGeometries() {
return this._numGeometries;
}
containsPolygonGeometry() {
return this._geometryType === GEOMETRY_TYPE.POLYGON || this._geometryType === GEOMETRY_TYPE.MULTIPOLYGON;
}
containsSingleGeometryType() {
return true;
}
}
//# sourceMappingURL=constGeometryVector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constGeometryVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/constGeometryVector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,UAAU,yBAAyB,CACrC,aAAqB,EACrB,YAAoB,EACpB,cAA8B,EAC9B,aAAsC,EACtC,YAAsC;IAEtC,OAAO,IAAI,mBAAmB,CAC1B,aAAa,EACb,YAAY,EACZ,gBAAgB,CAAC,KAAK,EACtB,cAAc,EACd,aAAa,EACb,YAAY,CACf,CAAC;AACN,CAAC;AAED,MAAM,UAAU,sCAAsC,CAClD,aAAqB,EACrB,YAAoB,EACpB,cAA8B,EAC9B,aAAsC,EACtC,YAAsC,EACtC,UAA0B;IAE1B,OAAO,IAAI,mBAAmB,CAC1B,aAAa,EACb,YAAY,EACZ,gBAAgB,CAAC,MAAM,EACvB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,CACb,CAAC;AACN,CAAC;AAED,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IACnD,YACqB,cAAsB,EACtB,aAAqB,EACtC,gBAAkC,EAClC,cAA8B,EAC9B,aAAsC,EACtC,YAAsC,EACtC,cAA+B;QAE/B,KAAK,CAAC,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QARpE,mBAAc,GAAd,cAAc,CAAQ;QACtB,kBAAa,GAAb,aAAa,CAAQ;IAQ1C,CAAC;IAED,YAAY,CAAC,MAAc;QACvB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED,uBAAuB;QACnB,OAAO,IAAI,CAAC,aAAa,KAAK,aAAa,CAAC,OAAO,IAAI,IAAI,CAAC,aAAa,KAAK,aAAa,CAAC,YAAY,CAAC;IAC7G,CAAC;IAED,0BAA0B;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import { GeometryVector, type MortonSettings } from \"./geometryVector\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport { VertexBufferType } from \"./vertexBufferType\";\nimport type { TopologyVector } from \"../../vector/geometry/topologyVector\";\n\nexport function createConstGeometryVector(\n numGeometries: number,\n geometryType: number,\n topologyVector: TopologyVector,\n vertexOffsets: Uint32Array | undefined,\n vertexBuffer: Int32Array | Uint32Array,\n): ConstGeometryVector {\n return new ConstGeometryVector(\n numGeometries,\n geometryType,\n VertexBufferType.VEC_2,\n topologyVector,\n vertexOffsets,\n vertexBuffer,\n );\n}\n\nexport function createMortonEncodedConstGeometryVector(\n numGeometries: number,\n geometryType: number,\n topologyVector: TopologyVector,\n vertexOffsets: Uint32Array | undefined,\n vertexBuffer: Int32Array | Uint32Array,\n mortonInfo: MortonSettings,\n): ConstGeometryVector {\n return new ConstGeometryVector(\n numGeometries,\n geometryType,\n VertexBufferType.MORTON,\n topologyVector,\n vertexOffsets,\n vertexBuffer,\n mortonInfo,\n );\n}\n\nexport class ConstGeometryVector extends GeometryVector {\n constructor(\n private readonly _numGeometries: number,\n private readonly _geometryType: number,\n vertexBufferType: VertexBufferType,\n topologyVector: TopologyVector,\n vertexOffsets: Uint32Array | undefined,\n vertexBuffer: Int32Array | Uint32Array,\n mortonSettings?: MortonSettings,\n ) {\n super(vertexBufferType, topologyVector, vertexOffsets, vertexBuffer, mortonSettings);\n }\n\n geometryType(_index: number): number {\n return this._geometryType;\n }\n\n get numGeometries(): number {\n return this._numGeometries;\n }\n\n containsPolygonGeometry(): boolean {\n return this._geometryType === GEOMETRY_TYPE.POLYGON || this._geometryType === GEOMETRY_TYPE.MULTIPOLYGON;\n }\n\n containsSingleGeometryType(): boolean {\n return true;\n }\n}\n"]}

View File

@@ -0,0 +1,11 @@
import { GpuVector } from "./gpuVector";
import type { TopologyVector } from "./topologyVector";
export declare function createConstGpuVector(numGeometries: number, geometryType: number, triangleOffsets: Uint32Array, indexBuffer: Uint32Array, vertexBuffer: Int32Array | Uint32Array, topologyVector?: TopologyVector): GpuVector;
export declare class ConstGpuVector extends GpuVector {
private readonly _numGeometries;
private readonly _geometryType;
constructor(_numGeometries: number, _geometryType: number, triangleOffsets: Uint32Array, indexBuffer: Uint32Array, vertexBuffer: Int32Array | Uint32Array, topologyVector?: TopologyVector);
geometryType(_index: number): number;
get numGeometries(): number;
containsSingleGeometryType(): boolean;
}

View File

@@ -0,0 +1,22 @@
import { GpuVector } from "./gpuVector";
export function createConstGpuVector(numGeometries, geometryType, triangleOffsets, indexBuffer, vertexBuffer, topologyVector) {
return new ConstGpuVector(numGeometries, geometryType, triangleOffsets, indexBuffer, vertexBuffer, topologyVector);
}
//TODO: extend from GeometryVector -> make topology vector optional
export class ConstGpuVector extends GpuVector {
constructor(_numGeometries, _geometryType, triangleOffsets, indexBuffer, vertexBuffer, topologyVector) {
super(triangleOffsets, indexBuffer, vertexBuffer, topologyVector);
this._numGeometries = _numGeometries;
this._geometryType = _geometryType;
}
geometryType(_index) {
return this._geometryType;
}
get numGeometries() {
return this._numGeometries;
}
containsSingleGeometryType() {
return true;
}
}
//# sourceMappingURL=constGpuVector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constGpuVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/constGpuVector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,oBAAoB,CAChC,aAAqB,EACrB,YAAoB,EACpB,eAA4B,EAC5B,WAAwB,EACxB,YAAsC,EACtC,cAA+B;IAE/B,OAAO,IAAI,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AACvH,CAAC;AAED,mEAAmE;AACnE,MAAM,OAAO,cAAe,SAAQ,SAAS;IACzC,YACqB,cAAsB,EACtB,aAAqB,EACtC,eAA4B,EAC5B,WAAwB,EACxB,YAAsC,EACtC,cAA+B;QAE/B,KAAK,CAAC,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QAPjD,mBAAc,GAAd,cAAc,CAAQ;QACtB,kBAAa,GAAb,aAAa,CAAQ;IAO1C,CAAC;IAED,YAAY,CAAC,MAAc;QACvB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED,0BAA0B;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import { GpuVector } from \"./gpuVector\";\nimport type { TopologyVector } from \"./topologyVector\";\n\nexport function createConstGpuVector(\n numGeometries: number,\n geometryType: number,\n triangleOffsets: Uint32Array,\n indexBuffer: Uint32Array,\n vertexBuffer: Int32Array | Uint32Array,\n topologyVector?: TopologyVector,\n): GpuVector {\n return new ConstGpuVector(numGeometries, geometryType, triangleOffsets, indexBuffer, vertexBuffer, topologyVector);\n}\n\n//TODO: extend from GeometryVector -> make topology vector optional\nexport class ConstGpuVector extends GpuVector {\n constructor(\n private readonly _numGeometries: number,\n private readonly _geometryType: number,\n triangleOffsets: Uint32Array,\n indexBuffer: Uint32Array,\n vertexBuffer: Int32Array | Uint32Array,\n topologyVector?: TopologyVector,\n ) {\n super(triangleOffsets, indexBuffer, vertexBuffer, topologyVector);\n }\n\n geometryType(_index: number): number {\n return this._geometryType;\n }\n\n get numGeometries(): number {\n return this._numGeometries;\n }\n\n containsSingleGeometryType(): boolean {\n return true;\n }\n}\n"]}

View File

@@ -0,0 +1,13 @@
import { GeometryVector, type MortonSettings } from "./geometryVector";
import { VertexBufferType } from "./vertexBufferType";
import type { TopologyVector } from "../../vector/geometry/topologyVector";
export declare function createFlatGeometryVector(geometryTypes: Uint32Array, topologyVector: TopologyVector, vertexOffsets: Uint32Array | undefined, vertexBuffer: Int32Array | Uint32Array): FlatGeometryVector;
export declare function createFlatGeometryVectorMortonEncoded(geometryTypes: Uint32Array, topologyVector: TopologyVector, vertexOffsets: Uint32Array | undefined, vertexBuffer: Int32Array | Uint32Array, mortonInfo: MortonSettings): FlatGeometryVector;
export declare class FlatGeometryVector extends GeometryVector {
private readonly _geometryTypes;
constructor(vertexBufferType: VertexBufferType, _geometryTypes: Uint32Array, topologyVector: TopologyVector, vertexOffsets: Uint32Array | undefined, vertexBuffer: Int32Array | Uint32Array, mortonSettings?: MortonSettings);
geometryType(index: number): number;
get numGeometries(): number;
containsPolygonGeometry(): boolean;
containsSingleGeometryType(): boolean;
}

View File

@@ -0,0 +1,33 @@
import { GeometryVector } from "./geometryVector";
import { GEOMETRY_TYPE } from "./geometryType";
import { VertexBufferType } from "./vertexBufferType";
export function createFlatGeometryVector(geometryTypes, topologyVector, vertexOffsets, vertexBuffer) {
return new FlatGeometryVector(VertexBufferType.VEC_2, geometryTypes, topologyVector, vertexOffsets, vertexBuffer);
}
export function createFlatGeometryVectorMortonEncoded(geometryTypes, topologyVector, vertexOffsets, vertexBuffer, mortonInfo) {
return new FlatGeometryVector(VertexBufferType.MORTON, geometryTypes, topologyVector, vertexOffsets, vertexBuffer, mortonInfo);
}
export class FlatGeometryVector extends GeometryVector {
constructor(vertexBufferType, _geometryTypes, topologyVector, vertexOffsets, vertexBuffer, mortonSettings) {
super(vertexBufferType, topologyVector, vertexOffsets, vertexBuffer, mortonSettings);
this._geometryTypes = _geometryTypes;
}
geometryType(index) {
return this._geometryTypes[index];
}
get numGeometries() {
return this._geometryTypes.length;
}
containsPolygonGeometry() {
for (let i = 0; i < this.numGeometries; i++) {
if (this.geometryType(i) === GEOMETRY_TYPE.POLYGON || this.geometryType(i) === GEOMETRY_TYPE.MULTIPOLYGON) {
return true;
}
}
return false;
}
containsSingleGeometryType() {
return false;
}
}
//# sourceMappingURL=flatGeometryVector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"flatGeometryVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/flatGeometryVector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,UAAU,wBAAwB,CACpC,aAA0B,EAC1B,cAA8B,EAC9B,aAAsC,EACtC,YAAsC;IAEtC,OAAO,IAAI,kBAAkB,CAAC,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AACtH,CAAC;AAED,MAAM,UAAU,qCAAqC,CACjD,aAA0B,EAC1B,cAA8B,EAC9B,aAAsC,EACtC,YAAsC,EACtC,UAA0B;IAE1B,OAAO,IAAI,kBAAkB,CACzB,gBAAgB,CAAC,MAAM,EACvB,aAAa,EACb,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,CACb,CAAC;AACN,CAAC;AAED,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IAClD,YACI,gBAAkC,EACjB,cAA2B,EAC5C,cAA8B,EAC9B,aAAsC,EACtC,YAAsC,EACtC,cAA+B;QAE/B,KAAK,CAAC,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QANpE,mBAAc,GAAd,cAAc,CAAa;IAOhD,CAAC;IAED,YAAY,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,uBAAuB;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;gBACxG,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,0BAA0B;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import { GeometryVector, type MortonSettings } from \"./geometryVector\";\nimport { GEOMETRY_TYPE } from \"./geometryType\";\nimport { VertexBufferType } from \"./vertexBufferType\";\nimport type { TopologyVector } from \"../../vector/geometry/topologyVector\";\n\nexport function createFlatGeometryVector(\n geometryTypes: Uint32Array,\n topologyVector: TopologyVector,\n vertexOffsets: Uint32Array | undefined,\n vertexBuffer: Int32Array | Uint32Array,\n): FlatGeometryVector {\n return new FlatGeometryVector(VertexBufferType.VEC_2, geometryTypes, topologyVector, vertexOffsets, vertexBuffer);\n}\n\nexport function createFlatGeometryVectorMortonEncoded(\n geometryTypes: Uint32Array,\n topologyVector: TopologyVector,\n vertexOffsets: Uint32Array | undefined,\n vertexBuffer: Int32Array | Uint32Array,\n mortonInfo: MortonSettings,\n): FlatGeometryVector {\n return new FlatGeometryVector(\n VertexBufferType.MORTON,\n geometryTypes,\n topologyVector,\n vertexOffsets,\n vertexBuffer,\n mortonInfo,\n );\n}\n\nexport class FlatGeometryVector extends GeometryVector {\n constructor(\n vertexBufferType: VertexBufferType,\n private readonly _geometryTypes: Uint32Array,\n topologyVector: TopologyVector,\n vertexOffsets: Uint32Array | undefined,\n vertexBuffer: Int32Array | Uint32Array,\n mortonSettings?: MortonSettings,\n ) {\n super(vertexBufferType, topologyVector, vertexOffsets, vertexBuffer, mortonSettings);\n }\n\n geometryType(index: number): number {\n return this._geometryTypes[index];\n }\n\n get numGeometries(): number {\n return this._geometryTypes.length;\n }\n\n containsPolygonGeometry(): boolean {\n for (let i = 0; i < this.numGeometries; i++) {\n if (this.geometryType(i) === GEOMETRY_TYPE.POLYGON || this.geometryType(i) === GEOMETRY_TYPE.MULTIPOLYGON) {\n return true;\n }\n }\n return false;\n }\n\n containsSingleGeometryType(): boolean {\n return false;\n }\n}\n"]}

View File

@@ -0,0 +1,10 @@
import { GpuVector } from "./gpuVector";
import type { TopologyVector } from "./topologyVector";
export declare function createFlatGpuVector(geometryTypes: Uint32Array, triangleOffsets: Uint32Array, indexBuffer: Uint32Array, vertexBuffer: Int32Array | Uint32Array, topologyVector?: TopologyVector): GpuVector;
export declare class FlatGpuVector extends GpuVector {
private readonly _geometryTypes;
constructor(_geometryTypes: Uint32Array, triangleOffsets: Uint32Array, indexBuffer: Uint32Array, vertexBuffer: Int32Array | Uint32Array, topologyVector?: TopologyVector);
geometryType(index: number): number;
get numGeometries(): number;
containsSingleGeometryType(): boolean;
}

View File

@@ -0,0 +1,21 @@
import { GpuVector } from "./gpuVector";
export function createFlatGpuVector(geometryTypes, triangleOffsets, indexBuffer, vertexBuffer, topologyVector) {
return new FlatGpuVector(geometryTypes, triangleOffsets, indexBuffer, vertexBuffer, topologyVector);
}
//TODO: extend from GeometryVector -> make topology vector optional
export class FlatGpuVector extends GpuVector {
constructor(_geometryTypes, triangleOffsets, indexBuffer, vertexBuffer, topologyVector) {
super(triangleOffsets, indexBuffer, vertexBuffer, topologyVector);
this._geometryTypes = _geometryTypes;
}
geometryType(index) {
return this._geometryTypes[index];
}
get numGeometries() {
return this._geometryTypes.length;
}
containsSingleGeometryType() {
return false;
}
}
//# sourceMappingURL=flatGpuVector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"flatGpuVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/flatGpuVector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,mBAAmB,CAC/B,aAA0B,EAC1B,eAA4B,EAC5B,WAAwB,EACxB,YAAsC,EACtC,cAA+B;IAE/B,OAAO,IAAI,aAAa,CAAC,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AACxG,CAAC;AAED,mEAAmE;AACnE,MAAM,OAAO,aAAc,SAAQ,SAAS;IACxC,YACqB,cAA2B,EAC5C,eAA4B,EAC5B,WAAwB,EACxB,YAAsC,EACtC,cAA+B;QAE/B,KAAK,CAAC,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;QANjD,mBAAc,GAAd,cAAc,CAAa;IAOhD,CAAC;IAED,YAAY,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,0BAA0B;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import { GpuVector } from \"./gpuVector\";\nimport type { TopologyVector } from \"./topologyVector\";\n\nexport function createFlatGpuVector(\n geometryTypes: Uint32Array,\n triangleOffsets: Uint32Array,\n indexBuffer: Uint32Array,\n vertexBuffer: Int32Array | Uint32Array,\n topologyVector?: TopologyVector,\n): GpuVector {\n return new FlatGpuVector(geometryTypes, triangleOffsets, indexBuffer, vertexBuffer, topologyVector);\n}\n\n//TODO: extend from GeometryVector -> make topology vector optional\nexport class FlatGpuVector extends GpuVector {\n constructor(\n private readonly _geometryTypes: Uint32Array,\n triangleOffsets: Uint32Array,\n indexBuffer: Uint32Array,\n vertexBuffer: Int32Array | Uint32Array,\n topologyVector?: TopologyVector,\n ) {\n super(triangleOffsets, indexBuffer, vertexBuffer, topologyVector);\n }\n\n geometryType(index: number): number {\n return this._geometryTypes[index];\n }\n\n get numGeometries(): number {\n return this._geometryTypes.length;\n }\n\n containsSingleGeometryType(): boolean {\n return false;\n }\n}\n"]}

View File

@@ -0,0 +1,13 @@
export declare enum GEOMETRY_TYPE {
POINT = 0,
LINESTRING = 1,
POLYGON = 2,
MULTIPOINT = 3,
MULTILINESTRING = 4,
MULTIPOLYGON = 5
}
export declare enum SINGLE_PART_GEOMETRY_TYPE {
POINT = 0,
LINESTRING = 1,
POLYGON = 2
}

View File

@@ -0,0 +1,16 @@
export var GEOMETRY_TYPE;
(function (GEOMETRY_TYPE) {
GEOMETRY_TYPE[GEOMETRY_TYPE["POINT"] = 0] = "POINT";
GEOMETRY_TYPE[GEOMETRY_TYPE["LINESTRING"] = 1] = "LINESTRING";
GEOMETRY_TYPE[GEOMETRY_TYPE["POLYGON"] = 2] = "POLYGON";
GEOMETRY_TYPE[GEOMETRY_TYPE["MULTIPOINT"] = 3] = "MULTIPOINT";
GEOMETRY_TYPE[GEOMETRY_TYPE["MULTILINESTRING"] = 4] = "MULTILINESTRING";
GEOMETRY_TYPE[GEOMETRY_TYPE["MULTIPOLYGON"] = 5] = "MULTIPOLYGON";
})(GEOMETRY_TYPE || (GEOMETRY_TYPE = {}));
export var SINGLE_PART_GEOMETRY_TYPE;
(function (SINGLE_PART_GEOMETRY_TYPE) {
SINGLE_PART_GEOMETRY_TYPE[SINGLE_PART_GEOMETRY_TYPE["POINT"] = 0] = "POINT";
SINGLE_PART_GEOMETRY_TYPE[SINGLE_PART_GEOMETRY_TYPE["LINESTRING"] = 1] = "LINESTRING";
SINGLE_PART_GEOMETRY_TYPE[SINGLE_PART_GEOMETRY_TYPE["POLYGON"] = 2] = "POLYGON";
})(SINGLE_PART_GEOMETRY_TYPE || (SINGLE_PART_GEOMETRY_TYPE = {}));
//# sourceMappingURL=geometryType.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"geometryType.js","sourceRoot":"","sources":["../../../src/vector/geometry/geometryType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACrB,mDAAS,CAAA;IACT,6DAAc,CAAA;IACd,uDAAW,CAAA;IACX,6DAAc,CAAA;IACd,uEAAmB,CAAA;IACnB,iEAAgB,CAAA;AACpB,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED,MAAM,CAAN,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACjC,2EAAS,CAAA;IACT,qFAAc,CAAA;IACd,+EAAW,CAAA;AACf,CAAC,EAJW,yBAAyB,KAAzB,yBAAyB,QAIpC","sourcesContent":["export enum GEOMETRY_TYPE {\n POINT = 0,\n LINESTRING = 1,\n POLYGON = 2,\n MULTIPOINT = 3,\n MULTILINESTRING = 4,\n MULTIPOLYGON = 5,\n}\n\nexport enum SINGLE_PART_GEOMETRY_TYPE {\n POINT = 0,\n LINESTRING = 1,\n POLYGON = 2,\n}\n"]}

View File

@@ -0,0 +1,33 @@
import type Point from "@mapbox/point-geometry";
import type { GEOMETRY_TYPE } from "./geometryType";
import type { VertexBufferType } from "./vertexBufferType";
import type { TopologyVector } from "../../vector/geometry/topologyVector";
export type CoordinatesArray = Array<Array<Point>>;
export type Geometry = {
coordinates: CoordinatesArray;
type: GEOMETRY_TYPE;
};
export interface MortonSettings {
numBits: number;
coordinateShift: number;
}
export declare abstract class GeometryVector {
private readonly _vertexBufferType;
private readonly _topologyVector;
private readonly _vertexOffsets;
private readonly _vertexBuffer;
private readonly _mortonSettings?;
protected constructor(_vertexBufferType: VertexBufferType, _topologyVector: TopologyVector, _vertexOffsets: Uint32Array | undefined, _vertexBuffer: Int32Array | Uint32Array, _mortonSettings?: MortonSettings);
get vertexBufferType(): VertexBufferType;
get topologyVector(): TopologyVector;
get vertexOffsets(): Uint32Array | undefined;
get vertexBuffer(): Int32Array | Uint32Array;
getSimpleEncodedVertex(index: number): [number, number];
getVertex(index: number): [number, number];
getGeometries(): CoordinatesArray[];
get mortonSettings(): MortonSettings | undefined;
abstract containsPolygonGeometry(): boolean;
abstract geometryType(index: number): number;
abstract get numGeometries(): number;
abstract containsSingleGeometryType(): boolean;
}

View File

@@ -0,0 +1,53 @@
import { convertGeometryVector } from "./geometryVectorConverter";
import { decodeZOrderCurve } from "./zOrderCurve";
export class GeometryVector {
constructor(_vertexBufferType, _topologyVector, _vertexOffsets, _vertexBuffer, _mortonSettings) {
this._vertexBufferType = _vertexBufferType;
this._topologyVector = _topologyVector;
this._vertexOffsets = _vertexOffsets;
this._vertexBuffer = _vertexBuffer;
this._mortonSettings = _mortonSettings;
}
get vertexBufferType() {
return this._vertexBufferType;
}
get topologyVector() {
return this._topologyVector;
}
get vertexOffsets() {
return this._vertexOffsets;
}
get vertexBuffer() {
return this._vertexBuffer;
}
/* Allows faster access to the vertices since morton encoding is currently not used in the POC. Morton encoding
will be used after adapting the shader to decode the morton codes on the GPU. */
getSimpleEncodedVertex(index) {
const offset = this.vertexOffsets ? this.vertexOffsets[index] * 2 : index * 2;
const x = this.vertexBuffer[offset];
const y = this.vertexBuffer[offset + 1];
return [x, y];
}
//TODO: add scaling information to the constructor
getVertex(index) {
if (this.vertexOffsets && this.mortonSettings) {
//TODO: move decoding of the morton codes on the GPU in the vertex shader
const vertexOffset = this.vertexOffsets[index];
const mortonEncodedVertex = this.vertexBuffer[vertexOffset];
//TODO: improve performance -> inline calculation and move to decoding of VertexBuffer
const vertex = decodeZOrderCurve(mortonEncodedVertex, this.mortonSettings.numBits, this.mortonSettings.coordinateShift);
return [vertex.x, vertex.y];
}
const offset = this.vertexOffsets ? this.vertexOffsets[index] * 2 : index * 2;
const x = this.vertexBuffer[offset];
const y = this.vertexBuffer[offset + 1];
return [x, y];
}
getGeometries() {
return convertGeometryVector(this);
}
get mortonSettings() {
return this._mortonSettings;
}
}
//# sourceMappingURL=geometryVector.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
import type { GeometryVector, CoordinatesArray } from "./geometryVector";
export declare function convertGeometryVector(geometryVector: GeometryVector): CoordinatesArray[];

View File

@@ -0,0 +1,255 @@
import { decodeZOrderCurve } from "./zOrderCurve";
import { GEOMETRY_TYPE } from "./geometryType";
import { VertexBufferType } from "./vertexBufferType";
import Point from "@mapbox/point-geometry";
export function convertGeometryVector(geometryVector) {
const geometries = new Array(geometryVector.numGeometries);
let partOffsetCounter = 1;
let ringOffsetsCounter = 1;
let geometryOffsetsCounter = 1;
let geometryCounter = 0;
let vertexBufferOffset = 0;
let vertexOffsetsOffset = 0;
const mortonSettings = geometryVector.mortonSettings;
const topologyVector = geometryVector.topologyVector;
const geometryOffsets = topologyVector.geometryOffsets;
const partOffsets = topologyVector.partOffsets;
const ringOffsets = topologyVector.ringOffsets;
const vertexOffsets = geometryVector.vertexOffsets;
const nonOffset = !vertexOffsets || vertexOffsets.length === 0;
const containsPolygon = geometryVector.containsPolygonGeometry();
const vertexBuffer = geometryVector.vertexBuffer;
for (let i = 0; i < geometryVector.numGeometries; i++) {
const geometryType = geometryVector.geometryType(i);
switch (geometryType) {
case GEOMETRY_TYPE.POINT:
{
let x;
let y;
if (nonOffset) {
x = vertexBuffer[vertexBufferOffset++];
y = vertexBuffer[vertexBufferOffset++];
}
else if (geometryVector.vertexBufferType === VertexBufferType.MORTON) {
const offset = vertexOffsets[vertexOffsetsOffset++];
const mortonCode = vertexBuffer[offset];
const vertex = decodeZOrderCurve(mortonCode, mortonSettings.numBits, mortonSettings.coordinateShift);
x = vertex.x;
y = vertex.y;
}
else {
const offset = vertexOffsets[vertexOffsetsOffset++] * 2;
x = vertexBuffer[offset];
y = vertexBuffer[offset + 1];
}
geometries[geometryCounter++] = [[new Point(x, y)]];
if (geometryOffsets)
geometryOffsetsCounter++;
if (partOffsets)
partOffsetCounter++;
if (ringOffsets)
ringOffsetsCounter++;
}
break;
case GEOMETRY_TYPE.MULTIPOINT:
{
const numPoints = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
geometryOffsetsCounter++;
const points = new Array(numPoints);
if (nonOffset) {
for (let j = 0; j < numPoints; j++) {
const x = vertexBuffer[vertexBufferOffset++];
const y = vertexBuffer[vertexBufferOffset++];
points[j] = new Point(x, y);
}
}
else {
for (let j = 0; j < numPoints; j++) {
const offset = vertexOffsets[vertexOffsetsOffset++] * 2;
const x = vertexBuffer[offset];
const y = vertexBuffer[offset + 1];
points[j] = new Point(x, y);
}
}
geometries[geometryCounter++] = points.map((point) => [point]);
// MULTIPOINT must increment offset counters like POINT does
partOffsetCounter += numPoints;
ringOffsetsCounter += numPoints;
}
break;
case GEOMETRY_TYPE.LINESTRING:
{
let numVertices;
if (containsPolygon) {
numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
}
else {
numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
}
partOffsetCounter++;
let vertices;
if (nonOffset) {
vertices = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
vertexBufferOffset += numVertices * 2;
}
else {
vertices = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
vertexOffsetsOffset += numVertices;
}
geometries[geometryCounter++] = [vertices];
if (geometryOffsets)
geometryOffsetsCounter++;
}
break;
case GEOMETRY_TYPE.POLYGON:
{
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
partOffsetCounter++;
const rings = new Array(numRings - 1);
let shell;
let numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
if (nonOffset) {
shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
vertexBufferOffset += numVertices * 2;
for (let j = 0; j < rings.length; j++) {
numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
rings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
vertexBufferOffset += numVertices * 2;
}
}
else {
shell = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
vertexOffsetsOffset += numVertices;
for (let j = 0; j < rings.length; j++) {
numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
rings[j] = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
vertexOffsetsOffset += numVertices;
}
}
geometries[geometryCounter++] = [shell].concat(rings);
if (geometryOffsets)
geometryOffsetsCounter++;
}
break;
case GEOMETRY_TYPE.MULTILINESTRING:
{
const numLineStrings = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
geometryOffsetsCounter++;
const lineStrings = new Array(numLineStrings);
for (let j = 0; j < numLineStrings; j++) {
let numVertices;
if (containsPolygon) {
numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
}
else {
numVertices = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
}
partOffsetCounter++;
if (nonOffset) {
lineStrings[j] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, false);
vertexBufferOffset += numVertices * 2;
}
else {
const vertices = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, false, mortonSettings);
lineStrings[j] = vertices;
vertexOffsetsOffset += numVertices;
}
}
geometries[geometryCounter++] = lineStrings;
}
break;
case GEOMETRY_TYPE.MULTIPOLYGON:
{
const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
geometryOffsetsCounter++;
const polygons = new Array(numPolygons);
for (let j = 0; j < numPolygons; j++) {
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
partOffsetCounter++;
let shell;
const rings = new Array(numRings - 1);
const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
if (nonOffset) {
shell = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numVertices, true);
vertexBufferOffset += numVertices * 2;
}
else {
shell = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numVertices, true, mortonSettings);
vertexOffsetsOffset += numVertices;
}
for (let k = 0; k < rings.length; k++) {
const numRingVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
if (nonOffset) {
rings[k] = getLineStringOrRing(vertexBuffer, vertexBufferOffset, numRingVertices, true);
vertexBufferOffset += numRingVertices * 2;
}
else {
rings[k] = decodeDictionaryEncodedLineStringOrRing(geometryVector.vertexBufferType, vertexBuffer, vertexOffsets, vertexOffsetsOffset, numRingVertices, true, mortonSettings);
vertexOffsetsOffset += numRingVertices;
}
}
polygons[j] = [shell].concat(rings);
}
geometries[geometryCounter++] = polygons.flat();
}
break;
default:
throw new Error("The specified geometry type is currently not supported.");
}
}
return geometries;
}
function decodeDictionaryEncodedLineStringOrRing(vertexBufferType, vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString, mortonSettings) {
if (vertexBufferType === VertexBufferType.MORTON) {
return decodeMortonDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString, mortonSettings);
}
else {
return decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString);
}
}
function getLineStringOrRing(vertexBuffer, startIndex, numVertices, closeLineString) {
const vertices = new Array(closeLineString ? numVertices + 1 : numVertices);
for (let i = 0; i < numVertices * 2; i += 2) {
const x = vertexBuffer[startIndex + i];
const y = vertexBuffer[startIndex + i + 1];
vertices[i / 2] = new Point(x, y);
}
if (closeLineString) {
vertices[vertices.length - 1] = vertices[0];
}
return vertices;
}
function decodeDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString) {
const vertices = new Array(closeLineString ? numVertices + 1 : numVertices);
for (let i = 0; i < numVertices * 2; i += 2) {
const offset = vertexOffsets[vertexOffset + i / 2] * 2;
const x = vertexBuffer[offset];
const y = vertexBuffer[offset + 1];
vertices[i / 2] = new Point(x, y);
}
if (closeLineString) {
vertices[vertices.length - 1] = vertices[0];
}
return vertices;
}
function decodeMortonDictionaryEncodedLineString(vertexBuffer, vertexOffsets, vertexOffset, numVertices, closeLineString, mortonSettings) {
const vertices = new Array(closeLineString ? numVertices + 1 : numVertices);
for (let i = 0; i < numVertices; i++) {
const offset = vertexOffsets[vertexOffset + i];
const mortonEncodedVertex = vertexBuffer[offset];
const vertex = decodeZOrderCurve(mortonEncodedVertex, mortonSettings.numBits, mortonSettings.coordinateShift);
vertices[i] = new Point(vertex.x, vertex.y);
}
if (closeLineString) {
vertices[vertices.length - 1] = vertices[0];
}
return vertices;
}
//# sourceMappingURL=geometryVectorConverter.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
import type { CoordinatesArray } from "./geometryVector";
import type { TopologyVector } from "./topologyVector";
export declare abstract class GpuVector implements Iterable<CoordinatesArray> {
private readonly _triangleOffsets;
private readonly _indexBuffer;
private readonly _vertexBuffer;
private readonly _topologyVector?;
protected constructor(_triangleOffsets: Uint32Array, _indexBuffer: Uint32Array, _vertexBuffer: Int32Array | Uint32Array, _topologyVector?: TopologyVector);
abstract geometryType(index: number): number;
abstract get numGeometries(): number;
abstract containsSingleGeometryType(): boolean;
get triangleOffsets(): Uint32Array;
get indexBuffer(): Uint32Array;
get vertexBuffer(): Int32Array | Uint32Array;
get topologyVector(): TopologyVector | undefined;
/**
* Returns geometries as coordinate arrays by extracting polygon outlines from topology.
* The vertexBuffer contains the outline vertices, separate from the tessellated triangles.
*/
getGeometries(): CoordinatesArray[];
[Symbol.iterator](): Iterator<CoordinatesArray>;
}

View File

@@ -0,0 +1,118 @@
import Point from "@mapbox/point-geometry";
import { GEOMETRY_TYPE } from "./geometryType";
export class GpuVector {
constructor(_triangleOffsets, _indexBuffer, _vertexBuffer, _topologyVector) {
this._triangleOffsets = _triangleOffsets;
this._indexBuffer = _indexBuffer;
this._vertexBuffer = _vertexBuffer;
this._topologyVector = _topologyVector;
}
get triangleOffsets() {
return this._triangleOffsets;
}
get indexBuffer() {
return this._indexBuffer;
}
get vertexBuffer() {
return this._vertexBuffer;
}
get topologyVector() {
return this._topologyVector;
}
/**
* Returns geometries as coordinate arrays by extracting polygon outlines from topology.
* The vertexBuffer contains the outline vertices, separate from the tessellated triangles.
*/
getGeometries() {
if (!this._topologyVector) {
throw new Error("Cannot convert GpuVector to coordinates without topology information");
}
const geometries = new Array(this.numGeometries);
const topology = this._topologyVector;
const partOffsets = topology.partOffsets;
const ringOffsets = topology.ringOffsets;
const geometryOffsets = topology.geometryOffsets;
// Use counters to track position in offset arrays (like Java implementation)
let vertexBufferOffset = 0;
let partOffsetCounter = 1;
let ringOffsetsCounter = 1;
let geometryOffsetsCounter = 1;
for (let i = 0; i < this.numGeometries; i++) {
const geometryType = this.geometryType(i);
switch (geometryType) {
case GEOMETRY_TYPE.POLYGON:
{
// Get number of rings for this polygon
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
partOffsetCounter++;
const rings = [];
for (let j = 0; j < numRings; j++) {
// Get number of vertices in this ring
const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
const ring = [];
for (let k = 0; k < numVertices; k++) {
const x = this._vertexBuffer[vertexBufferOffset++];
const y = this._vertexBuffer[vertexBufferOffset++];
ring.push(new Point(x, y));
}
// Close the ring by duplicating the first vertex (MVT format requirement)
if (ring.length > 0) {
ring.push(ring[0]);
}
rings.push(ring);
}
geometries[i] = rings;
if (geometryOffsets)
geometryOffsetsCounter++;
}
break;
case GEOMETRY_TYPE.MULTIPOLYGON:
{
// Get number of polygons in this multipolygon
const numPolygons = geometryOffsets[geometryOffsetsCounter] - geometryOffsets[geometryOffsetsCounter - 1];
geometryOffsetsCounter++;
const allRings = [];
for (let p = 0; p < numPolygons; p++) {
// Get number of rings in this polygon
const numRings = partOffsets[partOffsetCounter] - partOffsets[partOffsetCounter - 1];
partOffsetCounter++;
for (let j = 0; j < numRings; j++) {
// Get number of vertices in this ring
const numVertices = ringOffsets[ringOffsetsCounter] - ringOffsets[ringOffsetsCounter - 1];
ringOffsetsCounter++;
const ring = [];
for (let k = 0; k < numVertices; k++) {
const x = this._vertexBuffer[vertexBufferOffset++];
const y = this._vertexBuffer[vertexBufferOffset++];
ring.push(new Point(x, y));
}
// Close the ring by duplicating the first vertex (MVT format requirement)
if (ring.length > 0) {
ring.push(ring[0]);
}
allRings.push(ring);
}
}
geometries[i] = allRings;
}
break;
}
}
return geometries;
}
[Symbol.iterator]() {
/*for(let i = 1; i < this.triangleOffsets.length; i++) {
const numTriangles = this.triangleOffsets[i] - this.triangleOffsets[i-1];
const startIndex = this.triangleOffsets[i-1] * 3;
const endIndex = this.triangleOffsets[i] * 3;
}
while (index < this.numGeometries) {
yield geometries[index++];
}*/
//throw new Error("Iterator on a GpuVector is not implemented yet.");
return null;
}
}
//# sourceMappingURL=gpuVector.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
export type TopologyVector = {
readonly geometryOffsets?: Uint32Array;
readonly partOffsets?: Uint32Array;
readonly ringOffsets?: Uint32Array;
};

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=topologyVector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"topologyVector.js","sourceRoot":"","sources":["../../../src/vector/geometry/topologyVector.ts"],"names":[],"mappings":"","sourcesContent":["export type TopologyVector = {\n readonly geometryOffsets?: Uint32Array;\n readonly partOffsets?: Uint32Array;\n readonly ringOffsets?: Uint32Array;\n};\n"]}

View File

@@ -0,0 +1,5 @@
export declare enum VertexBufferType {
MORTON = 0,
VEC_2 = 1,
VEC_3 = 2
}

View File

@@ -0,0 +1,7 @@
export var VertexBufferType;
(function (VertexBufferType) {
VertexBufferType[VertexBufferType["MORTON"] = 0] = "MORTON";
VertexBufferType[VertexBufferType["VEC_2"] = 1] = "VEC_2";
VertexBufferType[VertexBufferType["VEC_3"] = 2] = "VEC_3";
})(VertexBufferType || (VertexBufferType = {}));
//# sourceMappingURL=vertexBufferType.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"vertexBufferType.js","sourceRoot":"","sources":["../../../src/vector/geometry/vertexBufferType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,2DAAU,CAAA;IACV,yDAAS,CAAA;IACT,yDAAS,CAAA;AACb,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B","sourcesContent":["export enum VertexBufferType {\n MORTON = 0,\n VEC_2 = 1,\n VEC_3 = 2,\n}\n"]}

View File

@@ -0,0 +1,4 @@
export declare function decodeZOrderCurve(mortonCode: number, numBits: number, coordinateShift: number): {
x: number;
y: number;
};

View File

@@ -0,0 +1,13 @@
export function decodeZOrderCurve(mortonCode, numBits, coordinateShift) {
const x = decodeMorton(mortonCode, numBits) - coordinateShift;
const y = decodeMorton(mortonCode >> 1, numBits) - coordinateShift;
return { x, y };
}
function decodeMorton(code, numBits) {
let coordinate = 0;
for (let i = 0; i < numBits; i++) {
coordinate |= (code & (1 << (2 * i))) >> i;
}
return coordinate;
}
//# sourceMappingURL=zOrderCurve.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"zOrderCurve.js","sourceRoot":"","sources":["../../../src/vector/geometry/zOrderCurve.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAC7B,UAAkB,EAClB,OAAe,EACf,eAAuB;IAEvB,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC;IAC9D,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC;IACnE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,OAAe;IAC/C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;QAC/B,UAAU,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["export function decodeZOrderCurve(\n mortonCode: number,\n numBits: number,\n coordinateShift: number,\n): { x: number; y: number } {\n const x = decodeMorton(mortonCode, numBits) - coordinateShift;\n const y = decodeMorton(mortonCode >> 1, numBits) - coordinateShift;\n return { x, y };\n}\n\nfunction decodeMorton(code: number, numBits: number): number {\n let coordinate = 0;\n for (let i = 0; i < numBits; i++) {\n coordinate |= (code & (1 << (2 * i))) >> i;\n }\n return coordinate;\n}\n"]}