Skip to content

Commit

Permalink
Revert "Remove "Internal" from classes"
Browse files Browse the repository at this point in the history
This reverts commit a00fce3.
  • Loading branch information
birkskyum committed May 8, 2024
1 parent a00fce3 commit 3ce2ce0
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 34 deletions.
2 changes: 2 additions & 0 deletions src/data/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {VertexArrayObject} from '../render/vertex_array_object';
import type {StructArray} from '../util/struct_array';

/**
* @internal
* A single segment of a vector
*/
export type Segment = {
Expand All @@ -18,6 +19,7 @@ export type Segment = {
};

/**
* @internal
* Used for calculations on vector segments
*/
export class SegmentVector {
Expand Down
1 change: 1 addition & 0 deletions src/geo/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {Terrain} from '../render/terrain';
export const MAX_VALID_LATITUDE = 85.051129;

/**
* @internal
* A single transform, generally used for a single tile to be
* scaled, rotated, and zoomed.
*/
Expand Down
1 change: 1 addition & 0 deletions src/gl/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type ClearArgs = {
};

/**
* @internal
* A webgl wrapper class to allow injection, mocking and abstaction
*/
export class Context {
Expand Down
1 change: 1 addition & 0 deletions src/gl/framebuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {ColorAttachment, DepthAttachment, DepthStencilAttachment} from './value'
import type {Context} from './context';

/**
* @internal
* A framebuffer holder object
*/
export class Framebuffer {
Expand Down
1 change: 1 addition & 0 deletions src/gl/index_buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {TriangleIndexArray, LineIndexArray, LineStripIndexArray} from '../d
import type {Context} from '../gl/context';

/**
* @internal
* an index buffer class
*/
export class IndexBuffer {
Expand Down
1 change: 1 addition & 0 deletions src/gl/vertex_buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const AttributeType = {
};

/**
* @internal
* The `VertexBuffer` class turns a `StructArray` into a WebGL buffer. Each member of the StructArray's
* Struct type is converted to a WebGL attribute.
*/
Expand Down
1 change: 1 addition & 0 deletions src/render/painter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type PainterOptions = {
};

/**
* @internal
* Initialize a new painter object.
*/
export class Painter {
Expand Down
1 change: 1 addition & 0 deletions src/render/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function getTokenizedAttributesAndUniforms(array: Array<string>): Array<string>
}

/**
* @internal
* A webgl program to execute in the GPU space
*/
export class Program<Us extends UniformBindings> {
Expand Down
53 changes: 25 additions & 28 deletions src/render/terrain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {TerrainSpecification} from '@maplibre/maplibre-gl-style-spec';
import {LngLat, earthRadius} from '../geo/lng_lat';

/**
* @internal
* A terrain GPU related object
*/
export type TerrainData = {
Expand All @@ -36,6 +37,7 @@ export type TerrainData = {
}

/**
* @internal
* A terrain mesh object
*/
export type TerrainMesh = {
Expand All @@ -45,36 +47,31 @@ export type TerrainMesh = {
}

/**
* @internal
* This is the main class which handles most of the 3D Terrain logic. It has the following topics:
*
* 1. loads raster-dem tiles via the internal sourceCache this.sourceCache
* 2. creates a depth-framebuffer, which is used to calculate the visibility of coordinates
* 3. creates a coords-framebuffer, which is used the get to tile-coordinate for a screen-pixel
* 4. stores all render-to-texture tiles in the this.sourceCache._tiles
* 5. calculates the elevation for a specific tile-coordinate
* 6. creates a terrain-mesh
* 1) loads raster-dem tiles via the internal sourceCache this.sourceCache
* 2) creates a depth-framebuffer, which is used to calculate the visibility of coordinates
* 3) creates a coords-framebuffer, which is used the get to tile-coordinate for a screen-pixel
* 4) stores all render-to-texture tiles in the this.sourceCache._tiles
* 5) calculates the elevation for a specific tile-coordinate
* 6) creates a terrain-mesh
*
* A note about the GPU resource-usage:
*
* Framebuffers:
*
* - one for the depth & coords framebuffer with the size of the map-div.
* - one for rendering a tile to texture with the size of tileSize (= 512x512).
*
* Textures:
*
* - one texture for an empty raster-dem tile with size 1x1
* - one texture for an empty depth-buffer, when terrain is disabled with size 1x1
* - one texture for an each loaded raster-dem with size of the source.tileSize
* - one texture for the coords-framebuffer with the size of the map-div.
* - one texture for the depth-framebuffer with the size of the map-div.
* - one texture for the encoded tile-coords with the size 2*tileSize (=1024x1024)
* - finally for each render-to-texture tile (= this._tiles) a set of textures
* for each render stack (The stack-concept is documented in painter.ts).
*
* Normally there exists 1-3 Textures per tile, depending on the stylesheet.
* Each Textures has the size 2*tileSize (= 1024x1024). Also there exists a
* cache of the last 150 newest rendered tiles.
* A note about the GPU resource-usage:
* Framebuffers:
* - one for the depth & coords framebuffer with the size of the map-div.
* - one for rendering a tile to texture with the size of tileSize (= 512x512).
* Textures:
* - one texture for an empty raster-dem tile with size 1x1
* - one texture for an empty depth-buffer, when terrain is disabled with size 1x1
* - one texture for an each loaded raster-dem with size of the source.tileSize
* - one texture for the coords-framebuffer with the size of the map-div.
* - one texture for the depth-framebuffer with the size of the map-div.
* - one texture for the encoded tile-coords with the size 2*tileSize (=1024x1024)
* - finally for each render-to-texture tile (= this._tiles) a set of textures
* for each render stack (The stack-concept is documented in painter.ts).
* Normally there exists 1-3 Textures per tile, depending on the stylesheet.
* Each Textures has the size 2*tileSize (= 1024x1024). Also there exists a
* cache of the last 150 newest rendered tiles.
*
*/
export class Terrain {
Expand Down
1 change: 1 addition & 0 deletions src/render/texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type DataTextureImage = RGBAImage | AlphaImage | EmptyImage;
export type TextureImage = TexImageSource | DataTextureImage;

/**
* @internal
* A `Texture` GL related object
*/
export class Texture {
Expand Down
2 changes: 2 additions & 0 deletions src/render/uniform_binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type UniformValues<Us extends {}> = $ObjMap<Us, <V>(u: Uniform<V>) => V>;
export type UniformLocations = {[_: string]: WebGLUniformLocation};

/**
* @internal
* A base uniform abstract class
*/
abstract class Uniform<T> {
Expand Down Expand Up @@ -150,6 +151,7 @@ export {
};

/**
* @internal
* A uniform bindings
*/
export type UniformBindings = {[_: string]: Uniform<any>};
1 change: 1 addition & 0 deletions src/render/vertex_array_object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {IndexBuffer} from '../gl/index_buffer';
import type {Context} from '../gl/context';

/**
* @internal
* A vertex array object used to pass data to the webgl code
*/
export class VertexArrayObject {
Expand Down
1 change: 1 addition & 0 deletions src/source/source_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {Terrain} from '../render/terrain';
import {config} from '../util/config';

/**
* @internal
* `SourceCache` is responsible for
*
* - creating an instance of `Source`
Expand Down
12 changes: 6 additions & 6 deletions src/source/terrain_source_cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import type {SourceCache} from '../source/source_cache';
import {Terrain} from '../render/terrain';

/**
* @internal
* This class is a helper for the Terrain-class, it:
*
* - loads raster-dem tiles
* - manages all renderToTexture tiles.
* - caches previous rendered tiles.
* - finds all necessary renderToTexture tiles for a OverscaledTileID area
* - finds the corresponding raster-dem tile for OverscaledTileID
* - loads raster-dem tiles
* - manages all renderToTexture tiles.
* - caches previous rendered tiles.
* - finds all necessary renderToTexture tiles for a OverscaledTileID area
* - finds the corresponding raster-dem tile for OverscaledTileID
*/
export class TerrainSourceCache extends Evented {
/**
Expand Down
1 change: 1 addition & 0 deletions src/source/tile_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class CanonicalTileID implements ICanonicalTileID {
}

/**
* @internal
* An unwrapped tile identifier
*/
export class UnwrappedTileID {
Expand Down
4 changes: 4 additions & 0 deletions src/util/struct_array.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Note: all "sizes" are measured in bytes

/**
* @internal
* A view type size
*/
const viewTypes = {
Expand All @@ -14,6 +15,7 @@ const viewTypes = {
};

/**
* @internal
* A view type size
*/
export type ViewType = keyof typeof viewTypes;
Expand Down Expand Up @@ -46,6 +48,7 @@ const DEFAULT_CAPACITY = 128;
const RESIZE_MULTIPLIER = 5;

/**
* @internal
* A struct array memeber
*/
export type StructArrayMember = {
Expand All @@ -70,6 +73,7 @@ export type SerializedStructArray = {
};

/**
* @internal
* `StructArray` provides an abstraction over `ArrayBuffer` and `TypedArray`
* making it behave like an array of typed structs.
*
Expand Down

0 comments on commit 3ce2ce0

Please sign in to comment.