mxdraw 0.1.12 → 0.1.13
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/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +1 -128
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +1 -5
- package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +1 -2
- package/dist/lib/MxModule/McGeVector3d/index.js +1 -3
- package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +1 -2
- package/dist/lib/MxModule/McGiWorldDraw/index.js +1 -2
- package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +1 -19
- package/dist/lib/MxModule/McGiWorldDrawType/index.js +1 -4
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +1 -31
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +1 -5
- package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +1 -150
- package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +1 -5
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +1 -213
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +1 -5
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +1 -241
- package/dist/lib/MxModule/MxDbEntity/index.js +1 -5
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +1 -160
- package/dist/lib/MxModule/MxDbImage/index.js +1 -5
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +1 -94
- package/dist/lib/MxModule/MxDbLine/index.js +1 -5
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +1 -273
- package/dist/lib/MxModule/MxDbRect/index.js +1 -4
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +1 -369
- package/dist/lib/MxModule/MxDbSVG/index.js +1 -5
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +1 -21
- package/dist/lib/MxModule/MxDbSVGText/index.js +1 -5
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +1 -754
- package/dist/lib/MxModule/MxDrawObject/index.js +1 -5
- package/dist/lib/MxModule/MxFilters/MxFilters.js +1 -201
- package/dist/lib/MxModule/MxFilters/index.js +1 -4
- package/dist/lib/MxModule/MxFun/MxFun.js +1 -630
- package/dist/lib/MxModule/MxFun/index.js +1 -9
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +1 -283
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -146
- package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +1 -1862
- package/dist/lib/MxModule/MxThreeJS/index.js +1 -7
- package/dist/lib/MxModule/MxType/MxType.js +1 -27
- package/dist/lib/MxModule/MxType/index.js +1 -4
- package/dist/lib/MxModule/Mxassembly/Mxassembly.js +1 -18
- package/dist/lib/MxModule/Mxassembly/index.js +1 -9
- package/dist/lib/MxModule/loadCoreCode/index.js +1 -5
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +1 -125
- package/dist/lib/MxModule/loadCoreCode/mxUiData.js +1 -317
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1 -1519
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -7361
- package/dist/lib/MxModule/store/PubsubClass.js +1 -40
- package/dist/lib/MxModule/store/StoreClass.js +1 -73
- package/dist/lib/MxModule/store/index.js +1 -16
- package/dist/lib/MxModule/store/store.js +1 -25
- package/dist/lib/MxModule/useCanvasResizeListener/index.js +1 -5
- package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +1 -95
- package/dist/lib/doc.js +1 -38
- package/dist/lib/mxdraw.js +1 -64
- package/dist/lib/tools/algorithm/math.js +1 -16
- package/dist/lib/tools/algorithm/random.js +1 -13
- package/dist/lib/tools/dom/create.js +1 -47
- package/dist/lib/tools/dynamicImport/index.js +1 -186
- package/dist/lib/tools/formatting/index.js +1 -20
- package/dist/lib/tools/proxy/index.js +1 -17
- package/dist/lib/tools/three/index.js +1 -124
- package/dist/lib/types/McEdGetPointWorldDrawObject.js +1 -2
- package/dist/lib/types/MrxDbgUiPrPoint.js +1 -2
- package/dist/lib/types/MxCADObject.js +1 -2
- package/dist/lib/types/MxDrawObject.js +1 -2
- package/dist/lib/types/MxFun.js +1 -2
- package/dist/lib/types/Mxassembly.js +1 -2
- package/dist/mxdraw.es5.js +1 -45
- package/dist/mxdraw.umd.js +1 -45
- package/dist/types/MxModule/MxFun/MxFun.d.ts +18 -1
- package/dist/types/MxModule/store/index.d.ts +2 -7
- package/dist/types/mxdraw.d.ts +1 -4
- package/package.json +6 -5
- package/dist/mxdraw.es5.js.map +0 -1
- package/dist/mxdraw.umd.js.map +0 -1
|
@@ -1,5 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @module MxDrawObject */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
var MxDrawObject_1 = require("./MxDrawObject");
|
|
5
|
-
exports.default = MxDrawObject_1.default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxDrawObject_1=require("./MxDrawObject");exports.default=MxDrawObject_1.default;
|
|
@@ -1,201 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
/** 简单颜色滤镜矩阵 */
|
|
15
|
-
var three_1 = require("three");
|
|
16
|
-
var MxFilters = /** @class */ (function () {
|
|
17
|
-
function MxFilters() {
|
|
18
|
-
this.uniformObj = {};
|
|
19
|
-
this.filtersStr = '';
|
|
20
|
-
this.filtersTypes = '';
|
|
21
|
-
//顶点着色器代码片段
|
|
22
|
-
this.VSHADER_SOURCE = "\n varying vec2 v_Uv; \n void main () {\n v_Uv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ";
|
|
23
|
-
//片元着色器代码片段
|
|
24
|
-
this.FSHADER_SOURCE = "\n varying vec2 v_Uv;\n uniform sampler2D e_Texture;\n uniform mat4 colorMatrix;\n ".concat(this.filtersStr, "\n void main () {\n vec4 color = texture2D( e_Texture, v_Uv );\n color = color * colorMatrix;\n ").concat(this.filtersTypes, "\n gl_FragColor = color;\n }");
|
|
25
|
-
this._matrix = new three_1.Matrix4();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* 过滤或增强某个颜色通道
|
|
29
|
-
* @param {ChannelParamTypes}
|
|
30
|
-
* */
|
|
31
|
-
MxFilters.prototype.channel = function (_a) {
|
|
32
|
-
var _b = _a.r, r = _b === void 0 ? 1 : _b, _c = _a.g, g = _c === void 0 ? 1 : _c, _d = _a.b, b = _d === void 0 ? 1 : _d;
|
|
33
|
-
this._matrix = new three_1.Matrix4()
|
|
34
|
-
.set(r, 0, 0, 0, 0, g, 0, 0, 0, 0, b, 0, 0, 0, 0, 1)
|
|
35
|
-
.multiply(this._matrix);
|
|
36
|
-
return this;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* 改变亮度
|
|
40
|
-
* @param {number} p
|
|
41
|
-
* p = 0 全暗,p > 0 且 p < 1 调暗,p = 1 原色, p > 1 调亮
|
|
42
|
-
* */
|
|
43
|
-
MxFilters.prototype.brightness = function (p) {
|
|
44
|
-
this._matrix = new three_1.Matrix4()
|
|
45
|
-
.set(p, 0, 0, 0, 0, p, 0, 0, 0, 0, p, 0, 0, 0, 0, 1)
|
|
46
|
-
.multiply(this._matrix);
|
|
47
|
-
return this;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* 饱和度
|
|
51
|
-
* @param {number} p
|
|
52
|
-
* p = 0 完全灰度化,p = 1 原色,p > 1 增强饱和度
|
|
53
|
-
* */
|
|
54
|
-
MxFilters.prototype.saturate = function (p) {
|
|
55
|
-
var r = 0.2126 * (1 - p);
|
|
56
|
-
var g = 0.7152 * (1 - p);
|
|
57
|
-
var b = 0.0722 * (1 - p);
|
|
58
|
-
this._matrix = new three_1.Matrix4()
|
|
59
|
-
.set(r + p, g, b, 0, r, g + p, b, 0, r, g, b + p, 0, 0, 0, 0, 1)
|
|
60
|
-
.multiply(this._matrix);
|
|
61
|
-
return this;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* 对比度
|
|
65
|
-
* @param {number} p
|
|
66
|
-
* p = 1 原色, p < 1 减弱对比度,p > 1 增强对比度
|
|
67
|
-
* */
|
|
68
|
-
MxFilters.prototype.contrast = function (p) {
|
|
69
|
-
var d = 0.5 * (1 - p);
|
|
70
|
-
this._matrix = new three_1.Matrix4()
|
|
71
|
-
.set(p, 0, 0, 0, 0, p, 0, 0, 0, 0, p, 0, d, d, d, 1)
|
|
72
|
-
.multiply(this._matrix);
|
|
73
|
-
return this;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* 透明度
|
|
77
|
-
* @param {number} p
|
|
78
|
-
* p = 0 全透明,p = 1 原色
|
|
79
|
-
* */
|
|
80
|
-
MxFilters.prototype.opacity = function (p) {
|
|
81
|
-
this._matrix = new three_1.Matrix4()
|
|
82
|
-
.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, p)
|
|
83
|
-
.multiply(this._matrix);
|
|
84
|
-
return this;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* 反色
|
|
88
|
-
* @param {number} p
|
|
89
|
-
* p = 0 原色, p = 1 完全反色
|
|
90
|
-
* */
|
|
91
|
-
MxFilters.prototype.invert = function (p) {
|
|
92
|
-
var d = 1 - 2 * p;
|
|
93
|
-
this._matrix = new three_1.Matrix4()
|
|
94
|
-
.set(d, 0, 0, 0, 0, d, 0, 0, 0, 0, d, 0, p, p, p, 1)
|
|
95
|
-
.multiply(this._matrix);
|
|
96
|
-
return this;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* 灰度
|
|
100
|
-
* @param {number} p 0~1
|
|
101
|
-
* */
|
|
102
|
-
MxFilters.prototype.grayscale = function (p) {
|
|
103
|
-
if (p === void 0) { p = 1; }
|
|
104
|
-
var r = 0.2126 * p;
|
|
105
|
-
var g = 0.7152 * p;
|
|
106
|
-
var b = 0.0722 * p;
|
|
107
|
-
this._matrix = new three_1.Matrix4()
|
|
108
|
-
.set(r + 1 - p, g, b, 0, r, g + 1 - p, b, 0, r, g, b + 1 - p, 0, 0, 0, 0, 1)
|
|
109
|
-
.multiply(this._matrix);
|
|
110
|
-
return this;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* 深褐色
|
|
114
|
-
* @param {number} p 0~1
|
|
115
|
-
* */
|
|
116
|
-
MxFilters.prototype.sepia = function (p) {
|
|
117
|
-
if (p === void 0) { p = 1; }
|
|
118
|
-
this._matrix = new three_1.Matrix4()
|
|
119
|
-
.set(1 - 0.607 * p, 0.769 * p, 0.189 * p, 0, 0.349 * p, 1 - 0.314 * p, 0.168 * p, 0, 0.272 * p, 0.534 * p, 1 - 0.869 * p, 0, 0, 0, 0, 1)
|
|
120
|
-
.multiply(this._matrix);
|
|
121
|
-
return this;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* 色相旋转,将色调沿极坐标转过deg角度
|
|
125
|
-
* @param {number} deg 0~360
|
|
126
|
-
* */
|
|
127
|
-
MxFilters.prototype.hueRotate = function (deg) {
|
|
128
|
-
var rotation = (deg / 180) * Math.PI;
|
|
129
|
-
var cos = Math.cos(rotation), sin = Math.sin(rotation), lumR = 0.2126, lumG = 0.7152, lumB = 0.0722;
|
|
130
|
-
this._matrix = new three_1.Matrix4()
|
|
131
|
-
.set(lumR + cos * (1 - lumR) + sin * -lumR, lumG + cos * -lumG + sin * -lumG, lumB + cos * -lumB + sin * (1 - lumB), 0, lumR + cos * -lumR + sin * 0.143, lumG + cos * (1 - lumG) + sin * 0.14, lumB + cos * -lumB + sin * -0.283, 0, lumR + cos * -lumR + sin * -(1 - lumR), lumG + cos * -lumG + sin * lumG, lumB + cos * (1 - lumB) + sin * lumB, 0, 0, 0, 0, 1)
|
|
132
|
-
.multiply(this._matrix);
|
|
133
|
-
return this;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* 色相旋转,将色调沿极坐标转过deg角度
|
|
137
|
-
* @param {number} deg 0~360
|
|
138
|
-
* */
|
|
139
|
-
/**
|
|
140
|
-
* 卷积
|
|
141
|
-
* @param {Matrix3} cKernel 3*3的矩阵
|
|
142
|
-
* @param {number} stStep 1 / 9
|
|
143
|
-
* @param {number} scaleFactor 521
|
|
144
|
-
* */
|
|
145
|
-
MxFilters.prototype.convolution = function (cKernel, stStep, scaleFactor) {
|
|
146
|
-
if (stStep === void 0) { stStep = 1 / 9; }
|
|
147
|
-
if (scaleFactor === void 0) { scaleFactor = 521; }
|
|
148
|
-
this.uniformObj = __assign(__assign({}, this.uniformObj), { cKernel: {
|
|
149
|
-
value: cKernel.toArray()
|
|
150
|
-
}, stStep: {
|
|
151
|
-
value: stStep
|
|
152
|
-
}, scaleFactor: {
|
|
153
|
-
value: scaleFactor
|
|
154
|
-
} });
|
|
155
|
-
if (this.filtersTypes.indexOf('convolutionTextureColor') < 0) {
|
|
156
|
-
this.filtersStr += "\n uniform float cKernel[9];\n uniform float stStep;\n uniform float scaleFactor;\n vec4 convolutionTextureColor(vec4 color) {\n vec2 offsets[9];\n offsets[0] = vec2(-1.0,-1.0);\n offsets[1] = vec2(0.0,-1.0);\n offsets[2] = vec2(1.0,-1.0);\n offsets[3] = vec2(-1.0,0.0);\n offsets[4] = vec2(0.0,0.0);\n offsets[5] = vec2(1.0,0.0);\n offsets[6] = vec2(-1.0,1.0);\n offsets[7] = vec2(0.0,1.0);\n offsets[8] = vec2(1.0,1.0);\n \n vec4 sum = color;\n for(int i = 0; i < 9; i++) {\n sum = sum + cKernel[i] * scaleFactor * texture2D(e_Texture, v_Uv + offsets[i] / stStep);\n };\n return sum;\n }";
|
|
157
|
-
this.filtersTypes += 'color = convolutionTextureColor(color);\n';
|
|
158
|
-
}
|
|
159
|
-
return this;
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* 重置所有滤镜效果
|
|
163
|
-
* */
|
|
164
|
-
MxFilters.prototype.reset = function () {
|
|
165
|
-
this.uniformObj = {};
|
|
166
|
-
this.filtersStr = '';
|
|
167
|
-
this.filtersTypes = '';
|
|
168
|
-
this._matrix = new three_1.Matrix4();
|
|
169
|
-
return this;
|
|
170
|
-
};
|
|
171
|
-
// 获取滤镜自定义着色器数据
|
|
172
|
-
MxFilters.prototype._getFilterShaderData = function (texture) {
|
|
173
|
-
return {
|
|
174
|
-
uniforms: __assign({ e_Texture: {
|
|
175
|
-
value: texture
|
|
176
|
-
}, colorMatrix: {
|
|
177
|
-
value: this._matrix
|
|
178
|
-
} }, this.uniformObj),
|
|
179
|
-
// 顶点着色器
|
|
180
|
-
vertexShader: this.VSHADER_SOURCE,
|
|
181
|
-
// 片元着色器
|
|
182
|
-
fragmentShader: this.FSHADER_SOURCE
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
// 获取转换后的颜色
|
|
186
|
-
MxFilters.prototype._getFilterColor = function (color, opacity) {
|
|
187
|
-
if (color === void 0) { color = '#000000'; }
|
|
188
|
-
if (opacity === void 0) { opacity = 1; }
|
|
189
|
-
color = new three_1.Color(color);
|
|
190
|
-
var r = color.r, g = color.g, b = color.b;
|
|
191
|
-
var arr = this._matrix.toArray();
|
|
192
|
-
var A = arr[12] * opacity + arr[13] * opacity + arr[14] * opacity + arr[15] * opacity + 0;
|
|
193
|
-
var R = arr[0] * r + arr[1] * r + arr[2] * r + arr[3] * opacity;
|
|
194
|
-
var G = arr[4] * g + arr[5] * g + arr[6] * g + arr[7] * opacity;
|
|
195
|
-
var B = arr[8] * b + arr[9] * b + arr[10] * b + arr[11] * opacity;
|
|
196
|
-
color.setRGB(R, G, B);
|
|
197
|
-
return color;
|
|
198
|
-
};
|
|
199
|
-
return MxFilters;
|
|
200
|
-
}());
|
|
201
|
-
exports.default = MxFilters;
|
|
1
|
+
"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),MxFilters=function(){function t(){this.uniformObj={},this.filtersStr="",this.filtersTypes="",this.VSHADER_SOURCE="\n varying vec2 v_Uv; \n void main () {\n v_Uv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n ",this.FSHADER_SOURCE="\n varying vec2 v_Uv;\n uniform sampler2D e_Texture;\n uniform mat4 colorMatrix;\n ".concat(this.filtersStr,"\n void main () {\n vec4 color = texture2D( e_Texture, v_Uv );\n color = color * colorMatrix;\n ").concat(this.filtersTypes,"\n gl_FragColor = color;\n }"),this._matrix=new three_1.Matrix4}return t.prototype.channel=function(t){var e=t.r,r=void 0===e?1:e,i=t.g,o=void 0===i?1:i,n=t.b,s=void 0===n?1:n;return this._matrix=(new three_1.Matrix4).set(r,0,0,0,0,o,0,0,0,0,s,0,0,0,0,1).multiply(this._matrix),this},t.prototype.brightness=function(t){return this._matrix=(new three_1.Matrix4).set(t,0,0,0,0,t,0,0,0,0,t,0,0,0,0,1).multiply(this._matrix),this},t.prototype.saturate=function(t){var e=.2126*(1-t),r=.7152*(1-t),i=.0722*(1-t);return this._matrix=(new three_1.Matrix4).set(e+t,r,i,0,e,r+t,i,0,e,r,i+t,0,0,0,0,1).multiply(this._matrix),this},t.prototype.contrast=function(t){var e=.5*(1-t);return this._matrix=(new three_1.Matrix4).set(t,0,0,0,0,t,0,0,0,0,t,0,e,e,e,1).multiply(this._matrix),this},t.prototype.opacity=function(t){return this._matrix=(new three_1.Matrix4).set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,t).multiply(this._matrix),this},t.prototype.invert=function(t){var e=1-2*t;return this._matrix=(new three_1.Matrix4).set(e,0,0,0,0,e,0,0,0,0,e,0,t,t,t,1).multiply(this._matrix),this},t.prototype.grayscale=function(t){void 0===t&&(t=1);var e=.2126*t,r=.7152*t,i=.0722*t;return this._matrix=(new three_1.Matrix4).set(e+1-t,r,i,0,e,r+1-t,i,0,e,r,i+1-t,0,0,0,0,1).multiply(this._matrix),this},t.prototype.sepia=function(t){return void 0===t&&(t=1),this._matrix=(new three_1.Matrix4).set(1-.607*t,.769*t,.189*t,0,.349*t,1-.314*t,.168*t,0,.272*t,.534*t,1-.869*t,0,0,0,0,1).multiply(this._matrix),this},t.prototype.hueRotate=function(t){var e=t/180*Math.PI,r=Math.cos(e),i=Math.sin(e);return this._matrix=(new three_1.Matrix4).set(.2126+.7874*r+-.2126*i,.7152+-.7152*r+-.7152*i,.0722+-.0722*r+.9278*i,0,.2126+-.2126*r+.143*i,.7152+r*(1-.7152)+.14*i,.0722+-.0722*r+-.283*i,0,.2126+-.2126*r+-.7874*i,.7152+-.7152*r+.7152*i,.0722+.9278*r+.0722*i,0,0,0,0,1).multiply(this._matrix),this},t.prototype.convolution=function(t,e,r){return void 0===e&&(e=1/9),void 0===r&&(r=521),this.uniformObj=__assign(__assign({},this.uniformObj),{cKernel:{value:t.toArray()},stStep:{value:e},scaleFactor:{value:r}}),this.filtersTypes.indexOf("convolutionTextureColor")<0&&(this.filtersStr+="\n uniform float cKernel[9];\n uniform float stStep;\n uniform float scaleFactor;\n vec4 convolutionTextureColor(vec4 color) {\n vec2 offsets[9];\n offsets[0] = vec2(-1.0,-1.0);\n offsets[1] = vec2(0.0,-1.0);\n offsets[2] = vec2(1.0,-1.0);\n offsets[3] = vec2(-1.0,0.0);\n offsets[4] = vec2(0.0,0.0);\n offsets[5] = vec2(1.0,0.0);\n offsets[6] = vec2(-1.0,1.0);\n offsets[7] = vec2(0.0,1.0);\n offsets[8] = vec2(1.0,1.0);\n \n vec4 sum = color;\n for(int i = 0; i < 9; i++) {\n sum = sum + cKernel[i] * scaleFactor * texture2D(e_Texture, v_Uv + offsets[i] / stStep);\n };\n return sum;\n }",this.filtersTypes+="color = convolutionTextureColor(color);\n"),this},t.prototype.reset=function(){return this.uniformObj={},this.filtersStr="",this.filtersTypes="",this._matrix=new three_1.Matrix4,this},t.prototype._getFilterShaderData=function(t){return{uniforms:__assign({e_Texture:{value:t},colorMatrix:{value:this._matrix}},this.uniformObj),vertexShader:this.VSHADER_SOURCE,fragmentShader:this.FSHADER_SOURCE}},t.prototype._getFilterColor=function(t,e){void 0===t&&(t="#000000"),void 0===e&&(e=1);var r=(t=new three_1.Color(t)).r,i=t.g,o=t.b,n=this._matrix.toArray(),s=(n[12],n[13],n[14],n[15],n[0]*r+n[1]*r+n[2]*r+n[3]*e),a=n[4]*i+n[5]*i+n[6]*i+n[7]*e,u=n[8]*o+n[9]*o+n[10]*o+n[11]*e;return t.setRGB(s,a,u),t},t}();exports.default=MxFilters;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var MxFilters_1 = require("./MxFilters");
|
|
4
|
-
exports.default = MxFilters_1.default;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxFilters_1=require("./MxFilters");exports.default=MxFilters_1.default;
|