@openglobus/og 0.10.6 → 0.11.1
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/package.json +10 -7
- package/src/og/Extent.js +1 -1
- package/src/og/LonLat.js +7 -2
- package/src/og/Popup.js +2 -1
- package/src/og/camera/PlanetCamera.js +4 -2
- package/src/og/entity/EntityCollection.js +1 -1
- package/src/og/entity/LabelHandler.js +366 -74
- package/src/og/entity/Polyline.js +3 -2
- package/src/og/layer/KML.js +7 -5
- package/src/og/layer/Vector.js +5 -0
- package/src/og/layer/index.js +2 -1
- package/src/og/math/Vec2.js +448 -448
- package/src/og/math/Vec3.js +759 -757
- package/src/og/math/Vec4.js +216 -215
- package/src/og/scene/Planet.js +14 -4
- package/src/og/segment/SegmentLonLat.js +7 -0
- package/src/og/terrain/GlobusTerrain.js +4 -0
- package/src/og/utils/GeoImageCreator.js +123 -121
- package/src/og/utils/Loader.js +81 -80
- package/src/og/utils/NormalMapCreator.js +320 -318
- package/src/og/utils/VectorTileCreator.js +251 -250
- package/src/og/webgl/Framebuffer.js +265 -264
- package/src/og/webgl/Handler.js +1022 -1022
- package/src/og/webgl/Multisample.js +169 -168
- package/src/og/webgl/ProgramController.js +113 -112
- package/types/Clock.d.ts +90 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +73 -0
- package/types/Extent.d.ts +162 -0
- package/types/Globe.d.ts +80 -0
- package/types/ImageCanvas.d.ts +121 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +38 -0
- package/types/QueueArray.d.ts +15 -0
- package/types/Rectangle.d.ts +74 -0
- package/types/Stack.d.ts +15 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +6 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +25 -0
- package/types/bv/Sphere.d.ts +32 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +303 -0
- package/types/camera/Frustum.d.ts +129 -0
- package/types/camera/PlanetCamera.d.ts +222 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +101 -0
- package/types/control/DebugInfo.d.ts +16 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +22 -0
- package/types/control/LayerSwitcher.d.ts +23 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +12 -0
- package/types/control/SimpleNavigation.d.ts +28 -0
- package/types/control/Sun.d.ts +52 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/ZoomControl.d.ts +28 -0
- package/types/control/index.d.ts +15 -0
- package/types/ellipsoid/Ellipsoid.d.ts +142 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +5 -0
- package/types/entity/BaseBillboard.d.ts +208 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +74 -0
- package/types/entity/Entity.d.ts +330 -0
- package/types/entity/EntityCollection.d.ts +303 -0
- package/types/entity/Geometry.d.ts +72 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +194 -0
- package/types/entity/LabelHandler.d.ts +24 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +303 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +123 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +118 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- package/types/inherits.d.ts +4 -0
- package/types/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +106 -0
- package/types/layer/CanvasTiles.d.ts +75 -0
- package/types/layer/GeoImage.d.ts +65 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +80 -0
- package/types/layer/KML.d.ts +58 -0
- package/types/layer/WMS.d.ts +66 -0
- package/types/layer/XYZ.d.ts +126 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +177 -0
- package/types/math/Mat3.d.ts +53 -0
- package/types/math/Mat4.d.ts +157 -0
- package/types/math/Plane.d.ts +17 -0
- package/types/math/Vec2.d.ts +308 -0
- package/types/math/Vec3.d.ts +459 -0
- package/types/math/Vec4.d.ts +161 -0
- package/types/math/coder.d.ts +42 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +5 -0
- package/types/proj/EPSG4326.d.ts +5 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/RendererEvents.d.ts +230 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +572 -0
- package/types/scene/RenderNode.d.ts +143 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +247 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +8 -0
- package/types/terrain/EmptyTerrain.d.ts +72 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +153 -0
- package/types/terrain/MapboxTerrain.d.ts +8 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +14 -0
- package/types/utils/GeoImageCreator.d.ts +29 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +230 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +372 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +155 -0
- package/types/webgl/ProgramController.d.ts +84 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class represents framebuffer.
|
|
3
|
+
* @class
|
|
4
|
+
* @param {og.webgl.Handler} handler - WebGL handler.
|
|
5
|
+
* @param {Object} [options] - Framebuffer options:
|
|
6
|
+
* @param {number} [options.width] - Framebuffer width. Default is handler canvas width.
|
|
7
|
+
* @param {number} [options.height] - Framebuffer height. Default is handler canvas height.
|
|
8
|
+
* @param {number} [options.size] - Color attachment size.
|
|
9
|
+
* @param {String} [options.internalFormat="RGBA"] - Specifies the color components in the texture.
|
|
10
|
+
* @param {String} [options.format="RGBA"] - Specifies the format of the texel data.
|
|
11
|
+
* @param {String} [options.type="UNSIGNED_BYTE"] - Specifies the data type of the texel data.
|
|
12
|
+
* @param {String} [options.depthComponent="DEPTH_COMPONENT16"] - Specifies depth buffer size.
|
|
13
|
+
* @param {Boolean} [options.useDepth] - Using depth buffer during the rendering.
|
|
14
|
+
*/
|
|
15
|
+
export class Framebuffer {
|
|
16
|
+
static blit(sourceFramebuffer: any, destFramebuffer: any, glAttachment: any, glMask: any, glFilter: any): void;
|
|
17
|
+
constructor(handler: any, options?: {});
|
|
18
|
+
/**
|
|
19
|
+
* WebGL handler.
|
|
20
|
+
* @public
|
|
21
|
+
* @type {og.webgl.Handler}
|
|
22
|
+
*/
|
|
23
|
+
public handler: any;
|
|
24
|
+
/**
|
|
25
|
+
* Framebuffer object.
|
|
26
|
+
* @private
|
|
27
|
+
* @type {Object}
|
|
28
|
+
*/
|
|
29
|
+
private _fbo;
|
|
30
|
+
_isBare: any;
|
|
31
|
+
/**
|
|
32
|
+
* Renderbuffer object.
|
|
33
|
+
* @private
|
|
34
|
+
* @type {Object}
|
|
35
|
+
*/
|
|
36
|
+
private _depthRenderbuffer;
|
|
37
|
+
_filter: any;
|
|
38
|
+
_internalFormatArr: any;
|
|
39
|
+
_formatArr: any;
|
|
40
|
+
_typeArr: any;
|
|
41
|
+
_attachmentArr: any;
|
|
42
|
+
/**
|
|
43
|
+
* Framebuffer width.
|
|
44
|
+
* @private
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
private _width;
|
|
48
|
+
/**
|
|
49
|
+
* Framebuffer width.
|
|
50
|
+
* @private
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
private _height;
|
|
54
|
+
_depthComponent: any;
|
|
55
|
+
_useDepth: any;
|
|
56
|
+
/**
|
|
57
|
+
* Framebuffer activity.
|
|
58
|
+
* @private
|
|
59
|
+
* @type {boolean}
|
|
60
|
+
*/
|
|
61
|
+
private _active;
|
|
62
|
+
_size: any;
|
|
63
|
+
/**
|
|
64
|
+
* Framebuffer texture.
|
|
65
|
+
* @public
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
public textures: number;
|
|
69
|
+
destroy(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Framebuffer initialization.
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
private init;
|
|
75
|
+
/**
|
|
76
|
+
* Bind buffer texture.
|
|
77
|
+
* @public
|
|
78
|
+
* @param{Object} texture - Output texture.
|
|
79
|
+
* @param {Number} [attachmentIndex=0] - color attachment index.
|
|
80
|
+
*/
|
|
81
|
+
public bindOutputTexture(texture: any, glAttachment: any): void;
|
|
82
|
+
/**
|
|
83
|
+
* Sets framebuffer viewport size.
|
|
84
|
+
* @public
|
|
85
|
+
* @param {number} width - Framebuffer width.
|
|
86
|
+
* @param {number} height - Framebuffer height.
|
|
87
|
+
*/
|
|
88
|
+
public setSize(width: number, height: number, forceDestroy: any): void;
|
|
89
|
+
/**
|
|
90
|
+
* Returns framebuffer completed.
|
|
91
|
+
* @public
|
|
92
|
+
* @returns {boolean} -
|
|
93
|
+
*/
|
|
94
|
+
public isComplete(): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Gets pixel RBGA color from framebuffer by coordinates.
|
|
97
|
+
* @public
|
|
98
|
+
* @param {Uint8Array} res - Normalized x - coordinate.
|
|
99
|
+
* @param {number} nx - Normalized x - coordinate.
|
|
100
|
+
* @param {number} ny - Normalized y - coordinate.
|
|
101
|
+
* @param {number} [w=1] - Normalized width.
|
|
102
|
+
* @param {number} [h=1] - Normalized height.
|
|
103
|
+
* @param {Number} [attachmentIndex=0] - color attachment index.
|
|
104
|
+
*/
|
|
105
|
+
public readPixels(res: Uint8Array, nx: number, ny: number, index?: number, w?: number, h?: number): void;
|
|
106
|
+
/**
|
|
107
|
+
* Reads all pixels(RGBA colors) from framebuffer.
|
|
108
|
+
* @public
|
|
109
|
+
* @param {Uint8Array} res - Result array.
|
|
110
|
+
* @param {Number} [attachmentIndex=0] - color attachment index.
|
|
111
|
+
*/
|
|
112
|
+
public readAllPixels(res: Uint8Array, attachmentIndex?: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Activate framebuffer frame to draw.
|
|
115
|
+
* @public
|
|
116
|
+
* @returns {og.webgl.Framebuffer} Returns Current framebuffer.
|
|
117
|
+
*/
|
|
118
|
+
public activate(): any;
|
|
119
|
+
/**
|
|
120
|
+
* Deactivate framebuffer frame.
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
public deactivate(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Gets JavaScript image object that framebuffer has drawn.
|
|
126
|
+
* @public
|
|
127
|
+
* @returns {Object} -
|
|
128
|
+
*/
|
|
129
|
+
public getImage(): any;
|
|
130
|
+
/**
|
|
131
|
+
* Open dialog window with framebuffer image.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
public openImage(): void;
|
|
135
|
+
}
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WebGL handler for accessing low-level WebGL capabilities.
|
|
3
|
+
* @class
|
|
4
|
+
* @param {string} id - Canvas element id that WebGL handler assing with. If it's null
|
|
5
|
+
* or undefined creates hidden canvas and handler bacomes hidden.
|
|
6
|
+
* @param {Object} [params] - Handler options:
|
|
7
|
+
* @param {number} [params.anisotropy] - Anisitropy filter degree. 8 is default.
|
|
8
|
+
* @param {number} [params.width] - Hidden handler width. 256 is default.
|
|
9
|
+
* @param {number} [params.height] - Hidden handler height. 256 is default.
|
|
10
|
+
* @param {Object} [param.scontext] - Native WebGL context attributes. See https://www.khronos.org/registry/webgl/specs/latest/1.0/#WEBGLCONTEXTATTRIBUTES
|
|
11
|
+
* @param {Array.<string>} [params.extensions] - Additional WebGL extension list. Available by default: EXT_texture_filter_anisotropic.
|
|
12
|
+
*/
|
|
13
|
+
export class Handler {
|
|
14
|
+
/**
|
|
15
|
+
* The return value is null if the extension is not supported, or an extension object otherwise.
|
|
16
|
+
* @param {Object} gl - WebGl context pointer.
|
|
17
|
+
* @param {String} name - Extension name.
|
|
18
|
+
* @returns {Object} -
|
|
19
|
+
*/
|
|
20
|
+
static getExtension(gl: any, name: string): any;
|
|
21
|
+
/**
|
|
22
|
+
* Returns a drawing context on the canvas, or null if the context identifier is not supported.
|
|
23
|
+
* @param {Object} canvas - HTML canvas object.
|
|
24
|
+
* @param {Object} [contextAttributes] - See canvas.getContext contextAttributes.
|
|
25
|
+
* @returns {Object} -
|
|
26
|
+
*/
|
|
27
|
+
static getContext(canvas: any, contextAttributes?: any): any;
|
|
28
|
+
constructor(id: any, params: any);
|
|
29
|
+
/**
|
|
30
|
+
* Application default timer.
|
|
31
|
+
* @public
|
|
32
|
+
* @type {og.Clock}
|
|
33
|
+
*/
|
|
34
|
+
public defaultClock: any;
|
|
35
|
+
/**
|
|
36
|
+
* Custom timers.
|
|
37
|
+
* @protected
|
|
38
|
+
* @type{og.Clock[]}
|
|
39
|
+
*/
|
|
40
|
+
protected _clocks: any[];
|
|
41
|
+
/**
|
|
42
|
+
* Draw frame time in milliseconds.
|
|
43
|
+
* @public
|
|
44
|
+
* @readonly
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
public readonly deltaTime: number;
|
|
48
|
+
/**
|
|
49
|
+
* WebGL rendering canvas element.
|
|
50
|
+
* @public
|
|
51
|
+
* @type {Object}
|
|
52
|
+
*/
|
|
53
|
+
public canvas: any;
|
|
54
|
+
/**
|
|
55
|
+
* WebGL context.
|
|
56
|
+
* @public
|
|
57
|
+
* @type {Object}
|
|
58
|
+
*/
|
|
59
|
+
public gl: any;
|
|
60
|
+
/**
|
|
61
|
+
* Shader program controller list.
|
|
62
|
+
* @public
|
|
63
|
+
* @type {Object.<og.webgl.ProgramController>}
|
|
64
|
+
*/
|
|
65
|
+
public programs: any;
|
|
66
|
+
/**
|
|
67
|
+
* Current active shader program controller.
|
|
68
|
+
* @public
|
|
69
|
+
* @type {og.webgl.ProgramController}
|
|
70
|
+
*/
|
|
71
|
+
public activeProgram: any;
|
|
72
|
+
/**
|
|
73
|
+
* Handler parameters.
|
|
74
|
+
* @private
|
|
75
|
+
* @type {Object}
|
|
76
|
+
*/
|
|
77
|
+
private _params;
|
|
78
|
+
_oneByHeight: number;
|
|
79
|
+
/**
|
|
80
|
+
* Current WebGL extensions. Becomes here after context initialization.
|
|
81
|
+
* @public
|
|
82
|
+
* @type {Object}
|
|
83
|
+
*/
|
|
84
|
+
public extensions: any;
|
|
85
|
+
/**
|
|
86
|
+
* HTML Canvas object id.
|
|
87
|
+
* @private
|
|
88
|
+
* @type {Object}
|
|
89
|
+
*/
|
|
90
|
+
private _id;
|
|
91
|
+
_lastAnimationFrameTime: number;
|
|
92
|
+
_initialized: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Animation frame function assigned from outside(Ex. from Renderer).
|
|
95
|
+
* @private
|
|
96
|
+
* @type {frameCallback}
|
|
97
|
+
*/
|
|
98
|
+
private _frameCallback;
|
|
99
|
+
transparentTexture: any;
|
|
100
|
+
framebufferStack: Stack;
|
|
101
|
+
/**
|
|
102
|
+
* Sets animation frame function.
|
|
103
|
+
* @public
|
|
104
|
+
* @param {callback} callback - Frame callback.
|
|
105
|
+
*/
|
|
106
|
+
public setFrameCallback(callback: any): void;
|
|
107
|
+
/**
|
|
108
|
+
* Creates NEAREST filter texture.
|
|
109
|
+
* @public
|
|
110
|
+
* @param {Object} image - Image or Canvas object.
|
|
111
|
+
* @returns {Object} - WebGL texture object.
|
|
112
|
+
*/
|
|
113
|
+
public createTexture_n(image: any): any;
|
|
114
|
+
/**
|
|
115
|
+
* Creates empty texture.
|
|
116
|
+
* @public
|
|
117
|
+
* @param {Number} [width=1] - Specifies the width of the texture image..
|
|
118
|
+
* @param {Number} [height=1] - Specifies the width of the texture image..
|
|
119
|
+
* @param {String} [filter="NEAREST"] - Specifies GL_TEXTURE_MIN(MAX)_FILTER texture value.
|
|
120
|
+
* @param {String} [internalFormat="RGBA"] - Specifies the color components in the texture.
|
|
121
|
+
* @param {String} [format="RGBA"] - Specifies the format of the texel data.
|
|
122
|
+
* @param {String} [type="UNSIGNED_BYTE"] - Specifies the data type of the texel data.
|
|
123
|
+
* @param {Number} [levels=0] - Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.
|
|
124
|
+
* @returns {Object} - WebGL texture object.
|
|
125
|
+
*/
|
|
126
|
+
public createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, format?: string, type?: string, level?: number): any;
|
|
127
|
+
/**
|
|
128
|
+
* Creates Empty NEAREST filtered texture.
|
|
129
|
+
* @public
|
|
130
|
+
* @param {number} width - Empty texture width.
|
|
131
|
+
* @param {number} height - Empty texture height.
|
|
132
|
+
* @returns {Object} - WebGL texture object.
|
|
133
|
+
*/
|
|
134
|
+
public createEmptyTexture_n(width: number, height: number): any;
|
|
135
|
+
/**
|
|
136
|
+
* Creates empty LINEAR filtered texture.
|
|
137
|
+
* @public
|
|
138
|
+
* @param {number} width - Empty texture width.
|
|
139
|
+
* @param {number} height - Empty texture height.
|
|
140
|
+
* @returns {Object} - WebGL texture object.
|
|
141
|
+
*/
|
|
142
|
+
public createEmptyTexture_l(width: number, height: number): any;
|
|
143
|
+
/**
|
|
144
|
+
* Creates LINEAR filter texture.
|
|
145
|
+
* @public
|
|
146
|
+
* @param {Object} image - Image or Canvas object.
|
|
147
|
+
* @returns {Object} - WebGL texture object.
|
|
148
|
+
*/
|
|
149
|
+
public createTexture_l(image: any): any;
|
|
150
|
+
/**
|
|
151
|
+
* Creates MIPMAP filter texture.
|
|
152
|
+
* @public
|
|
153
|
+
* @param {Object} image - Image or Canvas object.
|
|
154
|
+
* @returns {Object} - WebGL texture object.
|
|
155
|
+
*/
|
|
156
|
+
public createTexture_mm(image: any): any;
|
|
157
|
+
/**
|
|
158
|
+
* Creates ANISOTROPY filter texture.
|
|
159
|
+
* @public
|
|
160
|
+
* @param {Object} image - Image or Canvas object.
|
|
161
|
+
* @returns {Object} - WebGL texture object.
|
|
162
|
+
*/
|
|
163
|
+
public createTexture_a(image: any): any;
|
|
164
|
+
/**
|
|
165
|
+
* Creates DEFAULT filter texture, ANISOTROPY is default.
|
|
166
|
+
* @public
|
|
167
|
+
* @param {Object} image - Image or Canvas object.
|
|
168
|
+
* @returns {Object} - WebGL texture object.
|
|
169
|
+
*/
|
|
170
|
+
public createTexture(image: any): any;
|
|
171
|
+
/**
|
|
172
|
+
* Creates cube texture.
|
|
173
|
+
* @public
|
|
174
|
+
* @param {Object.<string>} params - Face image urls:
|
|
175
|
+
* @param {string} params.px - Positive X or right image url.
|
|
176
|
+
* @param {string} params.nx - Negative X or left image url.
|
|
177
|
+
* @param {string} params.py - Positive Y or up image url.
|
|
178
|
+
* @param {string} params.ny - Negative Y or bottom image url.
|
|
179
|
+
* @param {string} params.pz - Positive Z or face image url.
|
|
180
|
+
* @param {string} params.nz - Negative Z or back image url.
|
|
181
|
+
* @returns {Object} - WebGL texture object.
|
|
182
|
+
*/
|
|
183
|
+
public loadCubeMapTexture(params: any): any;
|
|
184
|
+
/**
|
|
185
|
+
* Adds shader program to the handler.
|
|
186
|
+
* @public
|
|
187
|
+
* @param {og.webgl.Program} program - Shader program.
|
|
188
|
+
* @param {boolean} [notActivate] - If it's true program will not compile.
|
|
189
|
+
* @return {og.webgl.Program} -
|
|
190
|
+
*/
|
|
191
|
+
public addProgram(program: any, notActivate?: boolean): any;
|
|
192
|
+
/**
|
|
193
|
+
* Removes shader program from handler.
|
|
194
|
+
* @public
|
|
195
|
+
* @param {String} name - Shader program name.
|
|
196
|
+
*/
|
|
197
|
+
public removeProgram(name: string): void;
|
|
198
|
+
/**
|
|
199
|
+
* Adds shader programs to the handler.
|
|
200
|
+
* @public
|
|
201
|
+
* @param {Array.<og.webgl.Program>} programsArr - Shader program array.
|
|
202
|
+
*/
|
|
203
|
+
public addPrograms(programsArr: Array<any>): void;
|
|
204
|
+
/**
|
|
205
|
+
* Used in addProgram
|
|
206
|
+
* @private
|
|
207
|
+
* @param {og.webgl.ProgramController} sc - Program controller
|
|
208
|
+
*/
|
|
209
|
+
private _initProgramController;
|
|
210
|
+
/**
|
|
211
|
+
* Used in init function.
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
private _initPrograms;
|
|
215
|
+
/**
|
|
216
|
+
* Initialize additional WebGL extensions.
|
|
217
|
+
* @public
|
|
218
|
+
* @param {string} extensionStr - Extension name.
|
|
219
|
+
* @param {boolean} showLog - Show logging.
|
|
220
|
+
* @return {Object} -
|
|
221
|
+
*/
|
|
222
|
+
public initializeExtension(extensionStr: string, showLog: boolean): any;
|
|
223
|
+
/**
|
|
224
|
+
* Main function that initialize handler.
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
public initialize(): void;
|
|
228
|
+
/**
|
|
229
|
+
* Sets default gl render parameters. Used in init function.
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
private _setDefaults;
|
|
233
|
+
/**
|
|
234
|
+
* Activate depth test.
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
public activateDepthTest(): void;
|
|
238
|
+
/**
|
|
239
|
+
* Deactivate depth test.
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
public deactivateDepthTest(): void;
|
|
243
|
+
/**
|
|
244
|
+
* Activate face culling.
|
|
245
|
+
* @public
|
|
246
|
+
*/
|
|
247
|
+
public activateFaceCulling(): void;
|
|
248
|
+
/**
|
|
249
|
+
* Deactivate face cullting.
|
|
250
|
+
* @public
|
|
251
|
+
*/
|
|
252
|
+
public deactivateFaceCulling(): void;
|
|
253
|
+
/**
|
|
254
|
+
* Activate blending.
|
|
255
|
+
* @public
|
|
256
|
+
*/
|
|
257
|
+
public activateBlending(): void;
|
|
258
|
+
/**
|
|
259
|
+
* Deactivate blending.
|
|
260
|
+
* @public
|
|
261
|
+
*/
|
|
262
|
+
public deactivateBlending(): void;
|
|
263
|
+
/**
|
|
264
|
+
* Creates STREAM_DRAW ARRAY buffer.
|
|
265
|
+
* @public
|
|
266
|
+
* @param {Array.<number>} array - Input array.
|
|
267
|
+
* @param {number} itemSize - Array item size.
|
|
268
|
+
* @param {number} numItems - Items quantity.
|
|
269
|
+
* @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
|
|
270
|
+
* @return {Object} -
|
|
271
|
+
*/
|
|
272
|
+
public createStreamArrayBuffer(itemSize: number, numItems: number, usage?: number, bites?: number): any;
|
|
273
|
+
/**
|
|
274
|
+
* Load stream ARRAY buffer.
|
|
275
|
+
* @public
|
|
276
|
+
* @param {Array.<number>} array - Input array.
|
|
277
|
+
* @param {number} itemSize - Array item size.
|
|
278
|
+
* @param {number} numItems - Items quantity.
|
|
279
|
+
* @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
|
|
280
|
+
* @return {Object} -
|
|
281
|
+
*/
|
|
282
|
+
public setStreamArrayBuffer(buffer: any, array: Array<number>, offset?: number): any;
|
|
283
|
+
/**
|
|
284
|
+
* Creates ARRAY buffer.
|
|
285
|
+
* @public
|
|
286
|
+
* @param {Array.<number>} array - Input array.
|
|
287
|
+
* @param {number} itemSize - Array item size.
|
|
288
|
+
* @param {number} numItems - Items quantity.
|
|
289
|
+
* @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
|
|
290
|
+
* @return {Object} -
|
|
291
|
+
*/
|
|
292
|
+
public createArrayBuffer(array: Array<number>, itemSize: number, numItems: number, usage?: number): any;
|
|
293
|
+
/**
|
|
294
|
+
* Creates ELEMENT ARRAY buffer.
|
|
295
|
+
* @public
|
|
296
|
+
* @param {Array.<number>} array - Input array.
|
|
297
|
+
* @param {number} itemSize - Array item size.
|
|
298
|
+
* @param {number} numItems - Items quantity.
|
|
299
|
+
* @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
|
|
300
|
+
* @return {Object} -
|
|
301
|
+
*/
|
|
302
|
+
public createElementArrayBuffer(array: Array<number>, itemSize: number, numItems: number, usage?: number): any;
|
|
303
|
+
/**
|
|
304
|
+
* Sets handler canvas size.
|
|
305
|
+
* @public
|
|
306
|
+
* @param {number} w - Canvas width.
|
|
307
|
+
* @param {number} h - Canvas height.
|
|
308
|
+
*/
|
|
309
|
+
public setSize(w: number, h: number): void;
|
|
310
|
+
/**
|
|
311
|
+
* Returns context screen width.
|
|
312
|
+
* @public
|
|
313
|
+
* @returns {number} -
|
|
314
|
+
*/
|
|
315
|
+
public getWidth(): number;
|
|
316
|
+
/**
|
|
317
|
+
* Returns context screen height.
|
|
318
|
+
* @public
|
|
319
|
+
* @returns {number} -
|
|
320
|
+
*/
|
|
321
|
+
public getHeight(): number;
|
|
322
|
+
/**
|
|
323
|
+
* Returns canvas aspect ratio.
|
|
324
|
+
* @public
|
|
325
|
+
* @returns {number} -
|
|
326
|
+
*/
|
|
327
|
+
public getClientAspect(): number;
|
|
328
|
+
/**
|
|
329
|
+
* Returns screen center coordinates.
|
|
330
|
+
* @public
|
|
331
|
+
* @returns {number} -
|
|
332
|
+
*/
|
|
333
|
+
public getCenter(): number;
|
|
334
|
+
/**
|
|
335
|
+
* Draw single frame.
|
|
336
|
+
* @public
|
|
337
|
+
* @param {number} now - Frame current time milliseconds.
|
|
338
|
+
*/
|
|
339
|
+
public drawFrame(): void;
|
|
340
|
+
/**
|
|
341
|
+
* Clearing gl frame.
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
public clearFrame(): void;
|
|
345
|
+
/**
|
|
346
|
+
* Starts animation loop.
|
|
347
|
+
* @public
|
|
348
|
+
*/
|
|
349
|
+
public start(): void;
|
|
350
|
+
stop(): void;
|
|
351
|
+
_requestAnimationFrameId: number;
|
|
352
|
+
/**
|
|
353
|
+
* Make animation.
|
|
354
|
+
* @private
|
|
355
|
+
*/
|
|
356
|
+
private _animationFrameCallback;
|
|
357
|
+
/**
|
|
358
|
+
* Creates default texture object
|
|
359
|
+
* @public
|
|
360
|
+
* @param {Object} [params] - Texture parameters:
|
|
361
|
+
* @param {callback} [success] - Creation callback
|
|
362
|
+
*/
|
|
363
|
+
public createDefaultTexture(params?: any, success?: any): void;
|
|
364
|
+
/**
|
|
365
|
+
* @public
|
|
366
|
+
*/
|
|
367
|
+
public destroy(): void;
|
|
368
|
+
addClock(clock: any): void;
|
|
369
|
+
addClocks(clockArr: any): void;
|
|
370
|
+
removeClock(clock: any): void;
|
|
371
|
+
}
|
|
372
|
+
import { Stack } from "../Stack.js";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class represents multisample framebuffer.
|
|
3
|
+
* @class
|
|
4
|
+
* @param {og.webgl.Handler} handler - WebGL handler.
|
|
5
|
+
* @param {Object} [options] - Framebuffer options:
|
|
6
|
+
* @param {number} [options.width] - Framebuffer width. Default is handler canvas width.
|
|
7
|
+
* @param {number} [options.height] - Framebuffer height. Default is handler canvas height.
|
|
8
|
+
* @param {Object} [options.texture] - Texture to render.
|
|
9
|
+
* @param {String} [options.depthComponent="DEPTH_COMPONENT16"] - Specifies depth buffer size.
|
|
10
|
+
* @param {Boolean} [options.useDepth] - Using depth buffer during the rendering.
|
|
11
|
+
*/
|
|
12
|
+
export class Multisample {
|
|
13
|
+
constructor(handler: any, options: any);
|
|
14
|
+
/**
|
|
15
|
+
* WebGL handler.
|
|
16
|
+
* @public
|
|
17
|
+
* @type {og.webgl.Handler}
|
|
18
|
+
*/
|
|
19
|
+
public handler: any;
|
|
20
|
+
_internalFormat: any;
|
|
21
|
+
/**
|
|
22
|
+
* Framebuffer object.
|
|
23
|
+
* @private
|
|
24
|
+
* @type {Object}
|
|
25
|
+
*/
|
|
26
|
+
private _fbo;
|
|
27
|
+
/**
|
|
28
|
+
* Renderbuffer object.
|
|
29
|
+
* @private
|
|
30
|
+
* @type {Object}
|
|
31
|
+
*/
|
|
32
|
+
private _depthRenderbuffer;
|
|
33
|
+
/**
|
|
34
|
+
* Framebuffer width.
|
|
35
|
+
* @private
|
|
36
|
+
* @type {number}
|
|
37
|
+
*/
|
|
38
|
+
private _width;
|
|
39
|
+
/**
|
|
40
|
+
* Framebuffer width.
|
|
41
|
+
* @private
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
44
|
+
private _height;
|
|
45
|
+
_msaa: any;
|
|
46
|
+
_useDepth: any;
|
|
47
|
+
_depthComponent: any;
|
|
48
|
+
/**
|
|
49
|
+
* Framebuffer activity.
|
|
50
|
+
* @private
|
|
51
|
+
* @type {boolean}
|
|
52
|
+
*/
|
|
53
|
+
private _active;
|
|
54
|
+
_size: any;
|
|
55
|
+
_filter: any;
|
|
56
|
+
_glFilter: any;
|
|
57
|
+
renderbuffers: any[];
|
|
58
|
+
destroy(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Framebuffer initialization.
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private init;
|
|
64
|
+
blitTo(framebuffer: any, attachmentIndex?: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Sets framebuffer viewport size.
|
|
67
|
+
* @public
|
|
68
|
+
* @param {number} width - Framebuffer width.
|
|
69
|
+
* @param {number} height - Framebuffer height.
|
|
70
|
+
*/
|
|
71
|
+
public setSize(width: number, height: number, forceDestroy: any): void;
|
|
72
|
+
/**
|
|
73
|
+
* Returns framebuffer completed.
|
|
74
|
+
* @public
|
|
75
|
+
* @returns {boolean} -
|
|
76
|
+
*/
|
|
77
|
+
public isComplete(): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Activate framebuffer frame to draw.
|
|
80
|
+
* @public
|
|
81
|
+
* @returns {og.webgl.Framebuffer} Returns Current framebuffer.
|
|
82
|
+
*/
|
|
83
|
+
public activate(): any;
|
|
84
|
+
/**
|
|
85
|
+
* Deactivate framebuffer frame.
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
public deactivate(): void;
|
|
89
|
+
}
|