diff --git a/README.md b/README.md index 8725294f..2f9ca439 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ This project is maintained by [RedCamel](mailto:webseon@gmail.com) ### Release Notes ### - [Releases](https://github.com/redcamel/RedGL2/releases) +- [Release Note V6.0](https://github.com/redcamel/RedGL2/releases/tag/Master_V6.0) - [Release Note V5.0](https://github.com/redcamel/RedGL2/releases/tag/Master_V5.0) - [Release Note V4.0](https://github.com/redcamel/RedGL2/releases/tag/Master_V4.0) - [Release Note V3.0](https://github.com/redcamel/RedGL2/releases/tag/Master_V3.0) diff --git a/example/baseTestUI.js b/example/baseTestUI.js index 629c384d..36a05fcb 100644 --- a/example/baseTestUI.js +++ b/example/baseTestUI.js @@ -1,8 +1,9 @@ /* - * RedGL - MIT License - * Copyright (c) 2018 - 2019 By RedCamel(webseon@gmail.com) - * https://github.com/redcamel/RedGL2/blob/dev/LICENSE - * Last modification time of this file - 2019.7.5 11:56 + * RedGL - MIT License + * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com ) + * https://github.com/redcamel/RedGL2/blob/dev/LICENSE + * Last modification time of this file - 2019.8.7 11:52:14 + * */ var baseTestUI = function (redGL, width) { @@ -252,6 +253,22 @@ baseTestUI.exampleList = [ { key: 'object3D pivotTest', href: 'object3D/pivotTest.html' + }, + { + key: 'object3D pivotTest 2D Mode', + href: 'object3D/pivotTest_2dMode.html' + }, + { + key: 'object3D outline(2D mode)', + href: 'object3D/object3D_outline.html' + }, + { + key: 'object3D outline(3D mode)', + href: 'object3D/object3D_outline_3dMode.html' + }, + { + key: 'object3D outline skin', + href: 'object3D/object3D_outline_skin.html' } ] }, @@ -320,6 +337,28 @@ baseTestUI.exampleList = [ } ] }, + { + key: 'Mesh Filter', + list: [ + { + key: 'filterTest(2D Mode)', + href: 'filter/filterTest_2dMode.html' + }, + { + key: 'filterTest(3D Mode)', + href: 'filter/filterTest_3dMode.html' + }, + { + key: 'filters', + href: 'filter/RedFilters.html' + }, + { + key: 'Mesh filter + PostEffect', + href: 'filter/filterWithPostEffect.html' + } + + ] + }, { key: 'Texture', list: [ diff --git a/example/filter/RedFilters.html b/example/filter/RedFilters.html new file mode 100644 index 00000000..a6aea041 --- /dev/null +++ b/example/filter/RedFilters.html @@ -0,0 +1,203 @@ + + + + + +
+ + +
+ [
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['NORMAL'] = [
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.SHARPEN`,
+ code : 'CONST',
+ description : `
+
+ [
+ 0, -1, 0,
+ -1, 5, -1,
+ 0, -1, 0
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['SHARPEN'] = [
+ 0, -1, 0,
+ -1, 5, -1,
+ 0, -1, 0
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.BLUR`,
+ code : 'CONST',
+ description : `
+
+ [
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['BLUR'] = [
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.EDGE`,
+ code : 'CONST',
+ description : `
+
+ [
+ 0, 1, 0,
+ 1, -4, 1,
+ 0, 1, 0
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['EDGE'] = [
+ 0, 1, 0,
+ 1, -4, 1,
+ 0, 1, 0
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.EMBOSS`,
+ code : 'CONST',
+ description : `
+
+ [
+ -2, -1, 0,
+ -1, 1, 1,
+ 0, 1, 2
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['EMBOSS'] = [
+ -2, -1, 0,
+ -1, 1, 1,
+ 0, 1, 2
+ ];
+ Object.freeze(RedFilter_Convolution);
+})();
/*
* RedGL - MIT License
* Copyright (c) 2018 - 2019 By RedCamel(webseon@gmail.com)
@@ -27379,4 +30446,4 @@ var RedGLOffScreen;
};
RedWorkerCode = RedWorkerCode.toString().replace(/^function ?. ?\) ?\{|\}\;?$/g, '');
})();
-})();var RedGL_VERSION = {version : 'RedGL Release. last update( 2019-07-09 12:27:18)' };console.log(RedGL_VERSION);
\ No newline at end of file
+})();var RedGL_VERSION = {version : 'RedGL Release. last update( 2019-08-07 11:46:16)' };console.log(RedGL_VERSION);
\ No newline at end of file
diff --git a/release/RedGL.min.js b/release/RedGL.min.js
index 734e7e64..549ff927 100644
--- a/release/RedGL.min.js
+++ b/release/RedGL.min.js
@@ -2,11 +2,11 @@
* RedGL - MIT License
* Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
* https://github.com/redcamel/RedGL2/blob/dev/LICENSE
- * Last modification time of this file - 2019.7.9 12:29:10
+ * Last modification time of this file - 2019.8.7 11:52:14
*
*/
-var RedDefinePropertyInfo,RedGLDetect,RedGLUtil,RedGL,RedBoxSelection,RedBaseController,RedImageLoader,RedBaseTexture,RedBaseObject3D,RedBaseContainer,RedBaseLight,RedFrameBuffer,RedBuffer,RedGeometry,RedInterleaveInfo,RedBaseMaterial,RedTextureOptionChecker,RedBitmapTexture,RedVideoTexture,RedDDSTexture,RedBitmapCubeTexture,RedColorMaterial,RedColorPhongMaterial,RedColorPhongTextureMaterial,RedEnvironmentMaterial,RedBitmapMaterial,RedParticleMaterial,RedBitmapPointCloudMaterial,RedSheetMaterial,RedStandardMaterial,RedVideoMaterial,RedPBRMaterial,RedColorPointCloudMaterial,RedPBRMaterial_System,RedTextMaterial,RedAmbientLight,RedDirectionalLight,RedPointLight,RedMTLLoader,RedOBJLoader,Red3DSLoader,RedDAELoader,RedGLTFLoader,RedLinePoint,RedLathe,RedAxis,RedGrid,RedMesh,RedLine,RedLatheMesh,RedSkyBox,RedSprite3D,RedTransformController,RedPointCloud,RedParticleUnit,RedColorPointCloud,RedBitmapPointCloud,RedParticleEmitter,RedBox,RedCylinder,RedPlane,RedSphere,RedProgram,RedSystemShaderCode,RedShader,RedRenderer,RedRenderDebuger,RedSystemUniformUpdater,RedView,RedWorld,RedScene,RedCamera,RedBasicController,RedObitController,RedGridMaterial,RedSkyBoxMaterial,RedDirectionalShadowMaterial,RedPostEffectMaterial,RedDirectionalShadow,RedShadowManager,RedText,RedMouseEventManager,RedMouseEventMaterial,RedPostEffectManager,RedBasePostEffect,RedPostEffect_Bloom,RedPostEffect_BloomThreshold,RedPostEffect_Blur,RedPostEffect_BlurX,RedPostEffect_BlurY,RedPostEffect_GaussianBlur,RedPostEffect_ZoomBlur,RedPostEffect_BrightnessContrast,RedPostEffect_Threshold,RedPostEffect_Invert,RedPostEffect_Gray,RedPostEffect_HueSaturation,RedPostEffect_HalfTone,RedPostEffect_Pixelize,RedPostEffect_Convolution,RedPostEffect_DoF,RedPostEffect_DoF_DepthMaterial,RedPostEffect_Film,RedPostEffect_Vignetting,RedPostEffect_FXAA,RedGLOffScreen;!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setMatrixArrayType=function(e){t.ARRAY_TYPE=e},t.toRadian=function(e){return e*n},t.equals=function(e,t){return Math.abs(e-t)<=i*Math.max(1,Math.abs(e),Math.abs(t))};var i=t.EPSILON=1e-6,n=(t.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,t.RANDOM=Math.random,Math.PI/180)},function(e,t,r){"use strict";function i(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],d=t[5],u=t[6],c=t[7],l=t[8],f=r[0],h=r[1],R=r[2],m=r[3],p=r[4],_=r[5],g=r[6],v=r[7],E=r[8];return e[0]=f*i+h*o+R*u,e[1]=f*n+h*s+R*c,e[2]=f*a+h*d+R*l,e[3]=m*i+p*o+_*u,e[4]=m*n+p*s+_*c,e[5]=m*a+p*d+_*l,e[6]=g*i+v*o+E*u,e[7]=g*n+v*s+E*c,e[8]=g*a+v*d+E*l,e}function n(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}Object.defineProperty(t,"__esModule",{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new a.ARRAY_TYPE(9);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},t.clone=function(e){var t=new a.ARRAY_TYPE(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},t.fromValues=function(e,t,r,i,n,o,s,d,u){var c=new a.ARRAY_TYPE(9);return c[0]=e,c[1]=t,c[2]=r,c[3]=i,c[4]=n,c[5]=o,c[6]=s,c[7]=d,c[8]=u,c},t.set=function(e,t,r,i,n,a,o,s,d,u){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=a,e[5]=o,e[6]=s,e[7]=d,e[8]=u,e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.transpose=function(e,t){if(e===t){var r=t[1],i=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},t.invert=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],d=t[6],u=t[7],c=t[8],l=c*o-s*u,f=-c*a+s*d,h=u*a-o*d,R=r*l+i*f+n*h;return R?(R=1/R,e[0]=l*R,e[1]=(-c*i+n*u)*R,e[2]=(s*i-n*o)*R,e[3]=f*R,e[4]=(c*r-n*d)*R,e[5]=(-s*r+n*a)*R,e[6]=h*R,e[7]=(-u*r+i*d)*R,e[8]=(o*r-i*a)*R,e):null},t.adjoint=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],d=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=n*u-i*c,e[2]=i*s-n*o,e[3]=s*d-a*c,e[4]=r*c-n*d,e[5]=n*a-r*s,e[6]=a*u-o*d,e[7]=i*d-r*u,e[8]=r*o-i*a,e},t.determinant=function(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],d=e[7],u=e[8];return t*(u*a-o*d)+r*(-u*n+o*s)+i*(d*n-a*s)},t.multiply=i,t.translate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],d=t[5],u=t[6],c=t[7],l=t[8],f=r[0],h=r[1];return e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=d,e[6]=f*i+h*o+u,e[7]=f*n+h*s+c,e[8]=f*a+h*d+l,e},t.rotate=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],d=t[5],u=t[6],c=t[7],l=t[8],f=Math.sin(r),h=Math.cos(r);return e[0]=h*i+f*o,e[1]=h*n+f*s,e[2]=h*a+f*d,e[3]=h*o-f*i,e[4]=h*s-f*n,e[5]=h*d-f*a,e[6]=u,e[7]=c,e[8]=l,e},t.scale=function(e,t,r){var i=r[0],n=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},t.fromRotation=function(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},t.fromQuat=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,d=n+n,u=r*o,c=i*o,l=i*s,f=n*o,h=n*s,R=n*d,m=a*o,p=a*s,_=a*d;return e[0]=1-l-R,e[3]=c-_,e[6]=f+p,e[1]=c+_,e[4]=1-u-R,e[7]=h-m,e[2]=f-p,e[5]=h+m,e[8]=1-u-l,e},t.normalFromMat4=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],d=t[6],u=t[7],c=t[8],l=t[9],f=t[10],h=t[11],R=t[12],m=t[13],p=t[14],_=t[15],g=r*s-i*o,v=r*d-n*o,E=r*u-a*o,M=i*d-n*s,b=i*u-a*s,L=n*u-a*d,P=c*m-l*R,T=c*p-f*R,y=c*_-h*R,x=l*p-f*m,w=l*_-h*m,I=f*_-h*p,U=g*I-v*w+E*x+M*y-b*T+L*P;return U?(U=1/U,e[0]=(s*I-d*w+u*x)*U,e[1]=(d*y-o*I-u*T)*U,e[2]=(o*w-s*y+u*P)*U,e[3]=(n*w-i*I-a*x)*U,e[4]=(r*I-n*y+a*T)*U,e[5]=(i*y-r*w-a*P)*U,e[6]=(m*L-p*b+_*M)*U,e[7]=(p*E-R*L-_*v)*U,e[8]=(R*b-m*E+_*g)*U,e):null},t.projection=function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},t.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},t.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2))},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},t.subtract=n,t.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},t.multiplyScalarAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},t.equals=function(e,t){var r=e[0],i=e[1],n=e[2],o=e[3],s=e[4],d=e[5],u=e[6],c=e[7],l=e[8],f=t[0],h=t[1],R=t[2],m=t[3],p=t[4],_=t[5],g=t[6],v=t[7],E=t[8];return Math.abs(r-f)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(i-h)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-R)<=a.EPSILON*Math.max(1,Math.abs(n),Math.abs(R))&&Math.abs(o-m)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(s-p)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(d-_)<=a.EPSILON*Math.max(1,Math.abs(d),Math.abs(_))&&Math.abs(u-g)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-v)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(v))&&Math.abs(l-E)<=a.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))};var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.mul=i,t.sub=n},function(e,t,r){"use strict";function i(){var e=new R.ARRAY_TYPE(3);return e[0]=0,e[1]=0,e[2]=0,e}function n(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function a(e,t,r){var i=new R.ARRAY_TYPE(3);return i[0]=e,i[1]=t,i[2]=r,i}function o(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function s(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function d(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function u(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(r*r+i*i+n*n)}function c(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n}function l(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function f(e,t){var r=t[0],i=t[1],n=t[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function h(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}Object.defineProperty(t,"__esModule",{value:!0}),t.forEach=t.sqrLen=t.len=t.sqrDist=t.dist=t.div=t.mul=t.sub=void 0,t.create=i,t.clone=function(e){var t=new R.ARRAY_TYPE(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},t.length=n,t.fromValues=a,t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.set=function(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e},t.subtract=o,t.multiply=s,t.divide=d,t.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},t.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},t.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},t.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},t.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},t.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e},t.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e},t.distance=u,t.squaredDistance=c,t.squaredLength=l,t.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},t.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},t.normalize=f,t.dot=h,t.cross=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],d=r[2];return e[0]=n*d-a*s,e[1]=a*o-i*d,e[2]=i*s-n*o,e},t.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e},t.hermite=function(e,t,r,i,n,a){var o=a*a,s=o*(2*a-3)+1,d=o*(a-2)+a,u=o*(a-1),c=o*(3-2*a);return e[0]=t[0]*s+r[0]*d+i[0]*u+n[0]*c,e[1]=t[1]*s+r[1]*d+i[1]*u+n[1]*c,e[2]=t[2]*s+r[2]*d+i[2]*u+n[2]*c,e},t.bezier=function(e,t,r,i,n,a){var o=1-a,s=o*o,d=a*a,u=s*o,c=3*a*s,l=3*d*o,f=d*a;return e[0]=t[0]*u+r[0]*c+i[0]*l+n[0]*f,e[1]=t[1]*u+r[1]*c+i[1]*l+n[1]*f,e[2]=t[2]*u+r[2]*c+i[2]*l+n[2]*f,e},t.random=function(e,t){t=t||1;var r=2*R.RANDOM()*Math.PI,i=2*R.RANDOM()-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e},t.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e},t.transformMat3=function(e,t,r){var i=t[0],n=t[1],a=t[2];return e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8],e},t.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],d=r[2],u=r[3],c=u*i+s*a-d*n,l=u*n+d*i-o*a,f=u*a+o*n-s*i,h=-o*i-s*n-d*a;return e[0]=c*u+h*-o+l*-d-f*-s,e[1]=l*u+h*-s+f*-o-c*-d,e[2]=f*u+h*-d+c*-s-l*-o,e},t.rotateX=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},t.rotateY=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},t.rotateZ=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},t.angle=function(e,t){var r=a(e[0],e[1],e[2]),i=a(t[0],t[1],t[2]);f(r,r),f(i,i);var n=h(r,i);return n>1?0:n<-1?Math.PI:Math.acos(n)},t.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.equals=function(e,t){var r=e[0],i=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=R.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-o)<=R.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-s)<=R.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))};var R=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.sub=o,t.mul=s,t.div=d,t.dist=u,t.sqrDist=c,t.len=n,t.sqrLen=l,t.forEach=function(){var e=i();return function(t,r,i,n,a,o){var s,d=void 0;for(r||(r=3),i||(i=0),s=n?Math.min(n*r+i,t.length):t.length,d=i;d
lumaMax)) finalColor = vec4(rgbA, 1.0);
else finalColor = vec4(rgbB, 1.0);
gl_FragColor = finalColor;
}
-*/},(RedPostEffect_FXAA=function(i){if(!(this instanceof RedPostEffect_FXAA))return new RedPostEffect_FXAA(i);i instanceof RedGL||RedGLUtil.throwFunc("RedPostEffect_FXAA : RedGL Instance만 허용.",i),this.frameBuffer=RedFrameBuffer(i),this.diffuseTexture=null,this.program=RedProgram.makeProgram(i,"RedPostEffectFXAAProgram",e,t),this._UUID=RedGL.makeUUID(),r||(this.checkUniformAndProperty(),r=!0)}).prototype=new RedBasePostEffect,RedPostEffect_FXAA.prototype.updateTexture=function(e){this.diffuseTexture=e},RedDefinePropertyInfo.definePrototype("RedPostEffect_FXAA","diffuseTexture","sampler2D"),Object.freeze(RedPostEffect_FXAA)}(),function(){var e,t,r,i,n,a;(RedGLOffScreen=function(e,t,r,i,n){if(!(this instanceof RedGLOffScreen))return new RedGLOffScreen(e,t,r,i,n);RedGLDetect.getBrowserInfo();var a=this;a.htmlCanvas=e,a.redGLSrc=i,fetch(n).then(function(e){e.text().then(function(e){a.hostCode="\ncanvas.tagName = 'CANVAS';\nreturn RedGL(canvas, function (v) {\nvar _host_ = "+e+";\n_host_.call(this);\n\n});",a.setSize(t,r)})}).catch(function(e){})}).prototype.updatePostMessage=function(e){if(!e)throw"RedGLOffScreen.prototype['updatePostMessage'] - run을 정의해야합니다."+e;if(!e.name)throw"RedGLOffScreen.prototype['updatePostMessage'] - run객체의 name을 정의해야합니다."+e.name;this.worker.postMessage({state:"update",run:e})},RedGLOffScreen.prototype._init=function(r,i,n){var a=this;this.worker&&this.worker.terminate();var o=this.htmlCanvas.parentNode,s=r.cloneNode(!0);o.replaceChild(s,this.htmlCanvas),this.htmlCanvas=s;var d="x,y,clientX,clientY,pageX,pageY,screenX,screenY,layerX,layerY,detail,shiftKey,altKey,ctrlKey,movementX,movementY,button,type,which,deltaX,deltaY,deltaZ,timeStamp,targetTouches".split(","),u="shiftKey,altKey,ctrlKey,key,keyCode,location,code,charCode,detail,timeStamp,which,type".split(","),c=[RedGLDetect.BROWSER_INFO.move,RedGLDetect.BROWSER_INFO.down,RedGLDetect.BROWSER_INFO.up],l="keydown,keyup,keypress".split(",");c.forEach(function(e){a.htmlCanvas.addEventListener(e,function(e){var t={};d.forEach(function(r){if("targetTouches"==r&&e[r]){for(var i=[],n=e[r].length;n--;){var a=e[r][n];i.push({clientX:a.clientX,clientY:a.clientY,force:a.force,identifier:a.identifier,pageX:a.pageX,pageY:a.pageY,radiusX:a.radiusX,radiusY:a.radiusY,rotationAngle:a.rotationAngle,screenX:a.screenX,screenY:a.screenY})}t[r]=i}else t[r]=e[r]}),a.worker.postMessage({state:e.type,event:t})})}),l.forEach(function(e){window.addEventListener(e,function(e){var t={};u.forEach(function(r){t[r]=e[r]}),a.worker.postMessage({state:e.type,event:t})})}),this.offScreenCanvas=this.htmlCanvas.transferControlToOffscreen(),this.offScreenCanvas.width=i,this.offScreenCanvas.height=n,this.worker=null,t=new Blob([e],{type:"application/javascript"}),this.worker=new Worker(URL.createObjectURL(t));var f=document.location.pathname.split("/");f[f.length-1].indexOf(".")>-1&&f.pop();var h=this.redGLSrc.split("/");h.forEach(function(e,t){".."===e&&(f.pop(),h[t]=""),"."===e&&(h[t]="")}),this.worker.postMessage({canvas:this.offScreenCanvas,state:"init",redGLSrc:document.location.origin+f.join("/")+"/"+h.join("/"),hostCode:this.hostCode.toString()},[this.offScreenCanvas])},RedGLOffScreen.prototype.setSize=(n=0,a=0,function(e,t,o){void 0===e&&RedGLUtil.throwFunc("RedGL setSize : width가 입력되지 않았습니다."),void 0===t&&RedGLUtil.throwFunc("RedGL setSize : height가 입력되지 않았습니다."),r=this._width=e,i=this._height=t,"number"!=typeof r&&(r.indexOf("%")>-1?r=(document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)*parseFloat(r)/100:RedGLUtil.throwFunc("RedGL setSize : width는 0이상의 숫자나 %만 허용.",r)),"number"!=typeof i&&(i.indexOf("%")>-1?i=window.innerHeight*parseFloat(i)/100:RedGLUtil.throwFunc("RedGL setSize : height는 0이상의 숫자나 %만 허용.",i)),window.devicePixelRatio,this._canvas,(n!==r||a!==i||o)&&(n=r,a=i),r=parseInt(r),i=parseInt(i),this._init(this.htmlCanvas,r,i)}),e=(e=function(){var e,t;this.window=this,onmessage=function(r){switch(r.data.state){case"init":e||(importScripts(r.data.redGLSrc),e=new Function("canvas",r.data.hostCode)),t=new e(r.data.canvas);break;case"update":var i=r.data.run.args;t.userInterface[r.data.run.name]["array"==typeof i?"apply":"call"](t,r.data.run.args);break;case RedGLDetect.BROWSER_INFO.move:var n=new Event(RedGLDetect.BROWSER_INFO.move),a=r.data.event;for(var o in a)n[o]=a[o];t._canvas.dispatchEvent(n);break;case RedGLDetect.BROWSER_INFO.down:for(var o in n=new Event(RedGLDetect.BROWSER_INFO.down),a=r.data.event)n[o]=a[o];t._canvas.dispatchEvent(n);break;case RedGLDetect.BROWSER_INFO.up:for(var o in n=new Event(RedGLDetect.BROWSER_INFO.up),a=r.data.event)n[o]=a[o];this.window.dispatchEvent(n);break;case"wheel":for(var o in n=new Event("wheel"),a=r.data.event)n[o]=a[o];t._canvas.dispatchEvent(n);break;case"keydown":for(var o in n=new Event("keydown"),a=r.data.event)n[o]=a[o];this.window.dispatchEvent(n);break;case"keyup":for(var o in n=new Event("keyup"),a=r.data.event)n[o]=a[o];this.window.dispatchEvent(n);break;case"keypress":for(var o in n=new Event("keypress"),a=r.data.event)n[o]=a[o];this.window.dispatchEvent(n)}}}).toString().replace(/^function ?. ?\) ?\{|\}\;?$/g,"")}();var RedGL_VERSION={version:"RedGL Release. last update( 2019-07-09 12:27:18)"};
\ No newline at end of file
+*/},(RedPostEffect_FXAA=function(i){if(!(this instanceof RedPostEffect_FXAA))return new RedPostEffect_FXAA(i);i instanceof RedGL||RedGLUtil.throwFunc("RedPostEffect_FXAA : RedGL Instance만 허용.",i),this.frameBuffer=RedFrameBuffer(i),this.diffuseTexture=null,this.program=RedProgram.makeProgram(i,"RedPostEffectFXAAProgram",e,t),this._UUID=RedGL.makeUUID(),r||(this.checkUniformAndProperty(),r=!0)}).prototype=new RedBasePostEffect,RedPostEffect_FXAA.prototype.updateTexture=function(e){this.diffuseTexture=e},RedDefinePropertyInfo.definePrototype("RedPostEffect_FXAA","diffuseTexture","sampler2D"),Object.freeze(RedPostEffect_FXAA)}(),(RedFilterFrameBuffer=function(e,t,r){if(!(this instanceof RedFilterFrameBuffer))return new RedFilterFrameBuffer(e,t,r);var i;e instanceof RedGL||RedGLUtil.throwFunc("RedFilterFrameBuffer : RedGL Instance만 허용.",e),t&&("number"==typeof t||RedGLUtil.throwFunc("RedFilterFrameBuffer : width - 숫자만 허용","입력값 : ",t)),r&&("number"==typeof r||RedGLUtil.throwFunc("RedFilterFrameBuffer : height - 숫자만 허용","입력값 : ",r)),i=e.gl,r=r||1080,(t=t||1920)>e.detect.texture.MAX_TEXTURE_SIZE&&(t=e.detect.texture.MAX_TEXTURE_SIZE),r>e.detect.texture.MAX_TEXTURE_SIZE&&(r=e.detect.texture.MAX_TEXTURE_SIZE),this.redGL=e,this.width=t,this.height=r,this._prevWidth=null,this._prevHeight=null,this.webglFrameBuffer=i.createFramebuffer(),this.webglRenderBuffer=i.createRenderbuffer(),this.texture=RedBitmapTexture(e),this._UUID=RedGL.makeUUID(),i.bindFramebuffer(i.FRAMEBUFFER,this.webglFrameBuffer),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.texture.webglTexture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,this.texture.webglTexture,0),i.bindTexture(i.TEXTURE_2D,null),i.bindFramebuffer(i.FRAMEBUFFER,null)}).prototype={bind:function(e){e.bindFramebuffer(e.FRAMEBUFFER,this.webglFrameBuffer),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,this.texture.webglTexture),this._prevWidth!=this.width||this._prevHeight!=this.height?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,parseInt(this.width),parseInt(this.height),0,e.RGBA,e.UNSIGNED_BYTE,null):e.clear(e.COLOR_BUFFER_BIT),this._prevWidth=this.width,this._prevHeight=this.height},unbind:function(e){e.bindFramebuffer(e.FRAMEBUFFER,null)}},RedDefinePropertyInfo.definePrototypes("RedFilterFrameBuffer",["width","number",{min:2}],["height","number",{min:2}]),Object.freeze(RedFilterFrameBuffer),function(){var e,t,r,i,n,a,o;(RedFilterEffectManager=function(e){if(!(this instanceof RedFilterEffectManager))return new RedFilterEffectManager(e);e instanceof RedGL||RedGLUtil.throwFunc("RedFilterEffectManager : RedGL Instance만 허용.",e),Object.defineProperty(this,"frameBuffer",{value:RedFilterFrameBuffer(e)}),Object.defineProperty(this,"finalMaterial",{value:RedFilterMaterial(e,this.frameBuffer.texture)}),this.filterList=[];var t=RedMesh(e,RedPlane(e,1,1,1,1,!0),this.finalMaterial);t.useCullFace=!1,Object.defineProperty(this,"children",{value:[t]}),this._UUID=RedGL.makeUUID()}).prototype={bind:function(e){this.frameBuffer.bind(e)},unbind:function(e){this.frameBuffer.unbind(e)},render:(o=[],n=function(r,o,s,d,l,u,c,f,h,R,m){var p,_,g,v,E,M,b,L,T,P,x,y,w=[];if(b=r.gl,P=d.scene,x=d._viewRect,o._process&&o._process.length)for(M=i,L=0,T=o._process.length;L
+ [
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['NORMAL'] = [
+ 0, 0, 0,
+ 0, 1, 0,
+ 0, 0, 0
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.SHARPEN`,
+ code : 'CONST',
+ description : `
+
+ [
+ 0, -1, 0,
+ -1, 5, -1,
+ 0, -1, 0
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['SHARPEN'] = [
+ 0, -1, 0,
+ -1, 5, -1,
+ 0, -1, 0
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.BLUR`,
+ code : 'CONST',
+ description : `
+
+ [
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['BLUR'] = [
+ 1, 1, 1,
+ 1, 1, 1,
+ 1, 1, 1
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.EDGE`,
+ code : 'CONST',
+ description : `
+
+ [
+ 0, 1, 0,
+ 1, -4, 1,
+ 0, 1, 0
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['EDGE'] = [
+ 0, 1, 0,
+ 1, -4, 1,
+ 0, 1, 0
+ ];
+ /*DOC:
+ {
+ title :`RedFilter_Convolution.EMBOSS`,
+ code : 'CONST',
+ description : `
+
+ [
+ -2, -1, 0,
+ -1, 1, 1,
+ 0, 1, 2
+ ]
+
+ `,
+ return : 'Array'
+ }
+ :DOC*/
+ RedFilter_Convolution['EMBOSS'] = [
+ -2, -1, 0,
+ -1, 1, 1,
+ 0, 1, 2
+ ];
+ Object.freeze(RedFilter_Convolution);
+})();
\ No newline at end of file
diff --git a/src/filter/RedFilter_Film.js b/src/filter/RedFilter_Film.js
new file mode 100644
index 00000000..8e9da897
--- /dev/null
+++ b/src/filter/RedFilter_Film.js
@@ -0,0 +1,158 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.2 18:16:21
+ *
+ */
+
+"use strict";
+var RedFilter_Film;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterFilmProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform bool u_grayMode;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_noiseIntensity; // noise effect intensity value (0 = no effect, 1 = full effect)
+ uniform float u_scanlineIntensity; // scanlines effect intensity value (0 = no effect, 1 = full effect)
+ uniform float u_scanlineCount; // scanlines effect count value (0 = no effect, 4096 = full effect)
+
+ void main() {
+ // sample the source
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+ vec4 diffuseColor = texture2D( u_diffuseTexture, testCoord );
+
+ // make some noise
+ float x = testCoord.x * testCoord.y * vTime;
+ x = mod( x, 13.0 ) * mod( x, 123.0 );
+ float dx = mod( x, 0.01 );
+
+ // add noise
+ vec3 finalColor = diffuseColor.rgb + diffuseColor.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );
+
+ // get us a sine and cosine
+ vec2 sc = vec2( sin( testCoord.y * u_scanlineCount ), cos( testCoord.y * u_scanlineCount ) );
+
+ // add scanlines
+ finalColor += diffuseColor.rgb * vec3( sc.x, sc.y, sc.x ) * u_scanlineIntensity;
+
+ // interpolate between source and result by intensity
+ finalColor = diffuseColor.rgb + clamp( u_noiseIntensity, 0.0, 1.0 ) * ( finalColor - diffuseColor.rgb );
+
+ // convert to grayscale if desired
+ if( u_grayMode ) finalColor = vec3( finalColor.r * 0.3 + finalColor.g * 0.59 + finalColor.b * 0.11 );
+ gl_FragColor = vec4( finalColor, diffuseColor.a );
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Film`,
+ description : `
+ Film 이펙트
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/RedFilter_Film.html',
+ example : `
+ var effect;
+ effect = RedFilter_Film(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Film Instance'
+ }
+ :DOC*/
+ RedFilter_Film = function (redGL) {
+ if (!(this instanceof RedFilter_Film)) return new RedFilter_Film(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Film : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['grayMode'] = false;
+ this['scanlineIntensity'] = 0.5;
+ this['noiseIntensity'] = 0.5;
+ this['scanlineCount'] = 2048;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Film.prototype = new RedBaseFilter();
+ RedFilter_Film.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_Film',
+ [ 'diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`grayMode`,
+ description : `
+ 그레이모드
+ 기본값 : false
+ `,
+ return : 'Boolean'
+ }
+ :DOC*/
+ [ 'grayMode', 'boolean'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`scanlineIntensity`,
+ description : `
+ 스캔라인강도
+ 기본값 : 0.5
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ [ 'scanlineIntensity', 'number', {'min': 0}],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`noiseIntensity`,
+ description : `
+ 노이즈강도
+ 기본값 : 0.5
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ [ 'noiseIntensity', 'number', {'min': 0}],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`scanlineCount`,
+ description : `
+ 스캔라인 수
+ 기본값 : 2048
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ [ 'scanlineCount', 'number', {'min': 0}]
+ );
+ Object.freeze(RedFilter_Film);
+})();
\ No newline at end of file
diff --git a/src/filter/adjustments/RedFilter_BrightnessContrast.js b/src/filter/adjustments/RedFilter_BrightnessContrast.js
new file mode 100644
index 00000000..8b9e1473
--- /dev/null
+++ b/src/filter/adjustments/RedFilter_BrightnessContrast.js
@@ -0,0 +1,120 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.7 11:21:57
+ *
+ */
+
+"use strict";
+var RedFilter_BrightnessContrast;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterBrightnessContrastProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision mediump float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_brightness_value;
+ uniform float u_contrast_value;
+ void main(void) {
+ vec4 finalColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution );
+ if (u_contrast_value > 0.0) finalColor.rgb = (finalColor.rgb - 0.5) / (1.0 - u_contrast_value) + 0.5;
+ else finalColor.rgb = (finalColor.rgb - 0.5) * (1.0 + u_contrast_value) + 0.5;
+ finalColor.rgb += u_brightness_value;
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_BrightnessContrast`,
+ description : `
+ BrightnessContrast 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/adjustments/RedFilter_BrightnessContrast.html',
+ example : `
+ var effect;
+ effect = RedFilter_BrightnessContrast(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_BrightnessContrast Instance'
+ }
+ :DOC*/
+ RedFilter_BrightnessContrast = function (redGL) {
+ if (!(this instanceof RedFilter_BrightnessContrast)) return new RedFilter_BrightnessContrast(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_BrightnessContrast : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['brightness'] = 0;
+ this['contrast'] = 0;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_BrightnessContrast.prototype = new RedBaseFilter();
+ RedFilter_BrightnessContrast.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_BrightnessContrast',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`brightness`,
+ description : `
+ 밝기
+ 기본값 : 0
+ min : -150
+ max : 150
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['brightness', 'number', {
+ min: -150, max: 150, callback: function (v) {
+ this['_brightness_value'] = v / 255
+ }
+ }],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`contrast`,
+ description : `
+ 대조
+ 기본값 : 0
+ min: -50
+ max: 100
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['contrast', 'number', {
+ min: -50, max: 100, callback: function (v) {
+ this['_contrast_value'] = v / 255
+ }
+ }]
+ );
+ Object.freeze(RedFilter_BrightnessContrast);
+})();
\ No newline at end of file
diff --git a/src/filter/adjustments/RedFilter_Gray.js b/src/filter/adjustments/RedFilter_Gray.js
new file mode 100644
index 00000000..dd9f8695
--- /dev/null
+++ b/src/filter/adjustments/RedFilter_Gray.js
@@ -0,0 +1,75 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_Gray;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterGrayProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ void main(void) {
+ vec4 finalColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution);
+ highp float gray = (finalColor.r + finalColor.g + finalColor.b)/3.0;
+ gl_FragColor = vec4( gray, gray, gray, finalColor.a);
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Gray`,
+ description : `
+ Gray 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/adjustments/RedFilter_Gray.html',
+ example : `
+ var effect;
+ effect = RedFilter_Gray(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Gray Instance'
+ }
+ :DOC*/
+ RedFilter_Gray = function (redGL) {
+ if (!(this instanceof RedFilter_Gray)) return new RedFilter_Gray(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Gray : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Gray.prototype = new RedBaseFilter();
+ RedFilter_Gray.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototype('RedFilter_Gray', 'diffuseTexture', 'sampler2D');
+ Object.freeze(RedFilter_Gray);
+})();
\ No newline at end of file
diff --git a/src/filter/adjustments/RedFilter_HueSaturation.js b/src/filter/adjustments/RedFilter_HueSaturation.js
new file mode 100644
index 00000000..be98d990
--- /dev/null
+++ b/src/filter/adjustments/RedFilter_HueSaturation.js
@@ -0,0 +1,132 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_HueSaturation;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterHueSaturationProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_hue_value;
+ uniform float u_saturation_value;
+ void main(void) {
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+ vec4 finalColor = texture2D(u_diffuseTexture, testCoord );
+ float angle = u_hue_value * 3.1415926535897932384626433832795;
+ float s = sin(angle), c = cos(angle);
+ vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
+ float len = length(finalColor.rgb);
+
+ finalColor.rgb = vec3(
+ dot(finalColor.rgb, weights.xyz),
+ dot(finalColor.rgb, weights.zxy),
+ dot(finalColor.rgb, weights.yzx)
+ );
+
+ float average = (finalColor.r + finalColor.g + finalColor.b) / 3.0;
+ if (u_saturation_value > 0.0) finalColor.rgb += (average - finalColor.rgb) * (1.0 - 1.0 / (1.001 - u_saturation_value));
+ else finalColor.rgb += (average - finalColor.rgb) * (-u_saturation_value);
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_HueSaturation`,
+ description : `
+ HueSaturation 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/adjustments/RedFilter_HueSaturation.html',
+ example : `
+ var effect;
+ effect = RedFilter_HueSaturation(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_HueSaturation Instance'
+ }
+ :DOC*/
+ RedFilter_HueSaturation = function (redGL) {
+ if (!(this instanceof RedFilter_HueSaturation)) return new RedFilter_HueSaturation(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_HueSaturation : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['hue'] = 0;
+ this['saturation'] = 0;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_HueSaturation.prototype = new RedBaseFilter();
+ RedFilter_HueSaturation.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_HueSaturation',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`hue`,
+ description : `
+ 색조
+ 기본값 : 0
+ min: -180
+ max: 180
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['hue', 'number', {
+ min: -180, max: 180, callback: function (v) {
+ this['_hue_value'] = v / 180
+ }
+ }],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`saturation`,
+ description : `
+ 채도
+ 기본값 : 0
+ min: -100
+ max: 100
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['saturation', 'number', {
+ min: -100, max: 100, callback: function (v) {
+ this['_saturation_value'] = v / 100
+ }
+ }]
+ );
+ Object.freeze(RedFilter_HueSaturation);
+})();
\ No newline at end of file
diff --git a/src/filter/adjustments/RedFilter_Invert.js b/src/filter/adjustments/RedFilter_Invert.js
new file mode 100644
index 00000000..b20b2226
--- /dev/null
+++ b/src/filter/adjustments/RedFilter_Invert.js
@@ -0,0 +1,79 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 17:36:26
+ *
+ */
+
+"use strict";
+var RedFilter_Invert;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterInvertProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+
+ void main(void) {
+ vec4 finalColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution);
+ if(finalColor.a == 0.0) discard;
+ finalColor.r = 1.0 - finalColor.r;
+ finalColor.g = 1.0 - finalColor.g;
+ finalColor.b = 1.0 - finalColor.b;
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Invert`,
+ description : `
+ Invert 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/adjustments/RedFilter_Invert.html',
+ example : `
+ var effect;
+ effect = RedFilter_Invert(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Invert Instance'
+ }
+ :DOC*/
+ RedFilter_Invert = function (redGL) {
+ if (!(this instanceof RedFilter_Invert)) return new RedFilter_Invert(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Invert : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Invert.prototype = new RedBaseFilter();
+ RedFilter_Invert.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototype('RedFilter_Invert', 'diffuseTexture', 'sampler2D');
+ Object.freeze(RedFilter_Invert);
+})();
\ No newline at end of file
diff --git a/src/filter/adjustments/RedFilter_Threshold.js b/src/filter/adjustments/RedFilter_Threshold.js
new file mode 100644
index 00000000..dcfbfd5b
--- /dev/null
+++ b/src/filter/adjustments/RedFilter_Threshold.js
@@ -0,0 +1,105 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.7 11:21:57
+ *
+ */
+
+"use strict";
+var RedFilter_Threshold;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterThresholdProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_threshold_value;
+ void main() {
+ vec4 finalColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution.xy);
+ float v;
+ if(0.2126 * finalColor.r + 0.7152 * finalColor.g + 0.0722 * finalColor.b >= u_threshold_value) v = 1.0;
+ else v = 0.0;
+ finalColor.r = finalColor.g = finalColor.b = v;
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Threshold`,
+ description : `
+ Threshold 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/adjustments/RedFilter_Threshold.html',
+ example : `
+ var effect;
+ effect = RedFilter_Threshold(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Threshold Instance'
+ }
+ :DOC*/
+ RedFilter_Threshold = function (redGL) {
+ if (!(this instanceof RedFilter_Threshold)) return new RedFilter_Threshold(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Threshold : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['threshold'] = 50;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Threshold.prototype = new RedBaseFilter();
+ RedFilter_Threshold.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_Threshold',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`threshold`,
+ description : `
+ 최소 유효값
+ 기본값 : 128
+ min: 1
+ max: 255
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ [
+ 'threshold', 'number',
+ {
+ min: 1, max: 255, callback: function (v) {
+ this['_threshold_value'] = v / 255
+ }
+ }
+ ]
+ );
+
+ Object.freeze(RedFilter_Threshold);
+})();
\ No newline at end of file
diff --git a/src/filter/bloom/RedFilter_Bloom.js b/src/filter/bloom/RedFilter_Bloom.js
new file mode 100644
index 00000000..ce073239
--- /dev/null
+++ b/src/filter/bloom/RedFilter_Bloom.js
@@ -0,0 +1,159 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_Bloom;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterBloomProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform sampler2D u_blurTexture;
+ uniform float u_exposure;
+ uniform float u_bloomStrength;
+
+ void main() {
+ vec4 finalColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution.xy);
+ vec4 thresholdColor = finalColor;
+ vec4 blurColor = texture2D(u_blurTexture, gl_FragCoord.xy/vResolution.xy);
+ finalColor.rgb = (finalColor.rgb + blurColor.rgb * u_bloomStrength) * u_exposure;
+ gl_FragColor = finalColor ;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Bloom`,
+ description : `
+ Bloom 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/bloom/RedFilter_Bloom.html',
+ example : `
+ var effect;
+ effect = RedFilter_Bloom(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Bloom Instance'
+ }
+ :DOC*/
+ RedFilter_Bloom = function (redGL) {
+ if (!(this instanceof RedFilter_Bloom)) return new RedFilter_Bloom(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Bloom : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['blurTexture'] = null;
+ this['exposure'] = 1;
+ this['bloomStrength'] = 1.2;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['_process'] = [
+ RedFilter_BloomThreshold(redGL),
+ RedFilter_BlurX(redGL),
+ RedFilter_BlurY(redGL)
+ ];
+ this['blur'] = 20;
+ this['threshold'] = 75;
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Bloom.prototype = new RedBaseFilter();
+ RedFilter_Bloom.prototype['updateTexture'] = function (lastFrameBufferTexture, parentFrameBufferTexture) {
+ this['diffuseTexture'] = parentFrameBufferTexture;
+ this['blurTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_Bloom',
+ ['diffuseTexture', 'sampler2D'],
+ ['blurTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`exposure`,
+ description : `
+ 확산 강도.
+ 기본값 : 1
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['exposure', 'number', {'min': 0}],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`bloomStrength`,
+ description : `
+ 블룸 강도
+ 기본값 : 1.2
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['bloomStrength', 'number', {'min': 0}],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`threshold`,
+ description : `
+ 최소 유효값
+ 기본값 : 75
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['threshold', 'number', {
+ min: 0,
+ callback: function (v) {
+ this['_process'][0]['threshold'] = v;
+ this['_threshold'] = this['_process'][0]['threshold']
+ }
+ }],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`blur`,
+ description : `
+ blur 정도.
+ 기본값 : 20
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['blur', 'number', {
+ min: 0, callback: function (v) {
+ this['_process'][1]['size'] = v;
+ this['_process'][2]['size'] = v;
+ }
+ }]
+ );
+ Object.freeze(RedFilter_Bloom);
+})();
\ No newline at end of file
diff --git a/src/filter/bloom/RedFilter_BloomThreshold.js b/src/filter/bloom/RedFilter_BloomThreshold.js
new file mode 100644
index 00000000..566ba116
--- /dev/null
+++ b/src/filter/bloom/RedFilter_BloomThreshold.js
@@ -0,0 +1,102 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_BloomThreshold;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME;
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_threshold_value;
+
+ void main() {
+ vec4 finalColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution.xy);
+ if(0.2126 * finalColor.r + 0.7152 * finalColor.g + 0.0722 * finalColor.b < u_threshold_value) finalColor.r = finalColor.g = finalColor.b = 0.0;
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ PROGRAM_NAME = 'RedFilterBloomThresholdProgram';
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_BloomThreshold`,
+ description : `
+ BloomThreshold 이펙트
+ RedFilter_Bloom 내부에서 사용하는 절차 이펙트
+ 시스템적으로 사용됨.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ example : `
+ var effect;
+ effect = RedFilter_BloomThreshold(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_BloomThreshold Instance'
+ }
+ :DOC*/
+ RedFilter_BloomThreshold = function (redGL) {
+ if (!(this instanceof RedFilter_BloomThreshold)) return new RedFilter_BloomThreshold(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_BloomThreshold : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['renderScale'] = 0.5
+ this['threshold'] = 128;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_BloomThreshold.prototype = new RedBaseFilter();
+ RedFilter_BloomThreshold.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_BloomThreshold',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`threshold`,
+ description : `
+ 최소 유효값
+ 기본값 : 128
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ [
+ 'threshold', 'number',
+ {
+ min: 0, max: 255, callback: function (v) {
+ this['_threshold_value'] = v / 255
+ }
+ }
+ ]
+ );
+ Object.freeze(RedFilter_BloomThreshold);
+})();
\ No newline at end of file
diff --git a/src/filter/blur/RedFilter_Blur.js b/src/filter/blur/RedFilter_Blur.js
new file mode 100644
index 00000000..06de9922
--- /dev/null
+++ b/src/filter/blur/RedFilter_Blur.js
@@ -0,0 +1,91 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_Blur;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterBlurProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ void main(void) {
+ vec2 px = vec2(1.0/vResolution.x, 1.0/vResolution.y);
+ vec4 finalColor = vec4(0.0);
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-7.0*px.x, -7.0*px.y))*0.0044299121055113265;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-6.0*px.x, -6.0*px.y))*0.00895781211794;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-5.0*px.x, -5.0*px.y))*0.0215963866053;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-4.0*px.x, -4.0*px.y))*0.0443683338718;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-3.0*px.x, -3.0*px.y))*0.0776744219933;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-2.0*px.x, -2.0*px.y))*0.115876621105;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2(-1.0*px.x, -1.0*px.y))*0.147308056121;
+ finalColor += texture2D(u_diffuseTexture, testCoord )*0.159576912161;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 1.0*px.x, 1.0*px.y))*0.147308056121;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 2.0*px.x, 2.0*px.y))*0.115876621105;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 3.0*px.x, 3.0*px.y))*0.0776744219933;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 4.0*px.x, 4.0*px.y))*0.0443683338718;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 5.0*px.x, 5.0*px.y))*0.0215963866053;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 6.0*px.x, 6.0*px.y))*0.00895781211794;
+ finalColor += texture2D(u_diffuseTexture, testCoord + vec2( 7.0*px.x, 7.0*px.y))*0.0044299121055113265;
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Blur`,
+ description : `
+ 기본 블러 이펙트
+ postEffectManager.addEffect( effect Instance ) 로 추가.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/blur/RedFilter_Blur.html',
+ example : `
+ var effect;
+ effect = RedFilter_Blur(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Blur Instance'
+ }
+ :DOC*/
+ RedFilter_Blur = function (redGL) {
+ if (!(this instanceof RedFilter_Blur)) return new RedFilter_Blur(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Blur : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Blur.prototype = new RedBaseFilter();
+ RedFilter_Blur.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototype('RedFilter_Blur', 'diffuseTexture', 'sampler2D');
+ Object.freeze(RedFilter_Blur);
+})();
\ No newline at end of file
diff --git a/src/filter/blur/RedFilter_BlurX.js b/src/filter/blur/RedFilter_BlurX.js
new file mode 100644
index 00000000..dc9542ec
--- /dev/null
+++ b/src/filter/blur/RedFilter_BlurX.js
@@ -0,0 +1,111 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.7 11:21:57
+ *
+ */
+
+"use strict";
+var RedFilter_BlurX;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterBlurXProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision mediump float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_size;
+ float random(vec3 scale, float seed) {
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
+ }
+ void main() {
+ vec4 finalColor = vec4(0.0);
+ vec2 delta;
+ float total = 0.0;
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
+ delta = vec2(u_size/vResolution.x,0.0);
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+ float percent;
+ float weight;
+ for (float t = -4.0; t <= 4.0; t+=1.0) {
+ float percent = (t + offset - 0.5) / 4.0;
+ float weight = 1.0 - abs(percent);
+ vec4 sample = texture2D(u_diffuseTexture, testCoord + delta * percent);
+ sample.rgb *= sample.a;
+ finalColor += sample * weight;
+ total += weight;
+ }
+ finalColor = finalColor / total;
+ finalColor.rgb /= finalColor.a + 0.00001;
+ gl_FragColor = finalColor ;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_BlurX`,
+ description : `
+ X축 블러 이펙트
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/blur/RedFilter_BlurX.html',
+ example : `
+ var effect;
+ effect = RedFilter_BlurX(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_BlurX Instance'
+ }
+ :DOC*/
+ RedFilter_BlurX = function (redGL) {
+ if (!(this instanceof RedFilter_BlurX)) return new RedFilter_BlurX(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_BlurX : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['size'] = 50;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_BlurX.prototype = new RedBaseFilter();
+ RedFilter_BlurX.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_BlurX',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`size`,
+ description : `
+ 블러 사이즈
+ 기본값 : 50
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['size', 'number', {'min': 0}]
+ );
+ Object.freeze(RedFilter_BlurX);
+})();
\ No newline at end of file
diff --git a/src/filter/blur/RedFilter_BlurY.js b/src/filter/blur/RedFilter_BlurY.js
new file mode 100644
index 00000000..80f1e0af
--- /dev/null
+++ b/src/filter/blur/RedFilter_BlurY.js
@@ -0,0 +1,110 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.7 11:21:57
+ *
+ */
+
+"use strict";
+var RedFilter_BlurY;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterBlurYProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_size;
+ float random(vec3 scale, float seed) {
+ return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
+ }
+ void main() {
+ vec4 finalColor = vec4(0.0);
+ vec2 delta;
+ float total = 0.0;
+ float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
+ delta = vec2(0.0, u_size/vResolution.y);
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+
+ for (float t = -4.0; t <= 4.0; t++) {
+ float percent = (t + offset - 0.5) / 4.0;
+ float weight = 1.0 - abs(percent);
+ vec4 sample = texture2D(u_diffuseTexture, testCoord + delta * percent);
+ sample.rgb *= sample.a;
+ finalColor += sample * weight;
+ total += weight;
+ }
+ finalColor = finalColor / total;
+ finalColor.rgb /= finalColor.a + 0.00001;
+ gl_FragColor = finalColor ;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_BlurY`,
+ description : `
+ X축 블러 이펙트
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/blur/RedFilter_BlurY.html',
+ example : `
+ var effect;
+ effect = RedFilter_BlurY(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_BlurY Instance'
+ }
+ :DOC*/
+ RedFilter_BlurY = function (redGL) {
+ if (!(this instanceof RedFilter_BlurY)) return new RedFilter_BlurY(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_BlurY : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['size'] = 25;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_BlurY.prototype = new RedBaseFilter();
+ RedFilter_BlurY.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_BlurY',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`size`,
+ description : `
+ 블러 사이즈
+ 기본값 : 50
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['size', 'number', {'min': 0}]
+ );
+ Object.freeze(RedFilter_BlurY);
+})();
\ No newline at end of file
diff --git a/src/filter/blur/RedFilter_GaussianBlur.js b/src/filter/blur/RedFilter_GaussianBlur.js
new file mode 100644
index 00000000..2cedf315
--- /dev/null
+++ b/src/filter/blur/RedFilter_GaussianBlur.js
@@ -0,0 +1,74 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_GaussianBlur;
+(function () {
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_GaussianBlur`,
+ description : `
+ 가우시안 블러 이펙트
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/blur/RedFilter_GaussianBlur.html',
+ example : `
+ var effect;
+ effect = RedFilter_GaussianBlur(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_GaussianBlur Instance'
+ }
+ :DOC*/
+ RedFilter_GaussianBlur = function (redGL) {
+ if (!(this instanceof RedFilter_GaussianBlur)) return new RedFilter_GaussianBlur(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_GaussianBlur : RedGL Instance만 허용.', redGL);
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['_UUID'] = RedGL.makeUUID();
+ this['_process'] = [
+ RedFilter_BlurX(redGL),
+ RedFilter_BlurY(redGL)
+ ];
+ this['radius'] = 1;
+ console.log(this);
+ };
+ RedFilter_GaussianBlur.prototype = new RedBaseFilter();
+ RedFilter_GaussianBlur.prototype['updateTexture'] = function () {
+ };
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`radius`,
+ description : `
+ 가우시간 블러강도
+ 기본값 : 1
+ min: 0.1
+ max: 255
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ RedDefinePropertyInfo.definePrototype('RedFilter_GaussianBlur', 'radius', 'number', {
+ min: 0.1, max: 255, callback: function (v) {
+ this['_process'][0]['size'] = v;
+ this['_process'][1]['size'] = v;
+ }
+ });
+ Object.freeze(RedFilter_GaussianBlur);
+})();
\ No newline at end of file
diff --git a/src/filter/pixelate/RedFilter_HalfTone.js b/src/filter/pixelate/RedFilter_HalfTone.js
new file mode 100644
index 00000000..eacffb07
--- /dev/null
+++ b/src/filter/pixelate/RedFilter_HalfTone.js
@@ -0,0 +1,166 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_HalfTone;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterHalfToneProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_centerX;
+ uniform float u_centerY;
+ uniform float u_angle;
+ uniform float u_radius;
+ uniform bool u_grayMode;
+
+ float pattern(float angle, vec2 testCoord) {
+ angle = angle * 3.141592653589793/180.0;
+ float s = sin(angle), c = cos(angle);
+ vec2 tex = testCoord;
+ tex.x -= u_centerX + 0.5;
+ tex.y -= u_centerY + 0.5;
+ vec2 point = vec2(
+ c * tex.x - s * tex.y,
+ s * tex.x + c * tex.y
+ ) * vResolution / u_radius;
+ return (sin(point.x) * sin(point.y)) * 4.0;
+ }
+ void main(void) {
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+ vec4 finalColor = texture2D(u_diffuseTexture, testCoord);
+ if(u_grayMode) {
+ float average = (finalColor.r + finalColor.g + finalColor.b) / 3.0;
+ gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern(u_angle,testCoord)), finalColor.a);
+ }else{
+ vec3 cmy = 1.0 - finalColor.rgb;
+ float k = min(cmy.x, min(cmy.y, cmy.z));
+ cmy = (cmy - k) / (1.0 - k);
+ cmy = clamp(cmy * 10.0 - 3.0 + vec3(pattern(u_angle + 0.26179,testCoord), pattern(u_angle + 1.30899,testCoord), pattern(u_angle,testCoord)), 0.0, 1.0);
+ k = clamp(k * 10.0 - 5.0 + pattern(u_angle + 0.78539,testCoord), 0.0, 1.0);
+ gl_FragColor = vec4(1.0 - cmy - k, finalColor.a);
+ }
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_HalfTone`,
+ description : `
+ HalfTone 이펙트
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/pixelate/RedFilter_HalfTone.html',
+ example : `
+ var effect;
+ effect = RedFilter_HalfTone(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_HalfTone Instance'
+ }
+ :DOC*/
+ RedFilter_HalfTone = function (redGL) {
+ if (!(this instanceof RedFilter_HalfTone)) return new RedFilter_HalfTone(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_HalfTone : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['centerX'] = 0.0;
+ this['centerY'] = 0.0;
+ this['angle'] = 0;
+ this['radius'] = 2;
+ this['grayMode'] = false;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_HalfTone.prototype = new RedBaseFilter();
+ RedFilter_HalfTone.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_HalfTone',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`centerX`,
+ description : `
+ 기본값 0.0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['centerX', 'number'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`centerY`,
+ description : `
+ 기본값 0.0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['centerY', 'number'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`angle`,
+ description : `
+ 기본값 0.0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['angle', 'number'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`grayMode`,
+ description : `
+ 기본값 false
+ `,
+ return : 'Boolean'
+ }
+ :DOC*/
+ ['grayMode', 'boolean'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`radius`,
+ description : `
+ 기본값 2
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['radius', 'number', {'min': 0}]
+ );
+ Object.freeze(RedFilter_HalfTone);
+})();
\ No newline at end of file
diff --git a/src/filter/pixelate/RedFilter_Pixelize.js b/src/filter/pixelate/RedFilter_Pixelize.js
new file mode 100644
index 00000000..d38ee363
--- /dev/null
+++ b/src/filter/pixelate/RedFilter_Pixelize.js
@@ -0,0 +1,114 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.6 14:20:40
+ *
+ */
+
+"use strict";
+var RedFilter_Pixelize;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterPixelizeProgram';
+ var checked;
+ vSource = RedBaseFilter['baseVertexShaderSource1']
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ uniform float u_width;
+ uniform float u_height;
+ void main(void) {
+ vec4 finalColor;
+ float dx = 1.0/vResolution.x * u_width;
+ float dy = 1.0/vResolution.y * u_height;
+ vec2 testCoord = gl_FragCoord.xy/vResolution.xy;
+ vec2 coord = vec2(
+ dx * (floor(testCoord.x / dx) + 0.5),
+ dy * (floor(testCoord.y / dy) + 0.5)
+ );
+ finalColor = texture2D(u_diffuseTexture, coord);
+ gl_FragColor = finalColor;
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilter_Pixelize`,
+ description : `
+ Pixelize 효과
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ]
+ },
+ extends : [
+ 'RedBaseFilter',
+ 'RedBaseMaterial'
+ ],
+ demo : '../example/postEffect/pixelate/RedFilter_Pixelize.html',
+ example : `
+ var effect;
+ effect = RedFilter_Pixelize(RedGL Instance); // 포스트이펙트 생성
+ // postEffectManager는 RedView 생성시 자동생성됨.
+ (RedView Instance)['postEffectManager'].addEffect(effect); // 뷰에 이펙트 추가
+ `,
+ return : 'RedFilter_Pixelize Instance'
+ }
+ :DOC*/
+ RedFilter_Pixelize = function (redGL) {
+ if (!(this instanceof RedFilter_Pixelize)) return new RedFilter_Pixelize(redGL);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilter_Pixelize : RedGL Instance만 허용.', redGL);
+ this['frameBuffer'] = RedFilterFrameBuffer(redGL);
+ this['diffuseTexture'] = null;
+ this['width'] = 5;
+ this['height'] = 5;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilter_Pixelize.prototype = new RedBaseFilter();
+ RedFilter_Pixelize.prototype['updateTexture'] = function (lastFrameBufferTexture) {
+ this['diffuseTexture'] = lastFrameBufferTexture;
+ };
+ RedDefinePropertyInfo.definePrototypes(
+ 'RedFilter_Pixelize',
+ ['diffuseTexture', 'sampler2D'],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`width`,
+ description : `
+ 픽셀화 가로 크기
+ 기본값 : 5
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['width', 'number', {'min': 0}],
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`height`,
+ description : `
+ 픽셀화 세로 크기
+ 기본값 : 5
+ min : 0
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ ['height', 'number', {'min': 0}]
+ );
+ Object.freeze(RedFilter_Pixelize);
+})();
\ No newline at end of file
diff --git a/src/material/system/RedFilterMaterial.js b/src/material/system/RedFilterMaterial.js
new file mode 100644
index 00000000..a58819d1
--- /dev/null
+++ b/src/material/system/RedFilterMaterial.js
@@ -0,0 +1,85 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.2 18:16:21
+ *
+ */
+
+"use strict";
+var RedFilterMaterial;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedFilterMaterialProgram';
+ var checked;
+ vSource = function () {
+ /* @preserve
+ void main(void) {
+ vTexcoord = aTexcoord;
+ gl_Position = uPMatrix * uCameraMatrix * uMMatrix * vec4(aVertexPosition, 1.0);
+ vResolution = uResolution;
+ }
+ */
+ };
+ fSource = function () {
+ /* @preserve
+ precision lowp float;
+ uniform sampler2D u_diffuseTexture;
+ void main(void) {
+ gl_FragColor = texture2D(u_diffuseTexture, gl_FragCoord.xy/vResolution.xy);
+ // gl_FragColor.r = 1.0;
+ // gl_FragColor.a = 0.5;
+ if(gl_FragColor.a == 0.0) discard;
+
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedFilterMaterial`,
+ description : `
+ 메쉬 필터 최종 이미지를 생성하기 위한재질.
+ 시스템적으로 사용됨.
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ],
+ diffuseTexture : [
+ {type:'RedBitmapTexture'},
+ 'RedBitmapTexture Instance'
+ ]
+ },
+ extends : ['RedBaseMaterial'],
+ return : 'RedFilterMaterial Instance'
+ }
+ :DOC*/
+ RedFilterMaterial = function (redGL, diffuseTexture) {
+ if (!(this instanceof RedFilterMaterial)) return new RedFilterMaterial(redGL, diffuseTexture);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedFilterMaterial : RedGL Instance만 허용.', redGL);
+ /////////////////////////////////////////
+ // 유니폼 프로퍼티
+ this['diffuseTexture'] = diffuseTexture;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['program'] = RedProgram['makeProgram'](redGL, PROGRAM_NAME, vSource, fSource);
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedFilterMaterial.prototype = new RedBaseMaterial();
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`diffuseTexture`,
+ description :`diffuseTexture`,
+ return : 'RedFilterMaterial'
+ }
+ :DOC*/
+ RedDefinePropertyInfo.definePrototype('RedFilterMaterial', 'diffuseTexture', 'sampler2D', {essential: true});
+ Object.freeze(RedFilterMaterial);
+})();
\ No newline at end of file
diff --git a/src/material/system/RedOutlineMaterial.js b/src/material/system/RedOutlineMaterial.js
new file mode 100644
index 00000000..c41b7ff9
--- /dev/null
+++ b/src/material/system/RedOutlineMaterial.js
@@ -0,0 +1,160 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.7.12 14:22:52
+ *
+ */
+
+"use strict";
+var RedOutlineMaterial;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedOutlineMaterialProgram';
+ var PROGRAM_OPTION_LIST = [];
+ var checked;
+ vSource = function () {
+ /* @preserve
+ // 스키닝
+ //#REDGL_DEFINE#vertexShareFunc#getSkinMatrix#
+
+ // Sprite3D
+ //#REDGL_DEFINE#vertexShareFunc#getSprite3DMatrix#
+ void main(void) {
+ gl_PointSize = uPointSize;
+ float outlineSize = uOutlineThickness;
+
+ // position 계산
+ //#REDGL_DEFINE#skin#true# mat4 targetMatrix = uMMatrix * getSkinMatrix() ;
+ //#REDGL_DEFINE#skin#false# mat4 targetMatrix = uMMatrix;
+ vVertexPosition = targetMatrix * vec4(aVertexPosition, 1.0);
+ float tScaleX = length(vec3(uMMatrix[0][0], uMMatrix[0][1], uMMatrix[0][2]));
+ float tScaleY = length(vec3(uMMatrix[1][0], uMMatrix[1][1], uMMatrix[1][2]));
+ float tScaleZ = length(vec3(uMMatrix[2][0], uMMatrix[2][1], uMMatrix[2][2]));
+
+ //#REDGL_DEFINE#sprite3D#true# gl_Position = uPMatrix * getSprite3DMatrix(uCameraMatrix , targetMatrix) * vec4(aVertexPosition, 1.0);
+ //#REDGL_DEFINE#sprite3D#true# if(!u_PerspectiveScale){
+ //#REDGL_DEFINE#sprite3D#true# gl_Position /= gl_Position.w;
+ //#REDGL_DEFINE#sprite3D#true# gl_Position.xy += aVertexPosition.xy * vec2((uPMatrix * targetMatrix)[0][0],(uPMatrix * targetMatrix)[1][1]);
+ //#REDGL_DEFINE#sprite3D#true# }
+ //#REDGL_DEFINE#skin#false#//#REDGL_DEFINE#sprite3D#false# gl_Position = uPMatrix * uCameraMatrix * targetMatrix * vec4(aVertexPosition * vec3(1.0+outlineSize/tScaleX,1.0+outlineSize/tScaleY,1.0+outlineSize/tScaleZ) , 1.0);
+ //#REDGL_DEFINE#skin#true#//#REDGL_DEFINE#sprite3D#false# gl_Position = uPMatrix * uCameraMatrix * targetMatrix * vec4(aVertexPosition + vec3( aVertexNormal * vec3(outlineSize/tScaleX,outlineSize/tScaleY,outlineSize/tScaleZ)), 1.0);
+
+
+ //#REDGL_DEFINE#directionalShadow#true# vResolution = uResolution;
+ //#REDGL_DEFINE#directionalShadow#true# vShadowPos = cTexUnitConverter * uDirectionalShadowLightMatrix * targetMatrix * vec4(aVertexPosition, 1.0);
+ }
+ */
+ };
+ fSource = function () {
+ /* @preserve
+ precision mediump float;
+ // 안개
+ //#REDGL_DEFINE#fragmentShareFunc#fogFactor#
+ //#REDGL_DEFINE#fragmentShareFunc#fog#
+
+ // 그림자
+ //#REDGL_DEFINE#fragmentShareFunc#decodeFloatShadow#
+ //#REDGL_DEFINE#fragmentShareFunc#getShadowColor#
+
+ void main(void) {
+ vec4 finalColor = uOutlineColor;
+ //#REDGL_DEFINE#directionalShadow#true# finalColor.rgb *= getShadowColor( vShadowPos, vResolution, uDirectionalShadowTexture);
+ //#REDGL_DEFINE#fog#false# gl_FragColor = finalColor;
+ //#REDGL_DEFINE#fog#true# gl_FragColor = fog( fogFactor(u_FogDistance, u_FogDensity), uFogColor, finalColor);
+ }
+ */
+ };
+ /*DOC:
+ {
+ constructorYn : true,
+ title :`RedOutlineMaterial`,
+ description : `
+ RedOutlineMaterial Instance 생성
+ `,
+ params : {
+ redGL : [
+ {type:'RedGL'}
+ ],
+ hexColor : [
+ {type:'hex'},
+ '기본값 : #ff0000'
+ ],
+ alpha : [
+ {type:'number'},
+ '기본값 : 1'
+ ]
+ },
+ extends : ['RedBaseMaterial'],
+ demo : '../example/material/RedOutlineMaterial.html',
+ example : `
+ RedOutlineMaterial(RedGL Instance, hex)
+ `,
+ return : 'RedOutlineMaterial Instance'
+ }
+ :DOC*/
+ RedOutlineMaterial = function (redGL, hexColor, alpha) {
+ if (!(this instanceof RedOutlineMaterial)) return new RedOutlineMaterial(redGL, hexColor, alpha);
+ redGL instanceof RedGL || RedGLUtil.throwFunc('RedOutlineMaterial : RedGL Instance만 허용.', '입력값 : ' + redGL);
+ this.makeProgramList(this, redGL, PROGRAM_NAME, vSource, fSource, PROGRAM_OPTION_LIST);
+ /////////////////////////////////////////
+ // 유니폼 프로퍼티
+ this['_color'] = new Float32Array(4);
+ this['alpha'] = alpha == undefined ? 1 : alpha;
+ /////////////////////////////////////////
+ // 일반 프로퍼티
+ this['color'] = hexColor ? hexColor : '#ff0000';
+ this['_UUID'] = RedGL.makeUUID();
+ if (!checked) {
+ this.checkUniformAndProperty();
+ checked = true;
+ }
+ console.log(this);
+ };
+ RedOutlineMaterial.prototype = new RedBaseMaterial();
+ RedOutlineMaterial['DEFINE_OBJECT_COLOR'] = {
+ get: function () {
+ return this['_colorHex']
+ },
+ set: (function () {
+ var t0;
+ return function (hex) {
+ this['_colorHex'] = hex ? hex : '#ff2211';
+ t0 = RedGLUtil.hexToRGB_ZeroToOne.call(this, this['_colorHex']);
+ this['_color'][0] = t0[0];
+ this['_color'][1] = t0[1];
+ this['_color'][2] = t0[2];
+ this['_color'][3] = this['_alpha'];
+ }
+ })()
+ };
+ RedOutlineMaterial['DEFINE_OBJECT_ALPHA'] = {
+ 'min': 0, 'max': 1,
+ callback: function (v) {
+ this['_color'][3] = this['_alpha'] = v
+ }
+ };
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`color`,
+ description : `기본값 : #ff2211`,
+ return : 'hex'
+ }
+ :DOC*/
+ Object.defineProperty(RedOutlineMaterial.prototype, 'color', RedOutlineMaterial['DEFINE_OBJECT_COLOR']);
+ /*DOC:
+ {
+ code : 'PROPERTY',
+ title :`alpha`,
+ description : `
+ 기본값 : 1
+ 최소값 : 0
+ 최대값 : 1
+ `,
+ return : 'Number'
+ }
+ :DOC*/
+ RedDefinePropertyInfo.definePrototype('RedOutlineMaterial', 'alpha', 'number', RedOutlineMaterial['DEFINE_OBJECT_ALPHA']);
+ Object.freeze(RedOutlineMaterial);
+})();
\ No newline at end of file
diff --git a/src/material/system/RedOutlinePlaneMaterial.js b/src/material/system/RedOutlinePlaneMaterial.js
new file mode 100644
index 00000000..4def3254
--- /dev/null
+++ b/src/material/system/RedOutlinePlaneMaterial.js
@@ -0,0 +1,166 @@
+/*
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.7.11 18:28:15
+ *
+ */
+
+"use strict";
+var RedOutlinePlaneMaterial;
+(function () {
+ var vSource, fSource;
+ var PROGRAM_NAME = 'RedOutlinePlaneMaterialProgram';
+ var PROGRAM_OPTION_LIST = [];
+ var checked;
+ vSource = function () {
+ /* @preserve
+ // 스키닝
+ //#REDGL_DEFINE#vertexShareFunc#getSkinMatrix#
+
+ // Sprite3D
+ //#REDGL_DEFINE#vertexShareFunc#getSprite3DMatrix#
+ void main(void) {
+ gl_PointSize = uPointSize;
+ float outlineSize = uOutlineThickness;
+
+ // position 계산
+ //#REDGL_DEFINE#skin#true# mat4 targetMatrix = uMMatrix * getSkinMatrix() ;
+ //#REDGL_DEFINE#skin#false# mat4 targetMatrix = uMMatrix;
+ vVertexPosition = targetMatrix * vec4(aVertexPosition, 1.0);
+ float tScaleX = length(vec3(targetMatrix[0][0], targetMatrix[0][1], targetMatrix[0][2]));
+ float tScaleY = length(vec3(targetMatrix[1][0], targetMatrix[1][1], targetMatrix[1][2]));
+ float tScaleZ = length(vec3(targetMatrix[2][0], targetMatrix[2][1], targetMatrix[2][2]));
+
+ //#REDGL_DEFINE#sprite3D#true# gl_Position = uPMatrix * getSprite3DMatrix(uCameraMatrix , targetMatrix) * vec4(aVertexPosition, 1.0);
+ //#REDGL_DEFINE#sprite3D#true# if(!u_PerspectiveScale){
+ //#REDGL_DEFINE#sprite3D#true# gl_Position /= gl_Position.w;
+ //#REDGL_DEFINE#sprite3D#true# gl_Position.xy += aVertexPosition.xy * vec2((uPMatrix * targetMatrix)[0][0],(uPMatrix * targetMatrix)[1][1]);
+ //#REDGL_DEFINE#sprite3D#true# }
+ //#REDGL_DEFINE#sprite3D#false# gl_Position = uPMatrix * uCameraMatrix * targetMatrix * vec4(aVertexPosition * vec3(1.0+outlineSize/tScaleX,1.0+outlineSize/tScaleY,1.0+outlineSize/tScaleZ) , 1.0);
+ vTexcoord = aTexcoord-0.5;
+ vTexcoord *= vec2(1.0+outlineSize/tScaleX,1.0+outlineSize/tScaleY);
+
+
+ //#REDGL_DEFINE#directionalShadow#true# vResolution = uResolution;
+ //#REDGL_DEFINE#directionalShadow#true# vShadowPos = cTexUnitConverter * uDirectionalShadowLightMatrix * targetMatrix * vec4(aVertexPosition, 1.0);
+ }
+ */
+ };
+ fSource = function () {
+ /* @preserve
+ precision mediump float;
+ // 안개
+ //#REDGL_DEFINE#fragmentShareFunc#fogFactor#
+ //#REDGL_DEFINE#fragmentShareFunc#fog#
+
+ // 그림자
+ //#REDGL_DEFINE#fragmentShareFunc#decodeFloatShadow#
+ //#REDGL_DEFINE#fragmentShareFunc#getShadowColor#
+
+ void main(void) {
+ vec4 finalColor = uOutlineColor;
+ if(-0.495 TODO
+
+
+
\ No newline at end of file
diff --git a/testCase/object3D/RedMesh.js b/testCase/object3D/RedMesh.js
index ac2c20da..868b4f25 100644
--- a/testCase/object3D/RedMesh.js
+++ b/testCase/object3D/RedMesh.js
@@ -1,8 +1,9 @@
/*
- * RedGL - MIT License
- * Copyright (c) 2018 - 2019 By RedCamel(webseon@gmail.com)
- * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
- * Last modification time of this file - 2019.4.30 18:53
+ * RedGL - MIT License
+ * Copyright (c) 2018 - 2019 By RedCamel( webseon@gmail.com )
+ * https://github.com/redcamel/RedGL2/blob/dev/LICENSE
+ * Last modification time of this file - 2019.8.2 18:16:21
+ *
*/
"use strict";
@@ -235,6 +236,174 @@ RedGL(document.createElement('canvas'), function () {
);
}
);
+ RedTest.testGroup(
+ "(RedBaseObject3D extended Instance).addFilter( filter )",
+ function () {
+ RedTest.test(
+ "실패테스트 : 미입력",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ try {
+ t0.addFilter(null);
+ RedTest.run(true);
+
+ } catch (error) {
+ RedTest.run(false, error);
+
+ }
+
+ },
+ false
+ );
+ RedTest.test(
+ "성공테스트 : RedBaseFilter 확장 인스턴스 입력",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ var tFilter0 = RedFilter_Gray(tRedGL);
+ t0.addFilter(tFilter0);
+ RedTest.run(t0['_filterList'][0] === tFilter0);
+
+
+ },
+ true
+ );
+ RedTest.test(
+ "실패테스트 : 문자입력",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ try {
+ t0.addFilter('failTest');
+ RedTest.run(true);
+
+ } catch (error) {
+ RedTest.run(false, error);
+
+ }
+
+ },
+ false
+ );
+ RedTest.test(
+ "성공테스트 : 추가후 _filterList.length 정상적으로 늘어나는지 확인",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ var tFilter0 = RedFilter_Gray(tRedGL);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ RedTest.run(t0['_filterList'].length);
+
+
+ }, 2)
+ }
+ );
+ RedTest.testGroup(
+ "(RedBaseObject3D extended Instance).removeFilter( filter )",
+ function () {
+ RedTest.test(
+ "성공테스트 : 동작 확인",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ var tFilter0 = RedFilter_Gray(tRedGL);
+ t0.addFilter(tFilter0);
+ t0.removeFilter(tFilter0);
+ RedTest.run(t0['_filterList'].length);
+
+
+ }, 0);
+ RedTest.test(
+ "성공테스트 : 미입력 해도 에러가 안나야함",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ try {
+ t0.removeFilter();
+ RedTest.run(true);
+
+ } catch (error) {
+ RedTest.run(false, error);
+
+ }
+
+ },
+ true
+ );
+ RedTest.test(
+ "성공테스트 : _filterList에 없는 녀석을 제거를 시도해도 에러가 안나야함",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ var tFilter0 = RedFilter_Gray(tRedGL);
+ t0.addFilter(tFilter0);
+ t0.removeFilter(RedFilter_Threshold(tRedGL));
+ RedTest.run(t0['_filterList'].length);
+
+
+ }, 1)
+ }
+ );
+ RedTest.testGroup(
+ "(RedBaseObject3D extended Instance).removeAllFilter()",
+ function () {
+ RedTest.test(
+ "동작 확인",
+ function () {
+
+ var t0 = RedMesh(
+ tRedGL,
+ RedBox(tRedGL),
+ RedColorMaterial(tRedGL)
+ );
+ var tFilter0 = RedFilter_Gray(tRedGL);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ t0.addFilter(tFilter0);
+ console.log(t0['_filterList'].length);
+ t0.removeAllFilter();
+ RedTest.run(t0['_filterList'].length);
+
+
+ }, 0)
+ }
+ );
}
);
}