@openglobus/og 0.28.7 → 1.0.0-rc10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +218 -4
- package/README.md +33 -18
- package/lib/Deferred.d.ts +2 -2
- package/lib/Events.d.ts +1 -1
- package/lib/Globe.d.ts +22 -11
- package/lib/Object3d.d.ts +18 -15
- package/lib/Popup.d.ts +2 -2
- package/lib/assets/LabelWorker.worker-C24YLEkW.js.map +1 -0
- package/lib/assets/PlainSegmentWorker.worker-DJHXd0bF.js.map +1 -0
- package/lib/assets/TerrainWorker.worker-B4Gp0jCy.js.map +1 -0
- package/lib/bv/index.d.ts +2 -2
- package/lib/camera/Camera.d.ts +320 -33
- package/lib/camera/Frustum.d.ts +136 -15
- package/lib/camera/PlanetCamera.d.ts +114 -11
- package/lib/camera/index.d.ts +2 -2
- package/lib/control/CompassButton.d.ts +2 -2
- package/lib/control/EarthCoordinates.d.ts +5 -2
- package/lib/control/FramebufferPreview.d.ts +20 -4
- package/lib/control/GeoImageDragControl.d.ts +1 -1
- package/lib/control/LayerAnimation.d.ts +2 -2
- package/lib/control/LayerSwitcher.d.ts +3 -0
- package/lib/control/Lighting.d.ts +7 -2
- package/lib/control/Navigation.d.ts +27 -12
- package/lib/control/OrthoSwitcher.d.ts +18 -0
- package/lib/control/SimpleTouchNavigation.d.ts +44 -0
- package/lib/control/Sun.d.ts +4 -2
- package/lib/control/TouchNavigation.d.ts +4 -8
- package/lib/control/atmosphere/Atmosphere.d.ts +2 -0
- package/lib/control/atmosphere/AtmosphereConfig.d.ts +2 -6
- package/lib/control/depthCamera/DepthCamera.d.ts +118 -0
- package/lib/control/depthCamera/DepthCameraHandler.d.ts +25 -0
- package/lib/control/depthCamera/depth_camera.d.ts +2 -0
- package/lib/control/drawing/LineStringDrawingScene.d.ts +1 -0
- package/lib/control/drawing/PolygonDrawingScene.d.ts +14 -14
- package/lib/control/elevationProfile/ElevationProfile.d.ts +1 -1
- package/lib/control/elevationProfile/ElevationProfileLegend.d.ts +1 -1
- package/lib/control/elevationProfile/ElevationProfileScene.d.ts +9 -12
- package/lib/control/elevationProfile/ElevationProfileView.d.ts +16 -5
- package/lib/control/entityEditor/CameraEditorView.d.ts +62 -0
- package/lib/control/entityEditor/EntityEditor.d.ts +20 -0
- package/lib/control/entityEditor/EntityEditorDialog.d.ts +38 -0
- package/lib/control/{geoObjectEditor/GeoObjectEditorScene.d.ts → entityEditor/EntityEditorScene.d.ts} +28 -12
- package/lib/control/{geoObjectEditor/GeoObjectEditorDialog.d.ts → entityEditor/EntityEditorView.d.ts} +22 -23
- package/lib/control/entityEditor/ProjectorEditorView.d.ts +31 -0
- package/lib/control/{geoObjectEditor → entityEditor}/RotateEntity.d.ts +5 -1
- package/lib/control/{geoObjectEditor → entityEditor}/colors.d.ts +2 -2
- package/lib/control/entityTree/EntityTree.d.ts +46 -0
- package/lib/control/entityTree/EntityTreeView.d.ts +24 -0
- package/lib/control/heightRuler/HeightRulerScene.d.ts +3 -2
- package/lib/control/index.d.ts +7 -6
- package/lib/control/ruler/RulerScene.d.ts +8 -8
- package/lib/control/selection/SelectionScene.d.ts +6 -6
- package/lib/control/timeline/TimelineControl.d.ts +19 -2
- package/lib/control/timeline/TimelineModel.d.ts +1 -1
- package/lib/control/timeline/TimelineView.d.ts +52 -13
- package/lib/control/visibleExtent/segment.d.ts +7 -0
- package/lib/ellipsoid/index.d.ts +4 -4
- package/lib/entity/Entity.d.ts +114 -100
- package/lib/entity/EntityCollection.d.ts +140 -72
- package/lib/entity/{BaseBillboard.d.ts → billboard/BaseBillboard.d.ts} +16 -17
- package/lib/entity/{BaseBillboardHandler.d.ts → billboard/BaseBillboardHandler.d.ts} +24 -9
- package/lib/entity/{Billboard.d.ts → billboard/Billboard.d.ts} +11 -7
- package/lib/entity/{BillboardHandler.d.ts → billboard/BillboardHandler.d.ts} +1 -1
- package/lib/entity/{GeoObject.d.ts → geoObject/GeoObject.d.ts} +7 -6
- package/lib/entity/{GeoObjectHandler.d.ts → geoObject/GeoObjectHandler.d.ts} +32 -11
- package/lib/entity/{InstanceData.d.ts → geoObject/InstanceData.d.ts} +18 -13
- package/lib/entity/{Geometry.d.ts → geometry/Geometry.d.ts} +10 -10
- package/lib/entity/{GeometryHandler.d.ts → geometry/GeometryHandler.d.ts} +7 -7
- package/lib/entity/index.d.ts +8 -8
- package/lib/entity/{Label.d.ts → label/Label.d.ts} +12 -13
- package/lib/entity/{LabelHandler.d.ts → label/LabelHandler.d.ts} +31 -7
- package/lib/entity/{LabelWorker.d.ts → label/LabelWorker.d.ts} +3 -3
- package/lib/entity/{PointCloud.d.ts → pointCloud/PointCloud.d.ts} +18 -12
- package/lib/entity/{PointCloudHandler.d.ts → pointCloud/PointCloudHandler.d.ts} +4 -4
- package/lib/entity/polyline/Polyline.d.ts +242 -0
- package/lib/entity/polyline/PolylineBatchRenderer.d.ts +443 -0
- package/lib/entity/{PolylineHandler.d.ts → polyline/PolylineHandler.d.ts} +19 -7
- package/lib/entity/{Ray.d.ts → ray/Ray.d.ts} +29 -9
- package/lib/entity/{RayHandler.d.ts → ray/RayHandler.d.ts} +18 -8
- package/lib/entity/{Strip.d.ts → strip/Strip.d.ts} +21 -17
- package/lib/entity/{StripHandler.d.ts → strip/StripHandler.d.ts} +11 -6
- package/lib/index.d.ts +59 -42
- package/lib/layer/BaseGeoImage.d.ts +20 -17
- package/lib/layer/BaseTileMaterialLayer.d.ts +36 -0
- package/lib/layer/CanvasTiles.d.ts +20 -22
- package/lib/layer/GeoImage.d.ts +1 -1
- package/lib/layer/GeoTexture2d.d.ts +2 -2
- package/lib/layer/KML.d.ts +19 -18
- package/lib/layer/Layer.d.ts +72 -53
- package/lib/layer/Vector.d.ts +106 -37
- package/lib/layer/WMS.d.ts +1 -1
- package/lib/layer/XYZ.d.ts +14 -31
- package/lib/layer/index.d.ts +12 -12
- package/lib/math/Line2.d.ts +10 -1
- package/lib/math/Line3.d.ts +1 -1
- package/lib/math/Mat3.d.ts +3 -13
- package/lib/math/Mat4.d.ts +16 -10
- package/lib/math/Plane.d.ts +1 -1
- package/lib/math/Quat.d.ts +14 -12
- package/lib/math/Ray.d.ts +4 -3
- package/lib/math/Vec2.d.ts +25 -17
- package/lib/math/Vec3.d.ts +33 -31
- package/lib/math/Vec4.d.ts +1 -1
- package/lib/math/coder.d.ts +1 -1
- package/lib/math/index.d.ts +13 -14
- package/lib/mercator.d.ts +4 -4
- package/lib/og.css +2 -1
- package/lib/og.es.js +1 -1
- package/lib/og.es.js.map +1 -1
- package/lib/quadTree/EntityCollectionNode.d.ts +10 -10
- package/lib/quadTree/EntityCollectionsTreeStrategy.d.ts +8 -5
- package/lib/quadTree/QuadTreeStrategy.d.ts +6 -5
- package/lib/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +4 -4
- package/lib/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +7 -4
- package/lib/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/renderer/AtmosphereDeferredShading.d.ts +12 -0
- package/lib/renderer/IDeferredShadingPass.d.ts +8 -0
- package/lib/renderer/ITransparencyPass.d.ts +8 -0
- package/lib/renderer/PhongDeferredShading.d.ts +18 -0
- package/lib/renderer/Renderer.d.ts +195 -100
- package/lib/renderer/RendererEvents.d.ts +16 -5
- package/lib/renderer/WOITPass.d.ts +14 -0
- package/lib/renderer/cascadeShadows/CascadeShadowManager.d.ts +34 -0
- package/lib/renderer/cascadeShadows/CascadeShadowMap.d.ts +112 -0
- package/lib/renderer/cascadeShadows/cascade_shadow_depth.d.ts +2 -0
- package/lib/renderer/projectors/Projector.d.ts +66 -0
- package/lib/renderer/projectors/ProjectorManager.d.ts +85 -0
- package/lib/renderer/projectors/ProjectorsPass.d.ts +37 -0
- package/lib/renderer/shadows/ShadowManager.d.ts +40 -0
- package/lib/renderer/shadows/ShadowMap.d.ts +21 -0
- package/lib/renderer/textureUnits.d.ts +6 -0
- package/lib/res/fonts/Ephesis-Regular.json +1 -0
- package/lib/res/fonts/Ephesis-Regular.png +0 -0
- package/lib/res/fonts/Karla-Bold.json +1 -0
- package/lib/res/fonts/Karla-Bold.png +0 -0
- package/lib/res/fonts/Karla-Italic.json +1 -0
- package/lib/res/fonts/Karla-Italic.png +0 -0
- package/lib/res/fonts/Karla-Light.json +1 -0
- package/lib/res/fonts/Karla-Light.png +0 -0
- package/lib/res/fonts/Karla-Medium.json +1 -0
- package/lib/res/fonts/Karla-Medium.png +0 -0
- package/lib/res/fonts/Roboto-Regular.json +1 -37147
- package/lib/res/fonts/Roboto-Regular.png +0 -0
- package/lib/res/fonts/arial.json +1 -4321
- package/lib/res/fonts/arial.png +0 -0
- package/lib/res/night-4326.png +0 -0
- package/lib/res/night.png +0 -0
- package/lib/scene/AltitudeNearPlaneStrategy.d.ts +17 -0
- package/lib/scene/Axes.d.ts +4 -3
- package/lib/scene/Planet.d.ts +268 -72
- package/lib/scene/{RenderNode.d.ts → Scene.d.ts} +47 -51
- package/lib/scene/SkyBox.d.ts +7 -4
- package/lib/scene/index.d.ts +2 -2
- package/lib/segment/Segment.d.ts +38 -15
- package/lib/segment/SegmentLonLat.d.ts +0 -1
- package/lib/shadeModeConstants.d.ts +7 -0
- package/lib/shaders/applyDeferredDepth.d.ts +2 -0
- package/lib/shaders/atmos/atmos.d.ts +3 -3
- package/lib/shaders/billboard/billboard.d.ts +4 -3
- package/lib/shaders/common/uniforms.d.ts +27 -0
- package/lib/shaders/deferredShading/deferredShading.d.ts +2 -0
- package/lib/shaders/deferredShading/deferredShadingAtmos.d.ts +3 -0
- package/lib/shaders/depth.d.ts +2 -2
- package/lib/shaders/geo_object/geo_object.d.ts +9 -4
- package/lib/shaders/label/label.d.ts +4 -4
- package/lib/shaders/pointCloud.d.ts +2 -2
- package/lib/shaders/polyline/polyline.d.ts +7 -3
- package/lib/shaders/projectorsPass/projectorsPass.d.ts +2 -0
- package/lib/shaders/ray/ray.d.ts +3 -2
- package/lib/shaders/screenFrame.d.ts +2 -2
- package/lib/shaders/segment/segment.d.ts +7 -0
- package/lib/shaders/skybox.d.ts +2 -2
- package/lib/shaders/strip/strip.d.ts +3 -0
- package/lib/shaders/tone_mapping/toneMapping.d.ts +2 -2
- package/lib/shaders/varianceBlur.d.ts +2 -0
- package/lib/shaders/weightedOITResolve.d.ts +2 -0
- package/lib/terrain/BilTerrain.d.ts +1 -1
- package/lib/terrain/EmptyTerrain.d.ts +6 -7
- package/lib/terrain/GlobusTerrain.d.ts +18 -23
- package/lib/terrain/MapterhornTerrain.d.ts +10 -0
- package/lib/terrain/RgbTerrain.d.ts +19 -8
- package/lib/terrain/index.d.ts +10 -6
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/ui/Button.d.ts +7 -5
- package/lib/ui/ButtonGroup.d.ts +1 -1
- package/lib/ui/Checkbox.d.ts +2 -2
- package/lib/ui/Color.d.ts +7 -4
- package/lib/ui/Dialog.d.ts +30 -3
- package/lib/ui/Input.d.ts +19 -3
- package/lib/ui/Slider.d.ts +5 -2
- package/lib/ui/TitleBarView.d.ts +21 -0
- package/lib/ui/ToggleButton.d.ts +2 -2
- package/lib/ui/View.d.ts +1 -1
- package/lib/ui/icons.d.ts +1 -1
- package/lib/ui/index.d.ts +10 -9
- package/lib/utils/FontAtlas.d.ts +61 -10
- package/lib/utils/GeoImageCreator.d.ts +2 -2
- package/lib/utils/ImagesCacheManager.d.ts +3 -3
- package/lib/utils/Loader.d.ts +2 -2
- package/lib/utils/PlainSegmentWorker.d.ts +2 -2
- package/lib/utils/TerrainWorker.d.ts +2 -2
- package/lib/utils/TextureAtlas.d.ts +7 -2
- package/lib/utils/TextureResourceManager.d.ts +162 -0
- package/lib/utils/VectorTileCreator.d.ts +1 -1
- package/lib/utils/colorSpace.d.ts +9 -0
- package/lib/utils/gltf/gltfParser.d.ts +9 -2
- package/lib/utils/gltf/types.d.ts +24 -5
- package/lib/utils/shared.d.ts +12 -5
- package/lib/utils/textureResourceMeta.d.ts +9 -0
- package/lib/webgl/BaseFramebuffer.d.ts +35 -0
- package/lib/webgl/Framebuffer.d.ts +14 -13
- package/lib/webgl/Handler.d.ts +94 -99
- package/lib/webgl/ShaderProgram.d.ts +190 -0
- package/lib/webgl/index.d.ts +2 -2
- package/lib/webgl/variableHandlers.d.ts +2 -1
- package/package.json +79 -76
- package/lib/assets/LabelWorker.worker-BT1uJgYn.js.map +0 -1
- package/lib/assets/PlainSegmentWorker.worker-CT1cj8jj.js.map +0 -1
- package/lib/assets/TerrainWorker.worker-DmikdfB2.js.map +0 -1
- package/lib/control/CameraFrameComposer.d.ts +0 -19
- package/lib/control/CameraFrameHandler.d.ts +0 -26
- package/lib/control/OldMouseNavigation.d.ts +0 -65
- package/lib/control/ZoomControl.d.ts +0 -28
- package/lib/control/cameraDepthHandler/CameraDepthHandler.d.ts +0 -28
- package/lib/control/cameraDepthHandler/camera_depth.d.ts +0 -2
- package/lib/control/geoObjectEditor/GeoObjectEditor.d.ts +0 -13
- package/lib/control/visibleExtent/drawnode.d.ts +0 -7
- package/lib/entity/Polyline.d.ts +0 -417
- package/lib/light/LightSource.d.ts +0 -36
- package/lib/res/fonts/Roboto-Regular.ttf.cfg +0 -1340
- package/lib/res/fonts/Roboto-Regular.ttf.png +0 -0
- package/lib/res/fonts/arial.ttf.cfg +0 -1570
- package/lib/res/fonts/arial.ttf.png +0 -0
- package/lib/scene/BaseNode.d.ts +0 -61
- package/lib/shaders/drawnode/drawnode.d.ts +0 -8
- package/lib/webgl/Program.d.ts +0 -161
- package/lib/webgl/ProgramController.d.ts +0 -87
- /package/lib/control/{geoObjectEditor → entityEditor}/ArrowEntity.d.ts +0 -0
- /package/lib/control/{geoObjectEditor → entityEditor}/AxisTrackEntity.d.ts +0 -0
- /package/lib/control/{geoObjectEditor → entityEditor}/MoveAxisEntity.d.ts +0 -0
- /package/lib/control/{geoObjectEditor → entityEditor}/MovePlaneEntity.d.ts +0 -0
- /package/lib/entity/{LabelWorker.worker.d.ts → label/LabelWorker.worker.d.ts} +0 -0
package/lib/webgl/Handler.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ import type { EventsHandler } from "../Events";
|
|
|
4
4
|
import type { TypedArray } from "../utils/shared";
|
|
5
5
|
import { Vec2 } from "../math/Vec2";
|
|
6
6
|
import type { NumberArray2 } from "../math/Vec2";
|
|
7
|
-
import {
|
|
8
|
-
import { Program } from "./Program";
|
|
7
|
+
import { ShaderProgram } from "./ShaderProgram";
|
|
9
8
|
import { Stack } from "../Stack";
|
|
10
9
|
export type WebGLContextExt = {
|
|
11
10
|
type: string;
|
|
@@ -100,17 +99,17 @@ declare class Handler {
|
|
|
100
99
|
*/
|
|
101
100
|
gl: WebGLContextExt | null;
|
|
102
101
|
/**
|
|
103
|
-
* Shader program
|
|
102
|
+
* Shader program list.
|
|
104
103
|
* @public
|
|
105
|
-
* @type {Record<string,
|
|
104
|
+
* @type {Record<string, ShaderProgram>}
|
|
106
105
|
*/
|
|
107
|
-
programs: Record<string,
|
|
106
|
+
programs: Record<string, ShaderProgram>;
|
|
108
107
|
/**
|
|
109
|
-
* Current active shader program
|
|
108
|
+
* Current active shader program.
|
|
110
109
|
* @public
|
|
111
|
-
* @type {
|
|
110
|
+
* @type {ShaderProgram}
|
|
112
111
|
*/
|
|
113
|
-
activeProgram:
|
|
112
|
+
activeProgram: ShaderProgram | null;
|
|
114
113
|
/**
|
|
115
114
|
* Handler parameters.
|
|
116
115
|
* @private
|
|
@@ -157,24 +156,23 @@ declare class Handler {
|
|
|
157
156
|
createTexture: Record<string, CreateTextureFunc>;
|
|
158
157
|
createTextureDefault: CreateTextureFunc;
|
|
159
158
|
ONCANVASRESIZE: Function | null;
|
|
160
|
-
createTexture_n: CreateTextureFunc;
|
|
161
|
-
createTexture_l: CreateTextureFunc;
|
|
162
|
-
createTexture_mm: CreateTextureFunc;
|
|
163
|
-
createTexture_a: CreateTextureFunc;
|
|
164
159
|
intersectionObserver?: IntersectionObserver;
|
|
165
160
|
resizeObserver?: ResizeObserver;
|
|
166
161
|
protected _requestAnimationFrameId: number;
|
|
162
|
+
protected _clipControlZeroToOne: boolean;
|
|
163
|
+
clipControl: ((origin: number, depth: number) => void) | undefined;
|
|
164
|
+
protected _getMipmapLevels(width: number, height: number): number;
|
|
167
165
|
constructor(canvasTarget: string | HTMLCanvasElement | undefined, params?: IHandlerParameters);
|
|
168
166
|
set frameDelay(delay: number);
|
|
169
167
|
isInitialized(): boolean;
|
|
170
168
|
protected _createCanvas(): void;
|
|
171
169
|
/**
|
|
172
170
|
* The return value is null if the extension is not supported, or an extension object otherwise.
|
|
173
|
-
* @param {
|
|
171
|
+
* @param {WebGL2RenderingContext | null} gl - WebGl context pointer.
|
|
174
172
|
* @param {string} name - Extension name.
|
|
175
173
|
* @returns {any} -
|
|
176
174
|
*/
|
|
177
|
-
static getExtension(gl:
|
|
175
|
+
static getExtension(gl: WebGL2RenderingContext | null, name: string): any | undefined;
|
|
178
176
|
/**
|
|
179
177
|
* Returns a drawing context on the canvas, or null if the context identifier is not supported.
|
|
180
178
|
* @param {HTMLCanvasElement} canvas - HTML canvas object.
|
|
@@ -189,24 +187,37 @@ declare class Handler {
|
|
|
189
187
|
*/
|
|
190
188
|
setFrameCallback(callback: Function): void;
|
|
191
189
|
/**
|
|
192
|
-
* Creates empty texture.
|
|
190
|
+
* Creates an empty immutable 2D texture (WebGL2).
|
|
193
191
|
* @public
|
|
194
|
-
* @param {number} [width=1] -
|
|
195
|
-
* @param {number} [height=1] -
|
|
196
|
-
* @param {string} [filter="NEAREST"] -
|
|
197
|
-
* @param {string} [internalFormat="
|
|
198
|
-
* @param {string} [
|
|
199
|
-
* @param {
|
|
200
|
-
* @
|
|
201
|
-
|
|
192
|
+
* @param {number} [width=1] - Texture width in pixels.
|
|
193
|
+
* @param {number} [height=1] - Texture height in pixels.
|
|
194
|
+
* @param {string} [filter="NEAREST"] - GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER value.
|
|
195
|
+
* @param {string} [internalFormat="RGBA8"] - Sized internal format (e.g. "RGBA8", "RGBA16F", "R16F").
|
|
196
|
+
* @param {string} [param="CLAMP_TO_EDGE"] - GL_TEXTURE_WRAP_S/T value.
|
|
197
|
+
* @param {number} [levels=1] - Number of mipmap levels (immutable storage).
|
|
198
|
+
* @returns {WebGLTexture | null} - Created WebGL texture object.
|
|
199
|
+
*/
|
|
200
|
+
createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, param?: string, levels?: number): WebGLTexture | null;
|
|
201
|
+
/**
|
|
202
|
+
* Creates an empty immutable 2D array texture (WebGL2).
|
|
203
|
+
* @public
|
|
204
|
+
* @param {number} [width=1] - Texture width in pixels.
|
|
205
|
+
* @param {number} [height=1] - Texture height in pixels.
|
|
206
|
+
* @param {number} [depth=1] - Number of array layers.
|
|
207
|
+
* @param {string} [filter="NEAREST"] - GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER value.
|
|
208
|
+
* @param {string} [internalFormat="RGBA8"] - Sized internal format (e.g. "RGBA8", "R32F").
|
|
209
|
+
* @param {string} [param="CLAMP_TO_EDGE"] - GL_TEXTURE_WRAP_S/T value.
|
|
210
|
+
* @param {number} [levels=1] - Number of mipmap levels (immutable storage).
|
|
211
|
+
* @returns {WebGLTexture | null} - Created WebGL texture object.
|
|
202
212
|
*/
|
|
203
|
-
|
|
213
|
+
createEmptyTexture2DArrayExt(width?: number, height?: number, depth?: number, filter?: string, internalFormat?: string, param?: string, levels?: number): WebGLTexture | null;
|
|
204
214
|
/**
|
|
205
215
|
* Creates Empty NEAREST filtered texture.
|
|
206
216
|
* @public
|
|
207
217
|
* @param {number} width - Empty texture width.
|
|
208
218
|
* @param {number} height - Empty texture height.
|
|
209
|
-
* @param {number} [internalFormat]
|
|
219
|
+
* @param {number} [internalFormat] - Internal texture format, `gl.RGBA` by default.
|
|
220
|
+
* @param {number} [texParami] - Wrap mode for S/T axes, `gl.CLAMP_TO_EDGE` by default.
|
|
210
221
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
211
222
|
*/
|
|
212
223
|
createEmptyTexture_n(width: number, height: number, internalFormat?: number | null, texParami?: number | null): WebGLTexture | null;
|
|
@@ -220,46 +231,6 @@ declare class Handler {
|
|
|
220
231
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
221
232
|
*/
|
|
222
233
|
createEmptyTexture_l(width: number, height: number, internalFormat?: number | null, texParami?: number | null): WebGLTexture | null;
|
|
223
|
-
/**
|
|
224
|
-
* Creates NEAREST filter texture.
|
|
225
|
-
* @public
|
|
226
|
-
* @param {HTMLCanvasElement | Image} image - Image or Canvas object.
|
|
227
|
-
* @param {number} [internalFormat]
|
|
228
|
-
* @param {number} [texParami]
|
|
229
|
-
* @param {WebGLTexture | null} [texture=null]
|
|
230
|
-
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
231
|
-
*/
|
|
232
|
-
createTexture_n_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
233
|
-
/**
|
|
234
|
-
* Creates LINEAR filter texture.
|
|
235
|
-
* @public
|
|
236
|
-
* @param {ImageSource} image - Image or Canvas object.
|
|
237
|
-
* @param {number} [internalFormat]
|
|
238
|
-
* @param {number} [texParami]
|
|
239
|
-
* @param {WebGLTexture | null} [texture]
|
|
240
|
-
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
241
|
-
*/
|
|
242
|
-
createTexture_l_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
243
|
-
/**
|
|
244
|
-
* Creates MIPMAP filter texture.
|
|
245
|
-
* @public
|
|
246
|
-
* @param {ImageSource} image - Image or Canvas object.
|
|
247
|
-
* @param {number} [internalFormat]
|
|
248
|
-
* @param {number} [texParami]
|
|
249
|
-
* @param {WebGLTexture | null} [texture]
|
|
250
|
-
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
251
|
-
*/
|
|
252
|
-
createTexture_mm_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
253
|
-
/**
|
|
254
|
-
* Creates ANISOTROPY filter texture.
|
|
255
|
-
* @public
|
|
256
|
-
* @param {ImageSource} image - Image or Canvas object.
|
|
257
|
-
* @param {number} [internalFormat]
|
|
258
|
-
* @param {number} [texParami]
|
|
259
|
-
* @param {WebGLTexture | null} [texture]
|
|
260
|
-
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
261
|
-
*/
|
|
262
|
-
createTexture_a_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
263
234
|
/**
|
|
264
235
|
* Creates NEAREST filter texture.
|
|
265
236
|
* @public
|
|
@@ -269,7 +240,7 @@ declare class Handler {
|
|
|
269
240
|
* @param {WebGLTexture | null} [texture]
|
|
270
241
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
271
242
|
*/
|
|
272
|
-
|
|
243
|
+
createTexture_n(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
|
|
273
244
|
/**
|
|
274
245
|
* Creates LINEAR filter texture.
|
|
275
246
|
* @public
|
|
@@ -279,7 +250,7 @@ declare class Handler {
|
|
|
279
250
|
* @param {WebGLTexture | null} [texture]
|
|
280
251
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
281
252
|
*/
|
|
282
|
-
|
|
253
|
+
createTexture_l(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
|
|
283
254
|
/**
|
|
284
255
|
* Creates MIPMAP filter texture.
|
|
285
256
|
* @public
|
|
@@ -289,7 +260,7 @@ declare class Handler {
|
|
|
289
260
|
* @param {WebGLTexture | null} [texture]
|
|
290
261
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
291
262
|
*/
|
|
292
|
-
|
|
263
|
+
createTexture_mm(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
|
|
293
264
|
/**
|
|
294
265
|
* Creates ANISOTROPY filter texture.
|
|
295
266
|
* @public
|
|
@@ -299,7 +270,7 @@ declare class Handler {
|
|
|
299
270
|
* @param {WebGLTexture | null} [texture]
|
|
300
271
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
301
272
|
*/
|
|
302
|
-
|
|
273
|
+
createTexture_a(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
|
|
303
274
|
/**
|
|
304
275
|
* Creates cube texture.
|
|
305
276
|
* @public
|
|
@@ -310,17 +281,19 @@ declare class Handler {
|
|
|
310
281
|
* @param {string} params.ny - Negative Y or bottom image url.
|
|
311
282
|
* @param {string} params.pz - Positive Z or face image url.
|
|
312
283
|
* @param {string} params.nz - Negative Z or back image url.
|
|
284
|
+
* @param {number} [colorSpace=gl.SRGB8_ALPHA8] - Cube texture internal format (for example gl.SRGB8_ALPHA8 or gl.RGBA8).
|
|
285
|
+
* @param {number} [textureFilter=gl.LINEAR] - Cube texture filter (for example gl.LINEAR or gl.NEAREST).
|
|
313
286
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
314
287
|
*/
|
|
315
|
-
loadCubeMapTexture(params: Texture3DParams):
|
|
288
|
+
loadCubeMapTexture(params: Texture3DParams, colorSpace?: number | null, textureFilter?: number | null): WebGLTextureExt | null;
|
|
316
289
|
/**
|
|
317
290
|
* Adds shader program to the handler.
|
|
318
291
|
* @public
|
|
319
|
-
* @param {
|
|
292
|
+
* @param {ShaderProgram} program - Shader program.
|
|
320
293
|
* @param {boolean} [activate] - If false program will not compile.
|
|
321
|
-
* @return {
|
|
294
|
+
* @return {ShaderProgram} -
|
|
322
295
|
*/
|
|
323
|
-
addProgram(program:
|
|
296
|
+
addProgram(program: ShaderProgram, activate?: boolean): ShaderProgram;
|
|
324
297
|
/**
|
|
325
298
|
* Removes shader program from handler.
|
|
326
299
|
* @public
|
|
@@ -330,15 +303,15 @@ declare class Handler {
|
|
|
330
303
|
/**
|
|
331
304
|
* Adds shader programs to the handler.
|
|
332
305
|
* @public
|
|
333
|
-
* @param {Array.<
|
|
306
|
+
* @param {Array.<ShaderProgram>} programsArr - Shader program array.
|
|
334
307
|
*/
|
|
335
|
-
addPrograms(programsArr:
|
|
308
|
+
addPrograms(programsArr: ShaderProgram[]): void;
|
|
336
309
|
/**
|
|
337
310
|
* Used in addProgram
|
|
338
311
|
* @protected
|
|
339
|
-
* @param {
|
|
312
|
+
* @param {ShaderProgram} program - ShaderProgram
|
|
340
313
|
*/
|
|
341
|
-
protected
|
|
314
|
+
protected _initProgram(program: ShaderProgram): void;
|
|
342
315
|
/**
|
|
343
316
|
* Used in init function.
|
|
344
317
|
* @private
|
|
@@ -353,7 +326,7 @@ declare class Handler {
|
|
|
353
326
|
*/
|
|
354
327
|
initializeExtension(extensionStr: string, showLog?: boolean): any;
|
|
355
328
|
/**
|
|
356
|
-
* Main function that
|
|
329
|
+
* Main function that initializes handler.
|
|
357
330
|
* @public
|
|
358
331
|
*/
|
|
359
332
|
initialize(): void;
|
|
@@ -363,41 +336,54 @@ declare class Handler {
|
|
|
363
336
|
* @protected
|
|
364
337
|
*/
|
|
365
338
|
protected _setDefaults(): void;
|
|
339
|
+
/**
|
|
340
|
+
* Returns true when clip-control depth range is currently ZERO_TO_ONE.
|
|
341
|
+
* @public
|
|
342
|
+
* @returns {boolean} -
|
|
343
|
+
*/
|
|
344
|
+
get isClipControlZeroToOne(): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Switches clip-control depth range between ZERO_TO_ONE and NEGATIVE_ONE_TO_ONE.
|
|
347
|
+
* If EXT_clip_control is unavailable, the internal ZERO_TO_ONE flag is reset to false.
|
|
348
|
+
* @public
|
|
349
|
+
* @param {boolean} useZeroToOne - True sets ZERO_TO_ONE, false sets NEGATIVE_ONE_TO_ONE.
|
|
350
|
+
*/
|
|
351
|
+
setClipControlZeroToOne(useZeroToOne: boolean): void;
|
|
366
352
|
getCanvasSize(): NumberArray2;
|
|
367
353
|
/**
|
|
368
|
-
* Creates
|
|
354
|
+
* Creates ARRAY_BUFFER storage for frequently updated data.
|
|
369
355
|
* @public
|
|
370
|
-
* @param {number} itemSize -
|
|
371
|
-
* @param {number} numItems -
|
|
372
|
-
* @param {number} [usage=
|
|
373
|
-
* @param {number} [bytes=4] -
|
|
356
|
+
* @param {number} itemSize - Number of scalar components per item.
|
|
357
|
+
* @param {number} numItems - Number of items.
|
|
358
|
+
* @param {number} [usage=STREAM_DRAW] - GL usage hint (STATIC_DRAW, DYNAMIC_DRAW or STREAM_DRAW).
|
|
359
|
+
* @param {number} [bytes=4] - Bytes per scalar component.
|
|
374
360
|
* @return {WebGLBufferExt} -
|
|
375
361
|
*/
|
|
376
362
|
createStreamArrayBuffer(itemSize: number, numItems: number, usage?: number, bytes?: number): WebGLBufferExt;
|
|
377
363
|
/**
|
|
378
|
-
*
|
|
364
|
+
* Uploads data to an existing ARRAY_BUFFER via bufferSubData.
|
|
379
365
|
* @public
|
|
380
|
-
* @param {WebGLBufferExt} buffer -
|
|
381
|
-
* @param {TypedArray} array -
|
|
382
|
-
* @param {number} [offset=0] -
|
|
366
|
+
* @param {WebGLBufferExt} buffer - Target ARRAY_BUFFER.
|
|
367
|
+
* @param {TypedArray} array - Source data to upload.
|
|
368
|
+
* @param {number} [offset=0] - Byte offset in the target buffer.
|
|
383
369
|
* @return {WebGLBufferExt} -
|
|
384
370
|
*/
|
|
385
371
|
setStreamArrayBuffer(buffer: WebGLBufferExt, array: TypedArray, offset?: number): WebGLBufferExt;
|
|
386
372
|
/**
|
|
387
|
-
* Creates
|
|
373
|
+
* Creates and initializes ARRAY_BUFFER from a typed array.
|
|
388
374
|
* @public
|
|
389
|
-
* @param {TypedArray} array -
|
|
390
|
-
* @param {number} itemSize -
|
|
391
|
-
* @param {number} numItems -
|
|
392
|
-
* @param {number} [usage=STATIC_DRAW] -
|
|
375
|
+
* @param {TypedArray} array - Source data.
|
|
376
|
+
* @param {number} itemSize - Number of scalar components per item.
|
|
377
|
+
* @param {number} [numItems] - Number of items (computed from array length when omitted).
|
|
378
|
+
* @param {number} [usage=STATIC_DRAW] - GL usage hint (STATIC_DRAW, DYNAMIC_DRAW or STREAM_DRAW).
|
|
393
379
|
* @return {WebGLBufferExt} -
|
|
394
380
|
*/
|
|
395
381
|
createArrayBuffer(array: TypedArray, itemSize: number, numItems?: number, usage?: number): WebGLBufferExt;
|
|
396
382
|
/**
|
|
397
|
-
* Creates
|
|
383
|
+
* Creates ARRAY_BUFFER storage with a specific byte length and no initial data.
|
|
398
384
|
* @public
|
|
399
|
-
* @param {number} size -
|
|
400
|
-
* @param {number} [usage=STATIC_DRAW] -
|
|
385
|
+
* @param {number} size - Buffer size in bytes.
|
|
386
|
+
* @param {number} [usage=STATIC_DRAW] - GL usage hint (STATIC_DRAW, DYNAMIC_DRAW or STREAM_DRAW).
|
|
401
387
|
* @return {WebGLBufferExt} -
|
|
402
388
|
*/
|
|
403
389
|
createArrayBufferLength(size: number, usage?: number): WebGLBufferExt;
|
|
@@ -472,14 +458,23 @@ declare class Handler {
|
|
|
472
458
|
*/
|
|
473
459
|
protected _animationFrameCallback(): void;
|
|
474
460
|
/**
|
|
475
|
-
* Creates default texture
|
|
461
|
+
* Creates a default 2x2 texture and passes it to callback.
|
|
462
|
+
* If `params.color` is set, a solid color texture is created.
|
|
463
|
+
* If `params.url` is set, the image is loaded asynchronously.
|
|
464
|
+
* Otherwise a fallback gray texture is created.
|
|
465
|
+
* @public
|
|
466
|
+
* @param {IDefaultTextureParams | null} params - Texture source parameters.
|
|
467
|
+
* @param {function(WebGLTextureExt): void} success - Callback with created texture.
|
|
468
|
+
*/
|
|
469
|
+
createDefaultTexture(params: IDefaultTextureParams | null, success: (texture: WebGLTextureExt) => void, internalFormat?: number | null): void;
|
|
470
|
+
/**
|
|
471
|
+
* Deletes texture if it is not marked as default.
|
|
476
472
|
* @public
|
|
477
|
-
* @param {
|
|
478
|
-
* @param {function(WebGLTextureExt): void} [success] - Creation callback.
|
|
473
|
+
* @param {WebGLTextureExt | null | undefined} texture - Texture to delete.
|
|
479
474
|
*/
|
|
480
|
-
createDefaultTexture(params: IDefaultTextureParams | null, success: (texture: WebGLTextureExt) => void): void;
|
|
481
475
|
deleteTexture(texture: WebGLTextureExt | null | undefined): void;
|
|
482
476
|
/**
|
|
477
|
+
* Releases handler resources, WebGL objects, observers and canvas.
|
|
483
478
|
* @public
|
|
484
479
|
*/
|
|
485
480
|
destroy(): void;
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { ProgramVariable } from "./variableHandlers";
|
|
2
|
+
import type { Handler, WebGLBufferExt } from "./Handler";
|
|
3
|
+
type WebGLProgramExt = WebGLProgram & {
|
|
4
|
+
[id: string]: WebGLUniformLocation | number | null;
|
|
5
|
+
};
|
|
6
|
+
type ProgramBinding = WebGLUniformLocation | number;
|
|
7
|
+
type ProgramMaterial = {
|
|
8
|
+
attributes: Record<string, any>;
|
|
9
|
+
uniforms: Record<string, any>;
|
|
10
|
+
vertexShader: string;
|
|
11
|
+
fragmentShader: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Represents more comfortable using WebGL shader program.
|
|
15
|
+
* @class
|
|
16
|
+
* @param {string} name - ShaderProgram name.
|
|
17
|
+
* @param {ProgramMaterial} material - Object stores uniforms, attributes and program codes:
|
|
18
|
+
* @param {Record<string, any>} material.uniforms - Uniforms definition section.
|
|
19
|
+
* @param {Record<string, any>} material.attributes - Attributes definition section.
|
|
20
|
+
* @param {string} material.vertexShader - Vertex glsl code.
|
|
21
|
+
* @param {string} material.fragmentShader - Fragment glsl code.
|
|
22
|
+
*/
|
|
23
|
+
declare class ShaderProgram {
|
|
24
|
+
[id: string]: any;
|
|
25
|
+
/**
|
|
26
|
+
* Shader program name.
|
|
27
|
+
* @public
|
|
28
|
+
* @type {string}
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
protected _handler: Handler | null;
|
|
32
|
+
_activated: boolean;
|
|
33
|
+
attributes: {
|
|
34
|
+
[id: string]: number;
|
|
35
|
+
};
|
|
36
|
+
uniforms: {
|
|
37
|
+
[id: string]: WebGLUniformLocation;
|
|
38
|
+
};
|
|
39
|
+
protected _attributes: Record<string, ProgramVariable>;
|
|
40
|
+
protected _uniforms: Record<string, ProgramVariable>;
|
|
41
|
+
vertexShader: string;
|
|
42
|
+
fragmentShader: string;
|
|
43
|
+
drawElementsInstanced: Function | null;
|
|
44
|
+
vertexAttribDivisor: Function | null;
|
|
45
|
+
/**
|
|
46
|
+
* Webgl context.
|
|
47
|
+
* @public
|
|
48
|
+
* @type {WebGL2RenderingContext | null}
|
|
49
|
+
*/
|
|
50
|
+
gl: WebGL2RenderingContext | null;
|
|
51
|
+
/**
|
|
52
|
+
* All program variables.
|
|
53
|
+
* @protected
|
|
54
|
+
* @type {Record<string, ProgramVariable>}
|
|
55
|
+
*/
|
|
56
|
+
protected _variables: Record<string, ProgramVariable>;
|
|
57
|
+
/**
|
|
58
|
+
* ShaderProgram pointer.
|
|
59
|
+
* @protected
|
|
60
|
+
* @type {WebGLProgramExt | null}
|
|
61
|
+
*/
|
|
62
|
+
protected _p: WebGLProgramExt | null;
|
|
63
|
+
/**
|
|
64
|
+
* Texture counter.
|
|
65
|
+
* @public
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
_textureID: number;
|
|
69
|
+
/**
|
|
70
|
+
* ShaderProgram attributes array.
|
|
71
|
+
* @protected
|
|
72
|
+
* @type {number[]}
|
|
73
|
+
*/
|
|
74
|
+
protected _attribArrays: number[];
|
|
75
|
+
/**
|
|
76
|
+
* ShaderProgram attributes divisors.
|
|
77
|
+
* @protected
|
|
78
|
+
* @type {number[]}
|
|
79
|
+
*/
|
|
80
|
+
protected _attribDivisor: number[];
|
|
81
|
+
protected _bindings: Record<string, ProgramBinding>;
|
|
82
|
+
protected _dynamicBindingNames: Set<string>;
|
|
83
|
+
constructor(name: string, material: ProgramMaterial);
|
|
84
|
+
/**
|
|
85
|
+
* Attaches this shader program to a handler.
|
|
86
|
+
* @param {Handler} handler - WebGL handler.
|
|
87
|
+
* @returns {ShaderProgram}
|
|
88
|
+
*/
|
|
89
|
+
attach(handler: Handler): this;
|
|
90
|
+
/**
|
|
91
|
+
* Initializes this shader program using handler WebGL context.
|
|
92
|
+
* @returns {ShaderProgram}
|
|
93
|
+
*/
|
|
94
|
+
initialize(): this;
|
|
95
|
+
protected _bindVariable(name: string, location: ProgramBinding): void;
|
|
96
|
+
/**
|
|
97
|
+
* Binds attribute buffer and sets its pointer.
|
|
98
|
+
* @param {ShaderProgram} program - Shader program instance.
|
|
99
|
+
* @param {ProgramVariable} variable - Attribute variable descriptor.
|
|
100
|
+
*/
|
|
101
|
+
static bindBuffer(program: ShaderProgram, variable: ProgramVariable): void;
|
|
102
|
+
/**
|
|
103
|
+
* Makes this shader program current in WebGL context.
|
|
104
|
+
*/
|
|
105
|
+
use(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Activates this shader program and disables previously active one.
|
|
108
|
+
* @returns {ShaderProgram}
|
|
109
|
+
*/
|
|
110
|
+
activate(): this;
|
|
111
|
+
/**
|
|
112
|
+
* Deactivates this shader program.
|
|
113
|
+
* @returns {ShaderProgram}
|
|
114
|
+
*/
|
|
115
|
+
deactivate(): this;
|
|
116
|
+
/**
|
|
117
|
+
* Returns `true` if this shader program is active.
|
|
118
|
+
* @returns {boolean}
|
|
119
|
+
*/
|
|
120
|
+
isActive(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Removes this shader program from its handler and releases WebGL program.
|
|
123
|
+
*/
|
|
124
|
+
remove(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Sets provided shader variables and applies them.
|
|
127
|
+
* Automatically activates this shader program.
|
|
128
|
+
* @param {Record<string, any>} material - Variable values by variable name.
|
|
129
|
+
* @returns {ShaderProgram}
|
|
130
|
+
*/
|
|
131
|
+
set(material: Record<string, any>): this;
|
|
132
|
+
/**
|
|
133
|
+
* Applies currently stored shader variable values.
|
|
134
|
+
*/
|
|
135
|
+
apply(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Draws indexed geometry from provided index buffer.
|
|
138
|
+
* @param {number} mode - WebGL draw mode.
|
|
139
|
+
* @param {WebGLBufferExt} buffer - Index buffer.
|
|
140
|
+
* @returns {ShaderProgram}
|
|
141
|
+
*/
|
|
142
|
+
drawIndexBuffer(mode: number, buffer: WebGLBufferExt): this;
|
|
143
|
+
/**
|
|
144
|
+
* Draws non-indexed geometry.
|
|
145
|
+
* @param {number} mode - WebGL draw mode.
|
|
146
|
+
* @param {number} numItems - Vertex count to draw.
|
|
147
|
+
* @returns {ShaderProgram}
|
|
148
|
+
*/
|
|
149
|
+
drawArrays(mode: number, numItems: number): this;
|
|
150
|
+
/**
|
|
151
|
+
* Check and log for a shader compile errors and warnings. Returns True - if no errors otherwise returns False.
|
|
152
|
+
* @private
|
|
153
|
+
* @param {WebGLShader} shader - WebGl shader program.
|
|
154
|
+
* @param {string} src - Shader program source.
|
|
155
|
+
* @returns {boolean} -
|
|
156
|
+
*/
|
|
157
|
+
protected _getShaderCompileStatus(shader: WebGLShader, src: string): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Returns compiled vertex shader program pointer.
|
|
160
|
+
* @private
|
|
161
|
+
* @param {string} src - Vertex shader source code.
|
|
162
|
+
* @returns {Object} -
|
|
163
|
+
*/
|
|
164
|
+
protected _createVertexShader(src: string): WebGLShader | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Returns compiled fragment shader program pointer.
|
|
167
|
+
* @private
|
|
168
|
+
* @param {string} src - Vertex shader source code.
|
|
169
|
+
* @returns {Object} -
|
|
170
|
+
*/
|
|
171
|
+
protected _createFragmentShader(src: string): WebGLShader | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Disables all attribute arrays used by this shader program.
|
|
174
|
+
*/
|
|
175
|
+
disableAttribArrays(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Enables all attribute arrays used by this shader program.
|
|
178
|
+
*/
|
|
179
|
+
enableAttribArrays(): void;
|
|
180
|
+
/**
|
|
181
|
+
* Deletes underlying WebGL program.
|
|
182
|
+
*/
|
|
183
|
+
delete(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Compiles shaders, links WebGL program and resolves variable locations.
|
|
186
|
+
* @param {WebGL2RenderingContext} gl - WebGL context.
|
|
187
|
+
*/
|
|
188
|
+
createProgram(gl: WebGL2RenderingContext): void;
|
|
189
|
+
}
|
|
190
|
+
export { ShaderProgram };
|
package/lib/webgl/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { Framebuffer } from "./Framebuffer";
|
|
|
2
2
|
import { Handler } from "./Handler";
|
|
3
3
|
import type { WebGLContextExt, WebGLBufferExt, WebGLTextureExt, ImageSource } from "./Handler";
|
|
4
4
|
import { Multisample } from "./Multisample";
|
|
5
|
-
import {
|
|
5
|
+
import { ShaderProgram } from "./ShaderProgram";
|
|
6
6
|
import { types } from "./types";
|
|
7
|
-
export { Framebuffer, Handler, Multisample, types,
|
|
7
|
+
export { Framebuffer, Handler, Multisample, types, ShaderProgram, WebGLContextExt, WebGLBufferExt, WebGLTextureExt, ImageSource };
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @module og/webgl/variableHandlers
|
|
3
3
|
*/
|
|
4
4
|
import type { WebGLBufferExt } from "./Handler";
|
|
5
|
+
import type { WebGLTextureExt } from "./Handler";
|
|
5
6
|
export type VariableHandler = {
|
|
6
7
|
u: {
|
|
7
8
|
[id: number]: Function;
|
|
@@ -14,7 +15,7 @@ export type ProgramVariable = {
|
|
|
14
15
|
type: string | number;
|
|
15
16
|
func: Function;
|
|
16
17
|
_pName: WebGLUniformLocation | number;
|
|
17
|
-
value: number | Float32Array | Int32Array | WebGLBufferExt;
|
|
18
|
+
value: number | Float32Array | Int32Array | WebGLBufferExt | WebGLTextureExt | WebGLTextureExt[];
|
|
18
19
|
itemType: string | number;
|
|
19
20
|
normalized: boolean;
|
|
20
21
|
divisor: number;
|