melonjs 14.0.1 → 14.1.0
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/README.md +2 -0
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +10 -0
- package/dist/melonjs.mjs/_virtual/arraymultimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/earcut.js +10 -0
- package/dist/melonjs.mjs/_virtual/howler.js +10 -0
- package/dist/melonjs.mjs/_virtual/index.js +10 -0
- package/dist/melonjs.mjs/_virtual/index2.js +10 -0
- package/dist/melonjs.mjs/_virtual/multimap.js +10 -0
- package/dist/melonjs.mjs/_virtual/setmultimap.js +10 -0
- package/dist/melonjs.mjs/application/application.js +240 -0
- package/dist/melonjs.mjs/audio/audio.js +536 -0
- package/dist/melonjs.mjs/camera/camera2d.js +732 -0
- package/dist/melonjs.mjs/entity/entity.js +248 -0
- package/dist/melonjs.mjs/game.js +29 -0
- package/dist/melonjs.mjs/geometries/ellipse.js +275 -0
- package/dist/melonjs.mjs/geometries/line.js +116 -0
- package/dist/melonjs.mjs/geometries/path2d.js +319 -0
- package/dist/melonjs.mjs/geometries/point.js +89 -0
- package/dist/melonjs.mjs/geometries/poly.js +500 -0
- package/dist/melonjs.mjs/geometries/rectangle.js +375 -0
- package/dist/melonjs.mjs/geometries/roundrect.js +168 -0
- package/dist/melonjs.mjs/index.js +248 -0
- package/dist/melonjs.mjs/input/gamepad.js +501 -0
- package/dist/melonjs.mjs/input/input.js +26 -0
- package/dist/melonjs.mjs/input/keyboard.js +470 -0
- package/dist/melonjs.mjs/input/pointer.js +393 -0
- package/dist/melonjs.mjs/input/pointerevent.js +818 -0
- package/dist/melonjs.mjs/lang/deprecated.js +157 -0
- package/dist/melonjs.mjs/level/level.js +297 -0
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +141 -0
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +448 -0
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +355 -0
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +194 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +639 -0
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +311 -0
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +83 -0
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +367 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +506 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +220 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +157 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +125 -0
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +109 -0
- package/dist/melonjs.mjs/loader/loader.js +801 -0
- package/dist/melonjs.mjs/loader/loadingscreen.js +120 -0
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +11 -0
- package/dist/melonjs.mjs/math/color.js +618 -0
- package/dist/melonjs.mjs/math/math.js +218 -0
- package/dist/melonjs.mjs/math/matrix2.js +503 -0
- package/dist/melonjs.mjs/math/matrix3.js +681 -0
- package/dist/melonjs.mjs/math/observable_vector2.js +471 -0
- package/dist/melonjs.mjs/math/observable_vector3.js +561 -0
- package/dist/melonjs.mjs/math/vector2.js +528 -0
- package/dist/melonjs.mjs/math/vector3.js +569 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +73 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +21 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +324 -0
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.js +69 -0
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +691 -0
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +350 -0
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +3241 -0
- package/dist/melonjs.mjs/particles/emitter.js +267 -0
- package/dist/melonjs.mjs/particles/particle.js +188 -0
- package/dist/melonjs.mjs/particles/settings.js +319 -0
- package/dist/melonjs.mjs/physics/body.js +704 -0
- package/dist/melonjs.mjs/physics/bounds.js +460 -0
- package/dist/melonjs.mjs/physics/collision.js +132 -0
- package/dist/melonjs.mjs/physics/detector.js +194 -0
- package/dist/melonjs.mjs/physics/quadtree.js +391 -0
- package/dist/melonjs.mjs/physics/response.js +57 -0
- package/dist/melonjs.mjs/physics/sat.js +483 -0
- package/dist/melonjs.mjs/physics/world.js +221 -0
- package/dist/melonjs.mjs/plugin/plugin.js +141 -0
- package/dist/melonjs.mjs/renderable/collectable.js +62 -0
- package/dist/melonjs.mjs/renderable/colorlayer.js +80 -0
- package/dist/melonjs.mjs/renderable/container.js +1018 -0
- package/dist/melonjs.mjs/renderable/dragndrop.js +224 -0
- package/dist/melonjs.mjs/renderable/imagelayer.js +306 -0
- package/dist/melonjs.mjs/renderable/light2d.js +156 -0
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +247 -0
- package/dist/melonjs.mjs/renderable/renderable.js +783 -0
- package/dist/melonjs.mjs/renderable/sprite.js +654 -0
- package/dist/melonjs.mjs/renderable/trigger.js +157 -0
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +213 -0
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +226 -0
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +128 -0
- package/dist/melonjs.mjs/state/stage.js +237 -0
- package/dist/melonjs.mjs/state/state.js +596 -0
- package/dist/melonjs.mjs/system/device.js +909 -0
- package/dist/melonjs.mjs/system/dom.js +78 -0
- package/dist/melonjs.mjs/system/event.js +537 -0
- package/dist/melonjs.mjs/system/platform.js +41 -0
- package/dist/melonjs.mjs/system/pooling.js +209 -0
- package/dist/melonjs.mjs/system/save.js +157 -0
- package/dist/melonjs.mjs/system/timer.js +286 -0
- package/dist/melonjs.mjs/text/bitmaptext.js +364 -0
- package/dist/melonjs.mjs/text/bitmaptextdata.js +199 -0
- package/dist/melonjs.mjs/text/glyph.js +66 -0
- package/dist/melonjs.mjs/text/text.js +453 -0
- package/dist/melonjs.mjs/text/textmetrics.js +176 -0
- package/dist/melonjs.mjs/text/textstyle.js +23 -0
- package/dist/melonjs.mjs/tweens/easing.js +336 -0
- package/dist/melonjs.mjs/tweens/interpolation.js +112 -0
- package/dist/melonjs.mjs/tweens/tween.js +480 -0
- package/dist/melonjs.mjs/utils/agent.js +76 -0
- package/dist/melonjs.mjs/utils/array.js +63 -0
- package/dist/melonjs.mjs/utils/file.js +42 -0
- package/dist/melonjs.mjs/utils/function.js +70 -0
- package/dist/melonjs.mjs/utils/string.js +82 -0
- package/dist/melonjs.mjs/utils/utils.js +173 -0
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +807 -0
- package/dist/melonjs.mjs/video/renderer.js +411 -0
- package/dist/melonjs.mjs/video/texture/atlas.js +519 -0
- package/dist/melonjs.mjs/video/texture/cache.js +143 -0
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +144 -0
- package/dist/melonjs.mjs/video/video.js +462 -0
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +143 -0
- package/dist/melonjs.mjs/video/webgl/glshader.js +168 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +10 -0
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +10 -0
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +20 -0
- package/dist/melonjs.mjs/video/webgl/utils/program.js +67 -0
- package/dist/melonjs.mjs/video/webgl/utils/string.js +25 -0
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +92 -0
- package/dist/melonjs.mjs/video/webgl/webgl_compositor.js +495 -0
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1036 -0
- package/dist/melonjs.module.d.ts +1163 -1163
- package/dist/melonjs.module.js +1903 -3274
- package/package.json +22 -17
- package/src/application/application.js +3 -3
- package/src/audio/audio.js +32 -32
- package/src/camera/camera2d.js +31 -31
- package/src/entity/entity.js +17 -17
- package/src/geometries/ellipse.js +16 -16
- package/src/geometries/line.js +5 -5
- package/src/geometries/path2d.js +32 -32
- package/src/geometries/poly.js +15 -15
- package/src/geometries/rectangle.js +18 -18
- package/src/geometries/roundrect.js +8 -8
- package/src/input/gamepad.js +15 -15
- package/src/input/keyboard.js +12 -12
- package/src/input/pointer.js +6 -6
- package/src/input/pointerevent.js +12 -12
- package/src/lang/deprecated.js +12 -12
- package/src/level/level.js +25 -25
- package/src/level/tiled/TMXLayer.js +22 -22
- package/src/level/tiled/TMXTile.js +5 -5
- package/src/level/tiled/TMXTileMap.js +6 -6
- package/src/level/tiled/TMXTileset.js +2 -2
- package/src/level/tiled/TMXUtils.js +5 -5
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +19 -19
- package/src/loader/loader.js +20 -20
- package/src/math/color.js +20 -20
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +16 -16
- package/src/math/matrix3.js +25 -25
- package/src/math/observable_vector2.js +14 -14
- package/src/math/observable_vector3.js +16 -16
- package/src/math/vector2.js +9 -9
- package/src/math/vector3.js +10 -10
- package/src/particles/emitter.js +6 -6
- package/src/particles/particle.js +2 -2
- package/src/physics/body.js +28 -28
- package/src/physics/bounds.js +8 -8
- package/src/physics/collision.js +2 -2
- package/src/physics/detector.js +6 -6
- package/src/physics/quadtree.js +11 -11
- package/src/physics/sat.js +31 -31
- package/src/physics/world.js +5 -5
- package/src/plugin/plugin.js +5 -5
- package/src/renderable/collectable.js +3 -3
- package/src/renderable/colorlayer.js +5 -5
- package/src/renderable/container.js +21 -21
- package/src/renderable/dragndrop.js +14 -14
- package/src/renderable/imagelayer.js +13 -13
- package/src/renderable/light2d.js +3 -3
- package/src/renderable/nineslicesprite.js +16 -16
- package/src/renderable/renderable.js +23 -23
- package/src/renderable/sprite.js +28 -28
- package/src/renderable/trigger.js +15 -15
- package/src/renderable/ui/uibaseelement.js +7 -7
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +13 -13
- package/src/state/stage.js +7 -7
- package/src/state/state.js +17 -17
- package/src/system/device.js +11 -11
- package/src/system/event.js +10 -10
- package/src/system/pooling.js +9 -9
- package/src/system/save.js +2 -2
- package/src/system/timer.js +10 -10
- package/src/text/bitmaptext.js +18 -18
- package/src/text/bitmaptextdata.js +2 -2
- package/src/text/text.js +23 -23
- package/src/text/textmetrics.js +8 -8
- package/src/tweens/tween.js +19 -19
- package/src/utils/agent.js +5 -5
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +2 -2
- package/src/utils/function.js +6 -6
- package/src/utils/string.js +5 -5
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +70 -70
- package/src/video/renderer.js +26 -26
- package/src/video/texture/atlas.js +22 -22
- package/src/video/texture/canvas_texture.js +9 -9
- package/src/video/video.js +17 -17
- package/src/video/webgl/glshader.js +10 -10
- package/src/video/webgl/webgl_compositor.js +41 -41
- package/src/video/webgl/webgl_renderer.js +75 -75
|
@@ -12,10 +12,10 @@ import { minify } from "./utils/string.js";
|
|
|
12
12
|
*/
|
|
13
13
|
class GLShader {
|
|
14
14
|
/**
|
|
15
|
-
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
16
|
-
* @param {string} vertex a string containing the GLSL source code to set
|
|
17
|
-
* @param {string} fragment a string containing the GLSL source code to set
|
|
18
|
-
* @param {string} [precision=auto detected] float precision ('lowp', 'mediump' or 'highp').
|
|
15
|
+
* @param {WebGLRenderingContext} gl - the current WebGL rendering context
|
|
16
|
+
* @param {string} vertex - a string containing the GLSL source code to set
|
|
17
|
+
* @param {string} fragment - a string containing the GLSL source code to set
|
|
18
|
+
* @param {string} [precision=auto detected] - float precision ('lowp', 'mediump' or 'highp').
|
|
19
19
|
* @see https://developer.mozilla.org/en-US/docs/Games/Techniques/3D_on_the_web/GLSL_Shaders
|
|
20
20
|
* @example
|
|
21
21
|
* // create a basic shader
|
|
@@ -90,7 +90,7 @@ class GLShader {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* returns the location of an attribute variable in this shader program
|
|
93
|
-
* @param {string} name the name of the attribute variable whose location to get.
|
|
93
|
+
* @param {string} name - the name of the attribute variable whose location to get.
|
|
94
94
|
* @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
|
|
95
95
|
*/
|
|
96
96
|
getAttribLocation(name) {
|
|
@@ -104,8 +104,8 @@ class GLShader {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Set the uniform to the given value
|
|
107
|
-
* @param {string} name the uniform name
|
|
108
|
-
* @param {object|Float32Array} value the value to assign to that uniform
|
|
107
|
+
* @param {string} name - the uniform name
|
|
108
|
+
* @param {object|Float32Array} value - the value to assign to that uniform
|
|
109
109
|
* @example
|
|
110
110
|
* myShader.setUniform("uProjectionMatrix", this.projectionMatrix);
|
|
111
111
|
*/
|
|
@@ -124,9 +124,9 @@ class GLShader {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* activate the given vertex attribute for this shader
|
|
127
|
-
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
128
|
-
* @param {object[]} attributes an array of vertex attributes
|
|
129
|
-
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
127
|
+
* @param {WebGLRenderingContext} gl - the current WebGL rendering context
|
|
128
|
+
* @param {object[]} attributes - an array of vertex attributes
|
|
129
|
+
* @param {number} vertexByteSize - the size of a single vertex in bytes
|
|
130
130
|
*/
|
|
131
131
|
setVertexAttributes(gl, attributes, vertexByteSize) {
|
|
132
132
|
// set the vertex attributes
|
|
@@ -24,7 +24,7 @@ var V_ARRAY = [
|
|
|
24
24
|
*/
|
|
25
25
|
class WebGLCompositor {
|
|
26
26
|
/**
|
|
27
|
-
* @param {WebGLRenderer} renderer the current WebGL renderer session
|
|
27
|
+
* @param {WebGLRenderer} renderer - the current WebGL renderer session
|
|
28
28
|
*/
|
|
29
29
|
constructor (renderer) {
|
|
30
30
|
this.init(renderer);
|
|
@@ -147,11 +147,11 @@ class WebGLCompositor {
|
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
* add vertex attribute property definition to the compositor
|
|
150
|
-
* @param {string} name name of the attribute in the vertex shader
|
|
151
|
-
* @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
152
|
-
* @param {GLenum} type data type of each component in the array
|
|
153
|
-
* @param {boolean} normalized whether integer data values should be normalized into a certain range when being cast to a float
|
|
154
|
-
* @param {number} offset offset in bytes of the first component in the vertex attribute array
|
|
150
|
+
* @param {string} name - name of the attribute in the vertex shader
|
|
151
|
+
* @param {number} size - number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
152
|
+
* @param {GLenum} type - data type of each component in the array
|
|
153
|
+
* @param {boolean} normalized - whether integer data values should be normalized into a certain range when being cast to a float
|
|
154
|
+
* @param {number} offset - offset in bytes of the first component in the vertex attribute array
|
|
155
155
|
*/
|
|
156
156
|
addAttribute(name, size, type, normalized, offset) {
|
|
157
157
|
this.attributes.push({
|
|
@@ -192,10 +192,10 @@ class WebGLCompositor {
|
|
|
192
192
|
|
|
193
193
|
/**
|
|
194
194
|
* Sets the viewport
|
|
195
|
-
* @param {number} x x position of viewport
|
|
196
|
-
* @param {number} y y position of viewport
|
|
197
|
-
* @param {number} w width of viewport
|
|
198
|
-
* @param {number} h height of viewport
|
|
195
|
+
* @param {number} x - x position of viewport
|
|
196
|
+
* @param {number} y - y position of viewport
|
|
197
|
+
* @param {number} w - width of viewport
|
|
198
|
+
* @param {number} h - height of viewport
|
|
199
199
|
*/
|
|
200
200
|
setViewport(x, y, w, h) {
|
|
201
201
|
this.gl.viewport(x, y, w, h);
|
|
@@ -203,15 +203,15 @@ class WebGLCompositor {
|
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Create a WebGL texture from an image
|
|
206
|
-
* @param {number} unit Destination texture unit
|
|
207
|
-
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
|
|
208
|
-
* @param {number} filter gl.LINEAR or gl.NEAREST
|
|
209
|
-
* @param {string} [repeat="no-repeat"] Image repeat behavior (see {@link ImageLayer#repeat})
|
|
210
|
-
* @param {number} [w] Source image width (Only use with UInt8Array[] or Float32Array[] source image)
|
|
211
|
-
* @param {number} [h] Source image height (Only use with UInt8Array[] or Float32Array[] source image)
|
|
212
|
-
* @param {number} [b] Source image border (Only use with UInt8Array[] or Float32Array[] source image)
|
|
213
|
-
* @param {boolean} [premultipliedAlpha=true] Multiplies the alpha channel into the other color channels
|
|
214
|
-
* @param {boolean} [mipmap=true] Whether mipmap levels should be generated for this texture
|
|
206
|
+
* @param {number} unit - Destination texture unit
|
|
207
|
+
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image - Source image
|
|
208
|
+
* @param {number} filter - gl.LINEAR or gl.NEAREST
|
|
209
|
+
* @param {string} [repeat="no-repeat"] - Image repeat behavior (see {@link ImageLayer#repeat})
|
|
210
|
+
* @param {number} [w] - Source image width (Only use with UInt8Array[] or Float32Array[] source image)
|
|
211
|
+
* @param {number} [h] - Source image height (Only use with UInt8Array[] or Float32Array[] source image)
|
|
212
|
+
* @param {number} [b] - Source image border (Only use with UInt8Array[] or Float32Array[] source image)
|
|
213
|
+
* @param {boolean} [premultipliedAlpha=true] - Multiplies the alpha channel into the other color channels
|
|
214
|
+
* @param {boolean} [mipmap=true] - Whether mipmap levels should be generated for this texture
|
|
215
215
|
* @returns {WebGLTexture} a WebGL texture
|
|
216
216
|
*/
|
|
217
217
|
createTexture2D(unit, image, filter, repeat = "no-repeat", w, h, b, premultipliedAlpha = true, mipmap = true) {
|
|
@@ -245,8 +245,8 @@ class WebGLCompositor {
|
|
|
245
245
|
|
|
246
246
|
/**
|
|
247
247
|
* delete the given WebGL texture
|
|
248
|
-
* @param {WebGLTexture} [texture] a WebGL texture to delete
|
|
249
|
-
* @param {number} [unit] Texture unit to delete
|
|
248
|
+
* @param {WebGLTexture} [texture] - a WebGL texture to delete
|
|
249
|
+
* @param {number} [unit] - Texture unit to delete
|
|
250
250
|
*/
|
|
251
251
|
deleteTexture2D(texture) {
|
|
252
252
|
this.gl.deleteTexture(texture);
|
|
@@ -255,7 +255,7 @@ class WebGLCompositor {
|
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
257
|
* returns the WebGL texture associated to the given texture unit
|
|
258
|
-
* @param {number} unit Texture unit to which a texture is bound
|
|
258
|
+
* @param {number} unit - Texture unit to which a texture is bound
|
|
259
259
|
* @returns {WebGLTexture} texture a WebGL texture
|
|
260
260
|
*/
|
|
261
261
|
getTexture2D(unit) {
|
|
@@ -264,8 +264,8 @@ class WebGLCompositor {
|
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
266
|
* assign the given WebGL texture to the current batch
|
|
267
|
-
* @param {WebGLTexture} texture a WebGL texture
|
|
268
|
-
* @param {number} unit Texture unit to which the given texture is bound
|
|
267
|
+
* @param {WebGLTexture} texture - a WebGL texture
|
|
268
|
+
* @param {number} unit - Texture unit to which the given texture is bound
|
|
269
269
|
*/
|
|
270
270
|
bindTexture2D(texture, unit) {
|
|
271
271
|
var gl = this.gl;
|
|
@@ -289,8 +289,8 @@ class WebGLCompositor {
|
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* unbind the given WebGL texture, forcing it to be reuploaded
|
|
292
|
-
* @param {WebGLTexture} [texture] a WebGL texture
|
|
293
|
-
* @param {number} [unit] a WebGL texture
|
|
292
|
+
* @param {WebGLTexture} [texture] - a WebGL texture
|
|
293
|
+
* @param {number} [unit] - a WebGL texture
|
|
294
294
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
295
295
|
*/
|
|
296
296
|
unbindTexture2D(texture, unit) {
|
|
@@ -342,7 +342,7 @@ class WebGLCompositor {
|
|
|
342
342
|
/**
|
|
343
343
|
* Select the shader to use for compositing
|
|
344
344
|
* @see GLShader
|
|
345
|
-
* @param {GLShader} shader a reference to a GLShader instance
|
|
345
|
+
* @param {GLShader} shader - a reference to a GLShader instance
|
|
346
346
|
*/
|
|
347
347
|
useShader(shader) {
|
|
348
348
|
if (this.activeShader !== shader) {
|
|
@@ -356,16 +356,16 @@ class WebGLCompositor {
|
|
|
356
356
|
|
|
357
357
|
/**
|
|
358
358
|
* Add a textured quad
|
|
359
|
-
* @param {TextureAtlas} texture Source texture atlas
|
|
360
|
-
* @param {number} x Destination x-coordinate
|
|
361
|
-
* @param {number} y Destination y-coordinate
|
|
362
|
-
* @param {number} w Destination width
|
|
363
|
-
* @param {number} h Destination height
|
|
364
|
-
* @param {number} u0 Texture UV (u0) value.
|
|
365
|
-
* @param {number} v0 Texture UV (v0) value.
|
|
366
|
-
* @param {number} u1 Texture UV (u1) value.
|
|
367
|
-
* @param {number} v1 Texture UV (v1) value.
|
|
368
|
-
* @param {number} tint tint color to be applied to the texture in UINT32 (argb) format
|
|
359
|
+
* @param {TextureAtlas} texture - Source texture atlas
|
|
360
|
+
* @param {number} x - Destination x-coordinate
|
|
361
|
+
* @param {number} y - Destination y-coordinate
|
|
362
|
+
* @param {number} w - Destination width
|
|
363
|
+
* @param {number} h - Destination height
|
|
364
|
+
* @param {number} u0 - Texture UV (u0) value.
|
|
365
|
+
* @param {number} v0 - Texture UV (v0) value.
|
|
366
|
+
* @param {number} u1 - Texture UV (u1) value.
|
|
367
|
+
* @param {number} v1 - Texture UV (v1) value.
|
|
368
|
+
* @param {number} tint - tint color to be applied to the texture in UINT32 (argb) format
|
|
369
369
|
*/
|
|
370
370
|
addQuad(texture, x, y, w, h, u0, v0, u1, v1, tint) {
|
|
371
371
|
|
|
@@ -410,7 +410,7 @@ class WebGLCompositor {
|
|
|
410
410
|
|
|
411
411
|
/**
|
|
412
412
|
* Flush batched texture operations to the GPU
|
|
413
|
-
* @param {number} [mode=gl.TRIANGLES] the GL drawing mode
|
|
413
|
+
* @param {number} [mode=gl.TRIANGLES] - the GL drawing mode
|
|
414
414
|
*/
|
|
415
415
|
flush(mode = this.mode) {
|
|
416
416
|
var vertex = this.vertexBuffer;
|
|
@@ -436,9 +436,9 @@ class WebGLCompositor {
|
|
|
436
436
|
|
|
437
437
|
/**
|
|
438
438
|
* Draw an array of vertices
|
|
439
|
-
* @param {GLenum} mode primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
440
|
-
* @param {Vector2d[]} verts vertices
|
|
441
|
-
* @param {number} [vertexCount=verts.length] amount of points defined in the points array
|
|
439
|
+
* @param {GLenum} mode - primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
440
|
+
* @param {Vector2d[]} verts - vertices
|
|
441
|
+
* @param {number} [vertexCount=verts.length] - amount of points defined in the points array
|
|
442
442
|
*/
|
|
443
443
|
drawVertices(mode, verts, vertexCount = verts.length) {
|
|
444
444
|
// use the primitive shader
|
|
@@ -16,20 +16,20 @@ import { isPowerOfTwo, nextPowerOfTwo } from "./../../math/math.js";
|
|
|
16
16
|
*/
|
|
17
17
|
class WebGLRenderer extends Renderer {
|
|
18
18
|
/**
|
|
19
|
-
* @param {object} options The renderer parameters
|
|
20
|
-
* @param {number} options.width The width of the canvas without scaling
|
|
21
|
-
* @param {number} options.height The height of the canvas without scaling
|
|
22
|
-
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
23
|
-
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
24
|
-
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
25
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
26
|
-
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
27
|
-
* @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
|
|
28
|
-
* @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
|
|
29
|
-
* @param {string} [options.powerPreference="default"] a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
30
|
-
* @param {number} [options.zoomX=width] The actual width of the canvas with scaling applied
|
|
31
|
-
* @param {number} [options.zoomY=height] The actual height of the canvas with scaling applied
|
|
32
|
-
* @param {WebGLCompositor} [options.compositor] A class that implements the compositor API
|
|
19
|
+
* @param {object} options - The renderer parameters
|
|
20
|
+
* @param {number} options.width - The width of the canvas without scaling
|
|
21
|
+
* @param {number} options.height - The height of the canvas without scaling
|
|
22
|
+
* @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
|
|
23
|
+
* @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing
|
|
24
|
+
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
25
|
+
* @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas
|
|
26
|
+
* @param {boolean} [options.premultipliedAlpha=true] - in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
27
|
+
* @param {boolean} [options.subPixel=false] - Whether to enable subpixel renderering (performance hit when enabled)
|
|
28
|
+
* @param {boolean} [options.preferWebGL1=false] - if true the renderer will only use WebGL 1
|
|
29
|
+
* @param {string} [options.powerPreference="default"] - a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
30
|
+
* @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
|
|
31
|
+
* @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
|
|
32
|
+
* @param {WebGLCompositor} [options.compositor] - A class that implements the compositor API
|
|
33
33
|
*/
|
|
34
34
|
constructor(options) {
|
|
35
35
|
|
|
@@ -176,7 +176,7 @@ class WebGLRenderer extends Renderer {
|
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
178
|
* set the active compositor for this renderer
|
|
179
|
-
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
179
|
+
* @param {WebGLCompositor|string} compositor - a compositor name or instance
|
|
180
180
|
*/
|
|
181
181
|
setCompositor(compositor = "default") {
|
|
182
182
|
|
|
@@ -244,8 +244,8 @@ class WebGLRenderer extends Renderer {
|
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* Create a pattern with the specified repetition
|
|
247
|
-
* @param {Image} image Source image
|
|
248
|
-
* @param {string} repeat Define how the pattern should be repeated
|
|
247
|
+
* @param {Image} image - Source image
|
|
248
|
+
* @param {string} repeat - Define how the pattern should be repeated
|
|
249
249
|
* @returns {TextureAtlas}
|
|
250
250
|
* @see ImageLayer#repeat
|
|
251
251
|
* @example
|
|
@@ -297,8 +297,8 @@ class WebGLRenderer extends Renderer {
|
|
|
297
297
|
|
|
298
298
|
/**
|
|
299
299
|
* Clears the gl context with the given color.
|
|
300
|
-
* @param {Color|string} [color="#000000"] CSS color.
|
|
301
|
-
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
300
|
+
* @param {Color|string} [color="#000000"] - CSS color.
|
|
301
|
+
* @param {boolean} [opaque=false] - Allow transparency [default] or clear the surface completely [true]
|
|
302
302
|
*/
|
|
303
303
|
clearColor(color = "#000000", opaque = false) {
|
|
304
304
|
var glArray;
|
|
@@ -317,10 +317,10 @@ class WebGLRenderer extends Renderer {
|
|
|
317
317
|
|
|
318
318
|
/**
|
|
319
319
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
320
|
-
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
321
|
-
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
322
|
-
* @param {number} width The rectangle's width.
|
|
323
|
-
* @param {number} height The rectangle's height.
|
|
320
|
+
* @param {number} x - x axis of the coordinate for the rectangle starting point.
|
|
321
|
+
* @param {number} y - y axis of the coordinate for the rectangle starting point.
|
|
322
|
+
* @param {number} width - The rectangle's width.
|
|
323
|
+
* @param {number} height - The rectangle's height.
|
|
324
324
|
*/
|
|
325
325
|
clearRect(x, y, width, height) {
|
|
326
326
|
this.save();
|
|
@@ -364,15 +364,15 @@ class WebGLRenderer extends Renderer {
|
|
|
364
364
|
|
|
365
365
|
/**
|
|
366
366
|
* Draw an image to the gl context
|
|
367
|
-
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
368
|
-
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
369
|
-
* @param {number} sy The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
370
|
-
* @param {number} sw The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
|
|
371
|
-
* @param {number} sh The height of the sub-rectangle of the source image to draw into the destination context.
|
|
372
|
-
* @param {number} dx The X coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
373
|
-
* @param {number} dy The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
374
|
-
* @param {number} dw The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
|
|
375
|
-
* @param {number} dh The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
|
|
367
|
+
* @param {Image} image - An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
368
|
+
* @param {number} sx - The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
369
|
+
* @param {number} sy - The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
370
|
+
* @param {number} sw - The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
|
|
371
|
+
* @param {number} sh - The height of the sub-rectangle of the source image to draw into the destination context.
|
|
372
|
+
* @param {number} dx - The X coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
373
|
+
* @param {number} dy - The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
|
|
374
|
+
* @param {number} dw - The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
|
|
375
|
+
* @param {number} dh - The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
|
|
376
376
|
* @example
|
|
377
377
|
* // Position the image on the canvas:
|
|
378
378
|
* renderer.drawImage(image, dx, dy);
|
|
@@ -414,7 +414,7 @@ class WebGLRenderer extends Renderer {
|
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
416
|
* Draw a pattern within the given rectangle.
|
|
417
|
-
* @param {TextureAtlas} pattern Pattern object
|
|
417
|
+
* @param {TextureAtlas} pattern - Pattern object
|
|
418
418
|
* @param {number} x
|
|
419
419
|
* @param {number} y
|
|
420
420
|
* @param {number} width
|
|
@@ -429,7 +429,7 @@ class WebGLRenderer extends Renderer {
|
|
|
429
429
|
/**
|
|
430
430
|
* Returns the WebGL Context object of the given canvas element
|
|
431
431
|
* @param {HTMLCanvasElement} canvas
|
|
432
|
-
* @param {boolean} [transparent=false] use true to enable transparency
|
|
432
|
+
* @param {boolean} [transparent=false] - use true to enable transparency
|
|
433
433
|
* @returns {WebGLRenderingContext}
|
|
434
434
|
*/
|
|
435
435
|
getContextGL(canvas, transparent = false) {
|
|
@@ -497,7 +497,7 @@ class WebGLRenderer extends Renderer {
|
|
|
497
497
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
498
498
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
499
499
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
500
|
-
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
500
|
+
* @param {string} [mode="normal"] - blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
501
501
|
* @param {WebGLRenderingContext} [gl]
|
|
502
502
|
*/
|
|
503
503
|
setBlendMode(mode = "normal", gl = this.gl) {
|
|
@@ -593,7 +593,7 @@ class WebGLRenderer extends Renderer {
|
|
|
593
593
|
|
|
594
594
|
/**
|
|
595
595
|
* rotates the uniform matrix
|
|
596
|
-
* @param {number} angle in radians
|
|
596
|
+
* @param {number} angle - in radians
|
|
597
597
|
*/
|
|
598
598
|
rotate(angle) {
|
|
599
599
|
this.currentTransform.rotate(angle);
|
|
@@ -619,7 +619,7 @@ class WebGLRenderer extends Renderer {
|
|
|
619
619
|
|
|
620
620
|
/**
|
|
621
621
|
* Set the global alpha
|
|
622
|
-
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
622
|
+
* @param {number} alpha - 0.0 to 1.0 values accepted.
|
|
623
623
|
*/
|
|
624
624
|
setGlobalAlpha(alpha) {
|
|
625
625
|
this.currentColor.alpha = alpha;
|
|
@@ -636,7 +636,7 @@ class WebGLRenderer extends Renderer {
|
|
|
636
636
|
/**
|
|
637
637
|
* Set the current fill & stroke style color.
|
|
638
638
|
* By default, or upon reset, the value is set to #000000.
|
|
639
|
-
* @param {Color|string} color css color string.
|
|
639
|
+
* @param {Color|string} color - css color string.
|
|
640
640
|
*/
|
|
641
641
|
setColor(color) {
|
|
642
642
|
var alpha = this.currentColor.alpha;
|
|
@@ -646,7 +646,7 @@ class WebGLRenderer extends Renderer {
|
|
|
646
646
|
|
|
647
647
|
/**
|
|
648
648
|
* Set the line width
|
|
649
|
-
* @param {number} width Line width
|
|
649
|
+
* @param {number} width - Line width
|
|
650
650
|
*/
|
|
651
651
|
setLineWidth(width) {
|
|
652
652
|
this.getContext().lineWidth(width);
|
|
@@ -654,12 +654,12 @@ class WebGLRenderer extends Renderer {
|
|
|
654
654
|
|
|
655
655
|
/**
|
|
656
656
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
657
|
-
* @param {number} x arc center point x-axis
|
|
658
|
-
* @param {number} y arc center point y-axis
|
|
657
|
+
* @param {number} x - arc center point x-axis
|
|
658
|
+
* @param {number} y - arc center point y-axis
|
|
659
659
|
* @param {number} radius
|
|
660
|
-
* @param {number} start start angle in radians
|
|
661
|
-
* @param {number} end end angle in radians
|
|
662
|
-
* @param {boolean} [antiClockwise=false] draw arc anti-clockwise
|
|
660
|
+
* @param {number} start - start angle in radians
|
|
661
|
+
* @param {number} end - end angle in radians
|
|
662
|
+
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
663
663
|
* @param {boolean} [fill=false]
|
|
664
664
|
*/
|
|
665
665
|
strokeArc(x, y, radius, start, end, antiClockwise = false, fill = false) {
|
|
@@ -679,12 +679,12 @@ class WebGLRenderer extends Renderer {
|
|
|
679
679
|
|
|
680
680
|
/**
|
|
681
681
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
682
|
-
* @param {number} x arc center point x-axis
|
|
683
|
-
* @param {number} y arc center point y-axis
|
|
682
|
+
* @param {number} x - arc center point x-axis
|
|
683
|
+
* @param {number} y - arc center point y-axis
|
|
684
684
|
* @param {number} radius
|
|
685
|
-
* @param {number} start start angle in radians
|
|
686
|
-
* @param {number} end end angle in radians
|
|
687
|
-
* @param {boolean} [antiClockwise=false] draw arc anti-clockwise
|
|
685
|
+
* @param {number} start - start angle in radians
|
|
686
|
+
* @param {number} end - end angle in radians
|
|
687
|
+
* @param {boolean} [antiClockwise=false] - draw arc anti-clockwise
|
|
688
688
|
*/
|
|
689
689
|
fillArc(x, y, radius, start, end, antiClockwise = false) {
|
|
690
690
|
this.strokeArc(x, y, radius, start, end, antiClockwise, true);
|
|
@@ -692,11 +692,11 @@ class WebGLRenderer extends Renderer {
|
|
|
692
692
|
|
|
693
693
|
/**
|
|
694
694
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
695
|
-
* @param {number} x ellipse center point x-axis
|
|
696
|
-
* @param {number} y ellipse center point y-axis
|
|
697
|
-
* @param {number} w horizontal radius of the ellipse
|
|
698
|
-
* @param {number} h vertical radius of the ellipse
|
|
699
|
-
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
695
|
+
* @param {number} x - ellipse center point x-axis
|
|
696
|
+
* @param {number} y - ellipse center point y-axis
|
|
697
|
+
* @param {number} w - horizontal radius of the ellipse
|
|
698
|
+
* @param {number} h - vertical radius of the ellipse
|
|
699
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
700
700
|
*/
|
|
701
701
|
strokeEllipse(x, y, w, h, fill = false) {
|
|
702
702
|
if (this.getGlobalAlpha() < 1 / 255) {
|
|
@@ -715,10 +715,10 @@ class WebGLRenderer extends Renderer {
|
|
|
715
715
|
|
|
716
716
|
/**
|
|
717
717
|
* Fill an ellipse at the specified coordinates with given radius
|
|
718
|
-
* @param {number} x ellipse center point x-axis
|
|
719
|
-
* @param {number} y ellipse center point y-axis
|
|
720
|
-
* @param {number} w horizontal radius of the ellipse
|
|
721
|
-
* @param {number} h vertical radius of the ellipse
|
|
718
|
+
* @param {number} x - ellipse center point x-axis
|
|
719
|
+
* @param {number} y - ellipse center point y-axis
|
|
720
|
+
* @param {number} w - horizontal radius of the ellipse
|
|
721
|
+
* @param {number} h - vertical radius of the ellipse
|
|
722
722
|
*/
|
|
723
723
|
fillEllipse(x, y, w, h) {
|
|
724
724
|
this.strokeEllipse(x, y, w, h, false);
|
|
@@ -726,10 +726,10 @@ class WebGLRenderer extends Renderer {
|
|
|
726
726
|
|
|
727
727
|
/**
|
|
728
728
|
* Stroke a line of the given two points
|
|
729
|
-
* @param {number} startX the start x coordinate
|
|
730
|
-
* @param {number} startY the start y coordinate
|
|
731
|
-
* @param {number} endX the end x coordinate
|
|
732
|
-
* @param {number} endY the end y coordinate
|
|
729
|
+
* @param {number} startX - the start x coordinate
|
|
730
|
+
* @param {number} startY - the start y coordinate
|
|
731
|
+
* @param {number} endX - the end x coordinate
|
|
732
|
+
* @param {number} endY - the end y coordinate
|
|
733
733
|
*/
|
|
734
734
|
strokeLine(startX, startY, endX, endY) {
|
|
735
735
|
if (this.getGlobalAlpha() < 1 / 255) {
|
|
@@ -745,10 +745,10 @@ class WebGLRenderer extends Renderer {
|
|
|
745
745
|
|
|
746
746
|
/**
|
|
747
747
|
* Fill a line of the given two points
|
|
748
|
-
* @param {number} startX the start x coordinate
|
|
749
|
-
* @param {number} startY the start y coordinate
|
|
750
|
-
* @param {number} endX the end x coordinate
|
|
751
|
-
* @param {number} endY the end y coordinate
|
|
748
|
+
* @param {number} startX - the start x coordinate
|
|
749
|
+
* @param {number} startY - the start y coordinate
|
|
750
|
+
* @param {number} endX - the end x coordinate
|
|
751
|
+
* @param {number} endY - the end y coordinate
|
|
752
752
|
*/
|
|
753
753
|
fillLine(startX, startY, endX, endY) {
|
|
754
754
|
this.strokeLine(startX, startY, endX, endY);
|
|
@@ -756,8 +756,8 @@ class WebGLRenderer extends Renderer {
|
|
|
756
756
|
|
|
757
757
|
/**
|
|
758
758
|
* Stroke a me.Polygon on the screen with a specified color
|
|
759
|
-
* @param {Polygon} poly the shape to draw
|
|
760
|
-
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
759
|
+
* @param {Polygon} poly - the shape to draw
|
|
760
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
761
761
|
*/
|
|
762
762
|
strokePolygon(poly, fill = false) {
|
|
763
763
|
if (this.getGlobalAlpha() < 1 / 255) {
|
|
@@ -785,7 +785,7 @@ class WebGLRenderer extends Renderer {
|
|
|
785
785
|
|
|
786
786
|
/**
|
|
787
787
|
* Fill a me.Polygon on the screen
|
|
788
|
-
* @param {Polygon} poly the shape to draw
|
|
788
|
+
* @param {Polygon} poly - the shape to draw
|
|
789
789
|
*/
|
|
790
790
|
fillPolygon(poly) {
|
|
791
791
|
this.strokePolygon(poly, true);
|
|
@@ -797,7 +797,7 @@ class WebGLRenderer extends Renderer {
|
|
|
797
797
|
* @param {number} y
|
|
798
798
|
* @param {number} width
|
|
799
799
|
* @param {number} height
|
|
800
|
-
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
800
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
801
801
|
*/
|
|
802
802
|
strokeRect(x, y, width, height, fill = false) {
|
|
803
803
|
if (this.getGlobalAlpha() < 1 / 255) {
|
|
@@ -831,7 +831,7 @@ class WebGLRenderer extends Renderer {
|
|
|
831
831
|
* @param {number} width
|
|
832
832
|
* @param {number} height
|
|
833
833
|
* @param {number} radius
|
|
834
|
-
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
834
|
+
* @param {boolean} [fill=false] - also fill the shape with the current color if true
|
|
835
835
|
*/
|
|
836
836
|
strokeRoundRect(x, y, width, height, radius, fill = false) {
|
|
837
837
|
if (this.getGlobalAlpha() < 1 / 255) {
|
|
@@ -883,7 +883,7 @@ class WebGLRenderer extends Renderer {
|
|
|
883
883
|
/**
|
|
884
884
|
* Reset (overrides) the renderer transformation matrix to the
|
|
885
885
|
* identity one, and then apply the given transformation matrix.
|
|
886
|
-
* @param {Matrix2d} mat2d Matrix to transform by
|
|
886
|
+
* @param {Matrix2d} mat2d - Matrix to transform by
|
|
887
887
|
*/
|
|
888
888
|
setTransform(mat2d) {
|
|
889
889
|
this.resetTransform();
|
|
@@ -892,7 +892,7 @@ class WebGLRenderer extends Renderer {
|
|
|
892
892
|
|
|
893
893
|
/**
|
|
894
894
|
* Multiply given matrix into the renderer tranformation matrix
|
|
895
|
-
* @param {Matrix2d} mat2d Matrix to transform by
|
|
895
|
+
* @param {Matrix2d} mat2d - Matrix to transform by
|
|
896
896
|
*/
|
|
897
897
|
transform(mat2d) {
|
|
898
898
|
var currentTransform = this.currentTransform;
|
|
@@ -972,8 +972,8 @@ class WebGLRenderer extends Renderer {
|
|
|
972
972
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
973
973
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
974
974
|
* Mask are not preserved through renderer context save and restore.
|
|
975
|
-
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
976
|
-
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
975
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] - a shape defining the mask to be applied
|
|
976
|
+
* @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
|
|
977
977
|
*/
|
|
978
978
|
setMask(mask, invert = false) {
|
|
979
979
|
var gl = this.gl;
|