@next2d/webgl 3.7.0 → 3.8.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 +3 -3
- package/src/Context/usecase/ContextDrawElementUseCase.js +2 -2
- package/src/Context/usecase/ContextDrawPixelsUseCase.js +2 -2
- package/src/Shader/Fragment/FragmentShaderSourceTexture.d.ts +1 -0
- package/src/Shader/Fragment/FragmentShaderSourceTexture.js +17 -0
- package/src/Shader/Variants/Blend/service/VariantsBlendTexturePremultiplyShaderService.d.ts +14 -0
- package/src/Shader/Variants/Blend/service/VariantsBlendTexturePremultiplyShaderService.js +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/webgl",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"description": "Next2D Webgl Package",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "git+https://github.com/Next2D/Player.git"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@next2d/texture-packer": "3.
|
|
28
|
-
"@next2d/render-queue": "3.
|
|
27
|
+
"@next2d/texture-packer": "3.8.1",
|
|
28
|
+
"@next2d/render-queue": "3.8.1"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execute as textureManagerCreateFromCanvasUseCase } from "../../TextureManager/usecase/TextureManagerCreateFromCanvasUseCase";
|
|
2
2
|
import { execute as textureManagerReleaseTextureObjectUseCase } from "../../TextureManager/usecase/TextureManagerReleaseTextureObjectUseCase";
|
|
3
|
-
import { execute as
|
|
3
|
+
import { execute as variantsBlendTexturePremultiplyShaderService } from "../../Shader/Variants/Blend/service/VariantsBlendTexturePremultiplyShaderService";
|
|
4
4
|
import { execute as shaderManagerSetTextureUniformService } from "../../Shader/ShaderManager/service/ShaderManagerSetTextureUniformService";
|
|
5
5
|
import { execute as shaderManagerDrawTextureUseCase } from "../../Shader/ShaderManager/usecase/ShaderManagerDrawTextureUseCase";
|
|
6
6
|
import { execute as blendResetService } from "../../Blend/service/BlendResetService";
|
|
@@ -16,7 +16,7 @@ import { execute as blendResetService } from "../../Blend/service/BlendResetServ
|
|
|
16
16
|
*/
|
|
17
17
|
export const execute = (node, element) => {
|
|
18
18
|
const textureObject = textureManagerCreateFromCanvasUseCase(node.w, node.h, element);
|
|
19
|
-
const shaderManager =
|
|
19
|
+
const shaderManager = variantsBlendTexturePremultiplyShaderService();
|
|
20
20
|
shaderManagerSetTextureUniformService(shaderManager, node.w, node.h);
|
|
21
21
|
// テクスチャを描画
|
|
22
22
|
blendResetService();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execute as textureManagerCreateFromPixelsUseCase } from "../../TextureManager/usecase/TextureManagerCreateFromPixelsUseCase";
|
|
2
2
|
import { execute as textureManagerReleaseTextureObjectUseCase } from "../../TextureManager/usecase/TextureManagerReleaseTextureObjectUseCase";
|
|
3
|
-
import { execute as
|
|
3
|
+
import { execute as variantsBlendTexturePremultiplyShaderService } from "../../Shader/Variants/Blend/service/VariantsBlendTexturePremultiplyShaderService";
|
|
4
4
|
import { execute as shaderManagerSetTextureUniformService } from "../../Shader/ShaderManager/service/ShaderManagerSetTextureUniformService";
|
|
5
5
|
import { execute as shaderManagerDrawTextureUseCase } from "../../Shader/ShaderManager/usecase/ShaderManagerDrawTextureUseCase";
|
|
6
6
|
import { execute as blendResetService } from "../../Blend/service/BlendResetService";
|
|
@@ -16,7 +16,7 @@ import { execute as blendResetService } from "../../Blend/service/BlendResetServ
|
|
|
16
16
|
*/
|
|
17
17
|
export const execute = (node, pixels) => {
|
|
18
18
|
const textureObject = textureManagerCreateFromPixelsUseCase(node.w, node.h, pixels);
|
|
19
|
-
const shaderManager =
|
|
19
|
+
const shaderManager = variantsBlendTexturePremultiplyShaderService();
|
|
20
20
|
shaderManagerSetTextureUniformService(shaderManager, node.w, node.h);
|
|
21
21
|
// テクスチャを描画
|
|
22
22
|
blendResetService();
|
|
@@ -21,6 +21,23 @@ void main() {
|
|
|
21
21
|
o_color = src;
|
|
22
22
|
}`;
|
|
23
23
|
};
|
|
24
|
+
export const TEXTURE_PREMULTIPLY = () => {
|
|
25
|
+
return `#version 300 es
|
|
26
|
+
precision mediump float;
|
|
27
|
+
|
|
28
|
+
uniform sampler2D u_texture;
|
|
29
|
+
|
|
30
|
+
in vec2 v_coord;
|
|
31
|
+
out vec4 o_color;
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
vec4 src = texture(u_texture, v_coord);
|
|
35
|
+
// ストレートアルファのソースをプリマルチプライドアルファへ変換して出力する。
|
|
36
|
+
// アトラスはプリマルチプライ空間で構築され blendFunc(ONE, ONE_MINUS_SRC_ALPHA) で
|
|
37
|
+
// 合成されるため、変換しないと透明部の白抜けや縁の白線が発生する。
|
|
38
|
+
o_color = vec4(src.rgb * src.a, src.a);
|
|
39
|
+
}`;
|
|
40
|
+
};
|
|
24
41
|
export const INSTANCE_TEXTURE = () => {
|
|
25
42
|
return `#version 300 es
|
|
26
43
|
precision mediump float;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShaderManager } from "../../../ShaderManager";
|
|
2
|
+
/**
|
|
3
|
+
* @description ストレートアルファのテクスチャをプリマルチプライドアルファへ変換して描画する
|
|
4
|
+
* シェーダーを生成して返却。画像(Bitmap)・TextField・Video など、ストレート
|
|
5
|
+
* アルファのソースをプリマルチプライ空間のアトラスへ合成する用途で使用する。
|
|
6
|
+
* Generate and return the shader that converts a straight-alpha texture into
|
|
7
|
+
* premultiplied alpha. Used for compositing straight-alpha sources (Bitmap
|
|
8
|
+
* image, TextField, Video) into the premultiplied-alpha atlas.
|
|
9
|
+
*
|
|
10
|
+
* @return {ShaderManager}
|
|
11
|
+
* @method
|
|
12
|
+
* @protected
|
|
13
|
+
*/
|
|
14
|
+
export declare const execute: () => ShaderManager;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TEXTURE_PREMULTIPLY } from "../../../Fragment/FragmentShaderSourceTexture";
|
|
2
|
+
import { ShaderManager } from "../../../ShaderManager";
|
|
3
|
+
import { BLEND_TEMPLATE } from "../../../Vertex/VertexShaderSource";
|
|
4
|
+
import { $collection } from "../../BlendVariants";
|
|
5
|
+
/**
|
|
6
|
+
* @description ストレートアルファのテクスチャをプリマルチプライドアルファへ変換して描画する
|
|
7
|
+
* シェーダーを生成して返却。画像(Bitmap)・TextField・Video など、ストレート
|
|
8
|
+
* アルファのソースをプリマルチプライ空間のアトラスへ合成する用途で使用する。
|
|
9
|
+
* Generate and return the shader that converts a straight-alpha texture into
|
|
10
|
+
* premultiplied alpha. Used for compositing straight-alpha sources (Bitmap
|
|
11
|
+
* image, TextField, Video) into the premultiplied-alpha atlas.
|
|
12
|
+
*
|
|
13
|
+
* @return {ShaderManager}
|
|
14
|
+
* @method
|
|
15
|
+
* @protected
|
|
16
|
+
*/
|
|
17
|
+
export const execute = () => {
|
|
18
|
+
const key = "pp";
|
|
19
|
+
if ($collection.has(key)) {
|
|
20
|
+
return $collection.get(key);
|
|
21
|
+
}
|
|
22
|
+
const shaderManager = new ShaderManager(BLEND_TEMPLATE(), TEXTURE_PREMULTIPLY());
|
|
23
|
+
$collection.set(key, shaderManager);
|
|
24
|
+
return shaderManager;
|
|
25
|
+
};
|