How to use loadShader method in wpt

Best JavaScript code snippet using wpt

Wagner.base.js

Source:Wagner.base.js Github

copy

Full Screen

1WAGNER.BlendPass = function() {2 WAGNER.Pass.call( this );3 WAGNER.log( 'BlendPass constructor' );4 this.loadShader( 'blend-fs.glsl' );5 this.params.mode = 1;6 this.params.opacity = 1;7 this.params.tInput2 = null;8 this.params.resolution2 = new THREE.Vector2();9 this.params.sizeMode = 1;10 this.params.aspectRatio = 1;11 this.params.aspectRatio2 = 1;12};13WAGNER.BlendMode = {14 Normal: 1,15 Dissolve: 2,16 Darken: 3,17 Multiply: 4,18 ColorBurn: 5,19 LinearBurn: 6,20 DarkerColor: 7,21 Lighten: 8,22 Screen: 9,23 ColorDodge: 10,24 LinearDodge: 11,25 LighterColor: 12,26 Overlay: 13,27 SoftLight: 14,28 HardLight: 15,29 VividLight: 16,30 LinearLight: 17,31 PinLight: 18,32 HardMix: 19,33 Difference: 20,34 Exclusion: 21,35 Substract: 22,36 Divide: 2337};38WAGNER.BlendPass.prototype = Object.create( WAGNER.Pass.prototype );39WAGNER.BlendPass.prototype.run = function( c ) {40 this.shader.uniforms.mode.value = this.params.mode;41 this.shader.uniforms.opacity.value = this.params.opacity;42 this.shader.uniforms.tInput2.value = this.params.tInput2;43 this.shader.uniforms.sizeMode.value = this.params.sizeMode;44 this.shader.uniforms.aspectRatio.value = this.params.aspectRatio;45 this.shader.uniforms.aspectRatio2.value = this.params.aspectRatio2;46 c.pass( this.shader );47}48WAGNER.InvertPass = function() {49 WAGNER.Pass.call( this );50 WAGNER.log( 'InvertPass constructor' );51 this.loadShader( 'invert-fs.glsl' );52};53WAGNER.InvertPass.prototype = Object.create( WAGNER.Pass.prototype );54WAGNER.SymetricPass = function() {55 WAGNER.Pass.call( this );56 WAGNER.log( 'SymetricPass constructor' );57 this.loadShader( 'symetric-fs.glsl' );58 this.params.xReverse = false;59 this.params.yReverse = false;60 this.params.xMirror = false;61 this.params.yMirror = false;62 this.params.mirrorCenter = new THREE.Vector2( 0.5, 0.5);63 this.params.angle = 0;64};65WAGNER.SymetricPass.prototype = Object.create( WAGNER.Pass.prototype );66WAGNER.SymetricPass.prototype.run = function( c ) {67 this.shader.uniforms.xReverse.value = this.params.xReverse;68 this.shader.uniforms.yReverse.value = this.params.yReverse;69 this.shader.uniforms.xMirror.value = this.params.xMirror;70 this.shader.uniforms.yMirror.value = this.params.yMirror;71 this.shader.uniforms.mirrorCenter.value = this.params.mirrorCenter;72 this.shader.uniforms.angle.value = this.params.angle;73 c.pass( this.shader );74}75WAGNER.SepiaPass = function() {76 WAGNER.Pass.call( this );77 WAGNER.log( 'SepiaPass constructor' );78 this.loadShader( 'sepia-fs.glsl' );79 this.params.amount = 1;80};81WAGNER.SepiaPass.prototype = Object.create( WAGNER.Pass.prototype );82WAGNER.SepiaPass.prototype.run = function( c ) {83 this.shader.uniforms.amount.value = this.params.amount;84 c.pass( this.shader );85}86WAGNER.BrightnessContrastPass = function() {87 WAGNER.Pass.call( this );88 WAGNER.log( 'BrightnessContrastPass constructor' );89 this.loadShader( 'brightness-contrast-fs.glsl' );90 this.params.brightness = 1;91 this.params.contrast = 1;92};93WAGNER.BrightnessContrastPass.prototype = Object.create( WAGNER.Pass.prototype );94WAGNER.BrightnessContrastPass.prototype.run = function( c ) {95 this.shader.uniforms.brightness.value = this.params.brightness;96 this.shader.uniforms.contrast.value = this.params.contrast;97 c.pass( this.shader );98}99WAGNER.Pass.prototype.bindUniform = function( p, s, v, c ) {100 Object.defineProperty( p, v, { 101 get : function(){ return s.uniforms[ id ].value; }, 102 set : c,103 configurable : false 104 } );105};106WAGNER.NoisePass = function() {107 WAGNER.Pass.call( this );108 WAGNER.log( 'Noise Pass constructor' );109 this.loadShader( 'noise-fs.glsl' );110 this.params.amount = 0.1;111 this.params.speed = 0;112};113WAGNER.NoisePass.prototype = Object.create( WAGNER.Pass.prototype );114WAGNER.NoisePass.prototype.run = function( c ) {115 this.shader.uniforms.amount.value = this.params.amount;116 this.shader.uniforms.speed.value = this.params.speed;117 c.pass( this.shader );118};119WAGNER.VignettePass = function() {120 WAGNER.Pass.call( this );121 WAGNER.log( 'Vignette Pass constructor' );122 this.loadShader( 'vignette-fs.glsl' );123 this.params.amount = 1;124 this.params.falloff = 0.1;125};126WAGNER.VignettePass.prototype = Object.create( WAGNER.Pass.prototype );127WAGNER.VignettePass.prototype.run = function( c ) {128 this.shader.uniforms.amount.value = this.params.amount;129 this.shader.uniforms.falloff.value = this.params.falloff;130 c.pass( this.shader );131};132WAGNER.Vignette2Pass = function() {133 WAGNER.Pass.call( this );134 WAGNER.log( 'Vignette Pass constructor' );135 this.loadShader( 'vignette2-fs.glsl' );136 this.params.boost = 2;137 this.params.reduction = 2;138};139WAGNER.Vignette2Pass.prototype = Object.create( WAGNER.Pass.prototype );140WAGNER.Vignette2Pass.prototype.run = function( c ) {141 this.shader.uniforms.boost.value = this.params.boost;142 this.shader.uniforms.reduction.value = this.params.reduction;143 c.pass( this.shader );144};145WAGNER.DenoisePass = function() {146 WAGNER.Pass.call( this );147 WAGNER.log( 'Denoise Pass constructor' );148 this.loadShader( 'denoise-fs.glsl' );149 this.params.exponent = 5;150 this.params.strength = 10;151};152WAGNER.DenoisePass.prototype = Object.create( WAGNER.Pass.prototype );153WAGNER.DenoisePass.prototype.run = function( c ) {154 this.shader.uniforms.exponent.value = this.params.exponent;155 this.shader.uniforms.strength.value = this.params.strength;156 c.pass( this.shader );157};158WAGNER.BoxBlurPass = function() {159 WAGNER.Pass.call( this );160 WAGNER.log( 'BoxBlurPass Pass constructor' );161 this.loadShader( 'box-blur2-fs.glsl' );162 this.params.delta = new THREE.Vector2( 0, 0 );163 this.params.taps = 1;164};165WAGNER.BoxBlurPass.prototype = Object.create( WAGNER.Pass.prototype );166WAGNER.BoxBlurPass.prototype.run = function( c ) {167 this.shader.uniforms.delta.value.copy( this.params.delta );168 /*for( var j = 0; j < this.params.taps; j++ ) {169 this.shader.uniforms.delta.value.copy( this.params.delta );170 c.pass( this.shader );171 }*/172 c.pass( this.shader );173}174WAGNER.FullBoxBlurPass = function() {175 WAGNER.Pass.call( this );176 WAGNER.log( 'FullBoxBlurPass Pass constructor' );177 this.boxPass = new WAGNER.BoxBlurPass();178 this.params.amount = 20;179 this.params.taps = 1;180};181WAGNER.FullBoxBlurPass.prototype = Object.create( WAGNER.Pass.prototype );182WAGNER.FullBoxBlurPass.prototype.isLoaded = function() {183 if( this.boxPass.isLoaded() ) {184 this.loaded = true;185 }186 return WAGNER.Pass.prototype.isLoaded.call( this );187};188WAGNER.FullBoxBlurPass.prototype.run = function( c ) {189 var s = this.params.amount;190 this.boxPass.params.delta.set( s, 0 );191 this.boxPass.params.taps = this.params.taps;192 c.pass( this.boxPass );193 this.boxPass.params.delta.set( 0, s );194 c.pass( this.boxPass );195};196WAGNER.ZoomBlurPass = function() {197 WAGNER.Pass.call( this );198 WAGNER.log( 'ZoomBlurPass Pass constructor' );199 this.loadShader( 'zoom-blur-fs.glsl' );200 this.params.center = new THREE.Vector2( 0.5, 0.5 );201 this.params.strength = 2;202};203WAGNER.ZoomBlurPass.prototype = Object.create( WAGNER.Pass.prototype );204WAGNER.ZoomBlurPass.prototype.run = function( c ) {205 this.shader.uniforms.center.value.copy ( this.params.center );206 this.shader.uniforms.strength.value = this.params.strength;207 c.pass( this.shader );208};209WAGNER.MultiPassBloomPass = function( w, h ) {210 WAGNER.Pass.call( this );211 WAGNER.log( 'MultiPassBloomPass Pass constructor' );212 this.composer = null;213 this.tmpTexture = this.getOfflineTexture( w, h, true );214 this.blurPass = new WAGNER.FullBoxBlurPass();215 this.blendPass = new WAGNER.BlendPass();216 this.zoomBlur = new WAGNER.ZoomBlurPass();217 this.brightnessContrastPass = new WAGNER.BrightnessContrastPass();218 this.width = w || 512;219 this.height = h || 512;220 this.params.blurAmount = 20;221 this.params.applyZoomBlur = false;222 this.params.zoomBlurStrength = 2;223 this.params.useTexture = false;224 this.params.zoomBlurCenter = new THREE.Vector2( 0,0 );225 this.params.blendMode = WAGNER.BlendMode.Screen;226};227WAGNER.MultiPassBloomPass.prototype = Object.create( WAGNER.Pass.prototype );228WAGNER.MultiPassBloomPass.prototype.isLoaded = function() {229 if( this.blurPass.isLoaded() && 230 this.blendPass.isLoaded() &&231 this.zoomBlur.isLoaded() ) {232 this.loaded = true;233 }234 return WAGNER.Pass.prototype.isLoaded.call( this );235};236WAGNER.MultiPassBloomPass.prototype.run = function( c ) {237 if( !this.composer ) {238 this.composer = new WAGNER.Composer( c.renderer, { useRGBA: true } );239 this.composer.setSize( this.width, this.height );240 //this.composer.setSize( this.tmpTexture.width, this.tmpTexture.height );241 }242 /*var s = 0.5;243 if( c.width != this.tmpTexture.width / s || c.height != this.tmpTexture.height / s ) {244 this.tmpTexture = this.getOfflineTexture( c.width * s, c.height * s, true );245 this.composer.setSize( this.tmpTexture.width, this.tmpTexture.height );246 }*/247 this.composer.reset();248 if( this.params.useTexture === true ) {249 this.composer.setSource( this.params.glowTexture );250 } else {251 this.composer.setSource( c.output );252 /*this.brightnessContrastPass.params.brightness = -1;253 this.brightnessContrastPass.params.contrast = 5;254 this.composer.pass( this.brightnessContrastPass );*/255 }256 this.blurPass.params.amount = this.params.blurAmount;257 this.composer.pass( this.blurPass );258 259 if( this.params.applyZoomBlur ) {260 this.zoomBlur.params.center.set( .5 * this.composer.width, .5 * this.composer.height );261 this.zoomBlur.params.strength = this.params.zoomBlurStrength;262 this.composer.pass( this.zoomBlur );263 }264 if( this.params.useTexture === true ) {265 this.blendPass.params.mode = WAGNER.BlendMode.Screen;266 this.blendPass.params.tInput = this.params.glowTexture;267 c.pass( this.blendPass );268 }269 this.blendPass.params.mode = this.params.blendMode;270 this.blendPass.params.tInput2 = this.composer.output;271 c.pass( this.blendPass );272 273};274WAGNER.CGAPass = function() {275 WAGNER.Pass.call( this );276 WAGNER.log( 'CGA Pass constructor' );277 this.loadShader( 'cga-fs.glsl', function() {278 this.shader.uniforms.pixelDensity.value = window.devicePixelRatio;279 } );280};281WAGNER.CGAPass.prototype = Object.create( WAGNER.Pass.prototype );282WAGNER.SobelEdgeDetectionPass = function() {283 WAGNER.Pass.call( this );284 WAGNER.log( 'SobelEdgeDetectionPass Pass constructor' );285 this.loadShader( 'sobel-fs.glsl' );286};287WAGNER.SobelEdgeDetectionPass.prototype = Object.create( WAGNER.Pass.prototype );288WAGNER.FreiChenEdgeDetectionPass = function() {289 WAGNER.Pass.call( this );290 WAGNER.log( 'FreiChenEdgeDetectionPass Pass constructor' );291 this.loadShader( 'frei-chen-fs.glsl' );292};293WAGNER.FreiChenEdgeDetectionPass.prototype = Object.create( WAGNER.Pass.prototype );294WAGNER.DirtPass = function() {295 WAGNER.Pass.call( this );296 this.blendPass = new WAGNER.BlendPass();297 this.dirtTexture = THREE.ImageUtils.loadTexture( WAGNER.assetsPath + '/textures/dirt8.jpg' );298 this.params.blendMode = WAGNER.BlendMode.SoftLight;299};300WAGNER.DirtPass.prototype = Object.create( WAGNER.Pass.prototype );301WAGNER.DirtPass.prototype.isLoaded = function() {302 if( this.blendPass.isLoaded() ) {303 this.loaded = true;304 }305 return WAGNER.Pass.prototype.isLoaded.call( this );306};307WAGNER.DirtPass.prototype.run = function( c ) {308 this.blendPass.params.sizeMode = 1;309 this.blendPass.params.mode = this.params.blendMode;310 this.blendPass.params.tInput2 = this.dirtTexture;311 if( this.dirtTexture.image ) {312 this.blendPass.params.resolution2.set( this.dirtTexture.image.width, this.dirtTexture.image.height );313 this.blendPass.params.aspectRatio2 = this.dirtTexture.image.width / this.dirtTexture.image.height;314 }315 this.blendPass.params.aspectRatio = c.read.width / c.read.height;316 c.pass( this.blendPass );317};318WAGNER.GuidedBoxBlurPass = function() {319 WAGNER.Pass.call( this );320 WAGNER.log( 'GuidedBoxBlurPass Pass constructor' );321 this.loadShader( 'guided-box-blur2-fs.glsl' );322 this.params.tBias = null;323 this.params.delta = new THREE.Vector2( 1., 0 );324 this.params.invertBiasMap = false;325 this.params.isPacked = 0;326 this.params.from = 0;327 this.params.to = 1;328};329WAGNER.GuidedBoxBlurPass.prototype = Object.create( WAGNER.Pass.prototype );330WAGNER.GuidedBoxBlurPass.prototype.run = function( c ) {331 this.shader.uniforms.tBias.value = this.params.tBias,332 this.shader.uniforms.delta.value.copy( this.params.delta );333 this.shader.uniforms.delta.value.multiplyScalar( .0001 );334 this.shader.uniforms.invertBiasMap.value = this.params.invertBiasMap;335 this.shader.uniforms.isPacked.value = this.params.isPacked;336 this.shader.uniforms.from.value = this.params.from;337 this.shader.uniforms.to.value = this.params.to;338 c.pass( this.shader );339}340WAGNER.GuidedFullBoxBlurPass = function() {341 WAGNER.Pass.call( this );342 WAGNER.log( 'FullBoxBlurPass Pass constructor' );343 this.guidedBoxPass = new WAGNER.GuidedBoxBlurPass();344 this.params.tBias = null;345 this.params.invertBiasMap = false;346 this.params.isPacked = 0;347 this.params.amount = 10;348 this.params.from = 0;349 this.params.to = 1;350 this.params.taps = 1;351};352WAGNER.GuidedFullBoxBlurPass.prototype = Object.create( WAGNER.Pass.prototype );353WAGNER.GuidedFullBoxBlurPass.prototype.isLoaded = function() {354 if( this.guidedBoxPass.isLoaded() ) {355 this.loaded = true;356 }357 return WAGNER.Pass.prototype.isLoaded.call( this );358};359WAGNER.GuidedFullBoxBlurPass.prototype.run = function( c ) {360 this.guidedBoxPass.params.invertBiasMap = this.params.invertBiasMap;361 this.guidedBoxPass.params.isPacked = this.params.isPacked;362 this.guidedBoxPass.params.tBias = this.params.tBias;363 this.guidedBoxPass.params.from = this.params.from;364 this.guidedBoxPass.params.to = this.params.to;365 var s = this.params.amount;366 for( var j = 0; j < this.params.taps; j++ ) {367 this.guidedBoxPass.params.delta.set( s, 0 );368 c.pass( this.guidedBoxPass );369 this.guidedBoxPass.params.delta.set( 0, s );370 c.pass( this.guidedBoxPass );371 }372};373WAGNER.PixelatePass = function() {374 WAGNER.Pass.call( this );375 WAGNER.log( 'PixelatePass Pass constructor' );376 this.loadShader( 'pixelate-fs.glsl' );377 this.params.amount = 320;378};379WAGNER.PixelatePass.prototype = Object.create( WAGNER.Pass.prototype );380WAGNER.PixelatePass.prototype.run = function( c ) {381 this.shader.uniforms.amount.value = this.params.amount;382 c.pass( this.shader );383}384WAGNER.RGBSplitPass = function() {385 WAGNER.Pass.call( this );386 WAGNER.log( 'RGBSplitPass Pass constructor' );387 this.loadShader( 'rgb-split-fs.glsl', function() {388 } );389 this.params.delta = new THREE.Vector2();390};391WAGNER.RGBSplitPass.prototype = Object.create( WAGNER.Pass.prototype );392WAGNER.RGBSplitPass.prototype.run = function( c ) {393 this.shader.uniforms.delta.value.copy( this.params.delta );394 c.pass( this.shader );395}396/*397https://www.shadertoy.com/view/XssGz8398Simulates Chromatic Aberration by linearly interpolating blur-weights from red to green to blue.399Original idea by Kusma: https://github.com/kusma/vlee/blob/master/data/postprocess.fx400Barrel Blur forked from https://www.shadertoy.com/view/XslGz8401*/402WAGNER.ChromaticAberrationPass = function() {403 WAGNER.Pass.call( this );404 WAGNER.log( 'ChromaticAberrationPass Pass constructor' );405 this.loadShader( 'chromatic-aberration-fs.glsl' );406};407WAGNER.ChromaticAberrationPass.prototype = Object.create( WAGNER.Pass.prototype );408WAGNER.BarrelBlurPass = function() {409 WAGNER.Pass.call( this );410 WAGNER.log( 'BarrelBlurPass Pass constructor' );411 this.loadShader( 'barrel-blur-fs.glsl' );412};413WAGNER.BarrelBlurPass.prototype = Object.create( WAGNER.Pass.prototype );414WAGNER.OldVideoPass = function() {415 WAGNER.Pass.call( this );416 WAGNER.log( 'OldVideoPass Pass constructor' );417 this.loadShader( 'old-video-fs.glsl' );418};419WAGNER.OldVideoPass.prototype = Object.create( WAGNER.Pass.prototype );420WAGNER.DotScreenPass = function() {421 WAGNER.Pass.call( this );422 WAGNER.log( 'DotScreenPass Pass constructor' );423 this.loadShader( 'dot-screen-fs.glsl' );424};425WAGNER.DotScreenPass.prototype = Object.create( WAGNER.Pass.prototype );426WAGNER.PoissonDiscBlurPass = function() {427 WAGNER.Pass.call( this );428 WAGNER.log( 'PoissonDiscBlurPass Pass constructor' );429 this.loadShader( 'poisson-disc-blur-fs.glsl' );430};431WAGNER.PoissonDiscBlurPass.prototype = Object.create( WAGNER.Pass.prototype );432WAGNER.CircularBlurPass = function() {433 WAGNER.Pass.call( this );434 WAGNER.log( 'CircularBlurPass Pass constructor' );435 this.loadShader( 'circular-blur-fs.glsl' );436};437WAGNER.CircularBlurPass.prototype = Object.create( WAGNER.Pass.prototype );438WAGNER.ToonPass = function() {439 WAGNER.Pass.call( this );440 WAGNER.log( 'ToonPass Pass constructor' );441 this.loadShader( 'toon-fs.glsl' );442};443WAGNER.ToonPass.prototype = Object.create( WAGNER.Pass.prototype );444WAGNER.FXAAPass = function() {445 WAGNER.Pass.call( this );446 WAGNER.log( 'FXAA Pass constructor' );447 this.loadShader( 'fxaa-fs.glsl' );448};449WAGNER.FXAAPass.prototype = Object.create( WAGNER.Pass.prototype );450WAGNER.HighPassPass = function() {451 WAGNER.Pass.call( this );452 WAGNER.log( 'HighPass Pass constructor' );453 this.loadShader( 'high-pass-fs.glsl' );454};455WAGNER.HighPassPass.prototype = Object.create( WAGNER.Pass.prototype );456WAGNER.GrayscalePass = function() {457 WAGNER.Pass.call( this );458 WAGNER.log( 'GrayscalePass Pass constructor' );459 this.loadShader( 'grayscale-fs.glsl' );460};461WAGNER.GrayscalePass.prototype = Object.create( WAGNER.Pass.prototype );462WAGNER.ASCIIPass = function() {463 WAGNER.Pass.call( this );464 WAGNER.log( 'ASCIIPass Pass constructor' );465 this.loadShader( 'ascii-fs.glsl', function() {466 this.shader.uniforms.tAscii.value = THREE.ImageUtils.loadTexture( WAGNER.assetsPath + '/ascii/8x16_ascii_font_sorted.gif' );467 } );468};469WAGNER.ASCIIPass.prototype = Object.create( WAGNER.Pass.prototype );470WAGNER.LEDPass = function() {471 WAGNER.Pass.call( this );472 WAGNER.log( 'LEDPass Pass constructor' );473 this.loadShader( 'led-fs.glsl', function() {474 475 //this.shader.uniforms.noiseTexture.value = 1;476 } );477 this.params.pixelSize = 10;478 this.params.tolerance = .25;479 this.params.pixelRadius = .25;480 this.params.luminanceSteps = 100;481 this.params.luminanceBoost = .2;482 this.params.colorBoost = .01;483 this.params.burntOutPercent = 50;484};485WAGNER.LEDPass.prototype = Object.create( WAGNER.Pass.prototype );486WAGNER.LEDPass.prototype.run = function( c ) {487 this.shader.uniforms.pixelSize.value = this.params.pixelSize;488 this.shader.uniforms.tolerance.value = this.params.tolerance;489 this.shader.uniforms.pixelRadius.value = this.params.pixelRadius;490 this.shader.uniforms.luminanceSteps.value = this.params.luminanceSteps;491 this.shader.uniforms.luminanceBoost.value = this.params.luminanceBoost;492 this.shader.uniforms.colorBoost.value = this.params.colorBoost;493 this.shader.uniforms.burntOutPercent.value = this.params.burntOutPercent;494 c.pass( this.shader );495}496WAGNER.HalftonePass = function() {497 WAGNER.Pass.call( this );498 WAGNER.log( 'HalftonePass Pass constructor' );499 this.loadShader( 'halftone-fs.glsl', function() {500 this.shader.uniforms.pixelSize.value = 6;501 } );502};503WAGNER.HalftonePass.prototype = Object.create( WAGNER.Pass.prototype );504WAGNER.Halftone2Pass = function() {505 WAGNER.Pass.call( this );506 WAGNER.log( 'Halftone2Pass Pass constructor' );507 this.loadShader( 'halftone2-fs.glsl' );508 this.params.amount = 128;509 this.params.smoothness = .25;510};511WAGNER.Halftone2Pass.prototype = Object.create( WAGNER.Pass.prototype );512WAGNER.Halftone2Pass.prototype.run = function( c ) {513 this.shader.uniforms.amount.value = this.params.amount;514 this.shader.uniforms.smoothness.value = this.params.smoothness;515 c.pass( this.shader );516}517WAGNER.HalftoneCMYKPass = function() {518 WAGNER.Pass.call( this );519 WAGNER.log( 'HalftoneCMYKPass Pass constructor' );520 this.loadShader( 'halftone-cmyk-fs.glsl', function() {521 } );522};523WAGNER.HalftoneCMYKPass.prototype = Object.create( WAGNER.Pass.prototype );524WAGNER.CrossFadePass = function() {525 WAGNER.Pass.call( this );526 WAGNER.log( 'CrossFadePass Pass constructor' );527 this.loadShader( 'crossfade-fs.glsl' );528 this.params.tInput2 = null;529 this.params.tFadeMap = null;530 this.params.amount = 0;531};532WAGNER.CrossFadePass.prototype = Object.create( WAGNER.Pass.prototype );533WAGNER.CrossFadePass.prototype.run = function( c ) {534 this.shader.uniforms.tInput2.value = this.params.tInput2;535 this.shader.uniforms.tFadeMap.value = this.params.tFadeMap;536 this.shader.uniforms.amount.value = this.params.amount;537 c.pass( this.shader );538}539WAGNER.SSAOPass = function() {540 WAGNER.Pass.call( this );541 WAGNER.log( 'SSAOPass Pass constructor' );542 this.loadShader( 'ssao-fs.glsl', function( fs ) {543 544 /*this.shader.uniforms.pSphere.value = [545 new THREE.Vector3(-0.010735935, 0.01647018, 0.0062425877),546 new THREE.Vector3(-0.06533369, 0.3647007, -0.13746321),547 new THREE.Vector3(-0.6539235, -0.016726388, -0.53000957),548 new THREE.Vector3(0.40958285, 0.0052428036, -0.5591124),549 new THREE.Vector3(-0.1465366, 0.09899267, 0.15571679),550 new THREE.Vector3(-0.44122112, -0.5458797, 0.04912532),551 new THREE.Vector3(0.03755566, -0.10961345, -0.33040273),552 new THREE.Vector3(0.019100213, 0.29652783, 0.066237666),553 new THREE.Vector3(0.8765323, 0.011236004, 0.28265962),554 new THREE.Vector3(0.29264435, -0.40794238, 0.15964167)555 ];*/556 557 } );558 this.params.texture = null;559 this.params.isPacked = false;560 this.params.onlyOcclusion = false;561 this.blurPass = new WAGNER.FullBoxBlurPass();562 this.blendPass = new WAGNER.BlendPass();563 this.composer = null;564};565WAGNER.SSAOPass.prototype = Object.create( WAGNER.Pass.prototype );566WAGNER.SSAOPass.prototype.run = function( c ) {567 if( !this.composer ) {568 var s = 4;569 this.composer = new WAGNER.Composer( c.renderer, { useRGBA: true } );570 this.composer.setSize( c.width / s, c.height / s );571 }572 this.composer.reset();573 this.composer.setSource( c.output );574 this.shader.uniforms.tDepth.value = this.params.texture;575 //this.shader.uniforms.isPacked.value = this.params.isPacked;576 this.shader.uniforms.onlyOcclusion.value = this.params.onlyOcclusion;577 this.composer.pass( this.shader );578 this.blurPass.params.amount = .1;579 this.composer.pass( this.blurPass );580 if( this.params.onlyOcclusion ) {581 c.setSource( this.composer.output );582 } else { 583 this.blendPass.params.mode = WAGNER.BlendMode.Multiply;584 this.blendPass.params.tInput2 = this.composer.output;585 c.pass( this.blendPass );586 }587}588WAGNER.SimpleSSAOPass = function() {589 WAGNER.Pass.call( this );590 WAGNER.log( 'SimpleSSAOPass Pass constructor' );591 this.loadShader( 'ssao-simple-fs.glsl', function( fs ) {592 } );593 this.params.texture = null;594 this.params.onlyOcclusion = 0;595 this.params.zNear = 1;596 this.params.zFar = 10000;597 this.params.strength = 1;598};599WAGNER.SimpleSSAOPass.prototype = Object.create( WAGNER.Pass.prototype );600WAGNER.SimpleSSAOPass.prototype.run = function( c ) {601 this.shader.uniforms.tDepth.value = this.params.texture;602// this.shader.uniforms.onlyOcclusion.value = this.params.onlyOcclusion;603 this.shader.uniforms.zNear.value = this.params.zNear;604 this.shader.uniforms.zFar.value = this.params.zFar;605 this.shader.uniforms.strength.value = this.params.strength;606 c.pass( this.shader );607}608WAGNER.DirectionalBlurPass = function() {609 WAGNER.Pass.call( this );610 WAGNER.log( 'Directional Blur Pass constructor' );611 this.loadShader( 'guided-directional-blur-fs.glsl', function( fs ) {612 613 } );614 this.params.tBias = null;615 this.params.delta = .1;616}617WAGNER.DirectionalBlurPass.prototype = Object.create( WAGNER.Pass.prototype );618WAGNER.DirectionalBlurPass.prototype.run = function( c ) {619 this.shader.uniforms.tBias.value = this.params.tBias;620 this.shader.uniforms.delta.value = this.params.delta;621 c.pass( this.shader );622}623WAGNER.BleachPass = function() {624 WAGNER.Pass.call( this );625 WAGNER.log( 'Bleach Pass constructor' );626 this.loadShader( 'bleach-fs.glsl', function( fs ) {627 628 } );629 this.params.amount = 1;630}631WAGNER.BleachPass.prototype = Object.create( WAGNER.Pass.prototype );632WAGNER.BleachPass.prototype.run = function( c ) {633 this.shader.uniforms.amount.value = this.params.amount;634 c.pass( this.shader );635}636WAGNER.DOFPass = function() {637 WAGNER.Pass.call( this );638 WAGNER.log( 'DOFPass Pass constructor' );639 this.loadShader( 'dof-fs.glsl' );640 this.params.focalDistance = 0;641 this.params.aperture = .005;642 this.params.tBias = null;643 this.params.blurAmount = 1;644};645WAGNER.DOFPass.prototype = Object.create( WAGNER.Pass.prototype );646WAGNER.DOFPass.prototype.run = function( c ) {647 this.shader.uniforms.tBias.value = this.params.tBias;648 this.shader.uniforms.focalDistance.value = this.params.focalDistance;649 this.shader.uniforms.aperture.value = this.params.aperture;650 this.shader.uniforms.blurAmount.value = this.params.blurAmount;651 this.shader.uniforms.delta.value.set( 1, 0 );652 c.pass( this.shader );653 this.shader.uniforms.delta.value.set( 0, 1 );...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

...28 */29MajVj.frame.sandbox.load = function () {30 return new Promise(function (resolve, reject) {31 Promise.all([32 MajVj.loadShader('frame', 'sandbox', 'shaders.html', 'vertex'),33 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19291.0'),34 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18918.0'),35 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18922.0'),36 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18916.0'),37 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18713.0'),38 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18613.0'),39 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18568.0'),40 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18451.0'),41 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19297.0'),42 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18759.0'),43 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19336.0'),44 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18981.0'),45 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18543.2'),46 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19674.0'),47 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19624.0'),48 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18357.1'),49 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18794.0'),50 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '1674.0'),51 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19689.0'),52 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19528.0'),53 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19698.3'),54 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19454.0'),55 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '14282.0'),56 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '14373.1'),57 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19512.0'),58 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19150.0'),59 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '19136.0'),60 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18981.0'),61 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18873.0'),62 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18770.0'),63 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18760.0'),64 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18602.4'),65 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18602.4t'),66 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '18142.0'),67 MajVj.loadShader('frame', 'sandbox', 'shaders.html', '17945.0')68 ]).then(function (results) {69 MajVj.frame.sandbox._vertexShader = results[0];70 MajVj.frame.sandbox._fragmentShaders['19291.0'] = results[1];71 MajVj.frame.sandbox._fragmentShaders['18918.0'] = results[2];72 MajVj.frame.sandbox._fragmentShaders['18922.0'] = results[3];73 MajVj.frame.sandbox._fragmentShaders['18916.0'] = results[4];74 MajVj.frame.sandbox._fragmentShaders['18713.0'] = results[5];75 MajVj.frame.sandbox._fragmentShaders['18613.0'] = results[6];76 MajVj.frame.sandbox._fragmentShaders['18568.0'] = results[7];77 MajVj.frame.sandbox._fragmentShaders['18451.0'] = results[8];78 MajVj.frame.sandbox._fragmentShaders['19297.0'] = results[9];79 MajVj.frame.sandbox._fragmentShaders['18759.0'] = results[10];80 MajVj.frame.sandbox._fragmentShaders['19336.0'] = results[11];81 MajVj.frame.sandbox._fragmentShaders['18981.0'] = results[12];...

Full Screen

Full Screen

loadShader.js

Source:loadShader.js Github

copy

Full Screen

...6 const _friendlyFileLoadErrorStub = sinon.stub(p5, '_friendlyFileLoadError');7 try {8 await promisedSketch(function(sketch, resolve, reject) {9 sketch.preload = function() {10 sketch.loadShader(invalidFile, invalidFile, reject, resolve);11 };12 });13 expect(14 _friendlyFileLoadErrorStub.calledOnce,15 'p5._friendlyFileLoadError was not called'16 ).to.be.true;17 } finally {18 _friendlyFileLoadErrorStub.restore();19 }20 });21 testSketchWithPromise('error with vert prevents sketch continuing', function(22 sketch,23 resolve,24 reject25 ) {26 sketch.preload = function() {27 sketch.loadShader(invalidFile, fragFile);28 setTimeout(resolve, 50);29 };30 sketch.setup = function() {31 reject(new Error('Setup called'));32 };33 sketch.draw = function() {34 reject(new Error('Draw called'));35 };36 });37 testSketchWithPromise('error with frag prevents sketch continuing', function(38 sketch,39 resolve,40 reject41 ) {42 sketch.preload = function() {43 sketch.loadShader(vertFile, invalidFile);44 setTimeout(resolve, 50);45 };46 sketch.setup = function() {47 reject(new Error('Setup called'));48 };49 sketch.draw = function() {50 reject(new Error('Draw called'));51 };52 });53 testSketchWithPromise('error callback is called for vert', function(54 sketch,55 resolve,56 reject57 ) {58 sketch.preload = function() {59 sketch.loadShader(60 invalidFile,61 fragFile,62 function() {63 reject(new Error('Success callback executed.'));64 },65 function() {66 // Wait a bit so that if both callbacks are executed we will get an error.67 setTimeout(resolve, 50);68 }69 );70 };71 });72 testSketchWithPromise('error callback is called for frag', function(73 sketch,74 resolve,75 reject76 ) {77 sketch.preload = function() {78 sketch.loadShader(79 vertFile,80 invalidFile,81 function() {82 reject(new Error('Success callback executed.'));83 },84 function() {85 // Wait a bit so that if both callbacks are executed we will get an error.86 setTimeout(resolve, 50);87 }88 );89 };90 });91 testSketchWithPromise('loading correctly triggers setup', function(92 sketch,93 resolve,94 reject95 ) {96 sketch.preload = function() {97 sketch.loadShader(vertFile, fragFile);98 };99 sketch.setup = function() {100 resolve();101 };102 });103 testSketchWithPromise('success callback is called', function(104 sketch,105 resolve,106 reject107 ) {108 var hasBeenCalled = false;109 sketch.preload = function() {110 sketch.loadShader(111 vertFile,112 fragFile,113 function() {114 hasBeenCalled = true;115 },116 function(err) {117 reject(new Error('Error callback was entered: ' + err));118 }119 );120 };121 sketch.setup = function() {122 if (!hasBeenCalled) {123 reject(new Error('Setup called prior to success callback'));124 } else {125 setTimeout(resolve, 50);126 }127 };128 });129 test('returns an object with correct data', async function() {130 const shader = await promisedSketch(function(sketch, resolve, reject) {131 var _shader;132 sketch.preload = function() {133 _shader = sketch.loadShader(vertFile, fragFile, function() {}, reject);134 };135 sketch.setup = function() {136 resolve(_shader);137 };138 });139 assert.instanceOf(shader, p5.Shader);140 });141 test('passes an object with correct data to callback', async function() {142 const model = await promisedSketch(function(sketch, resolve, reject) {143 sketch.preload = function() {144 sketch.loadShader(vertFile, fragFile, resolve, reject);145 };146 });147 assert.instanceOf(model, p5.Shader);148 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1function loadShader(gl, type, source) {2 var shader = gl.createShader(type);3 gl.shaderSource(shader, source);4 gl.compileShader(shader);5 var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);6 if (success) {7 return shader;8 }9 console.log(gl.getShaderInfoLog(shader));10 gl.deleteShader(shader);11}12function createProgram(gl, vertexShader, fragmentShader) {13 var program = gl.createProgram();14 gl.attachShader(program, vertexShader);15 gl.attachShader(program, fragmentShader);16 gl.linkProgram(program);17 var success = gl.getProgramParameter(program, gl.LINK_STATUS);18 if (success) {19 return program;20 }21 console.log(gl.getProgramInfoLog(program));22 gl.deleteProgram(program);23}24function createBuffer(gl, data) {25 var buffer = gl.createBuffer();26 gl.bindBuffer(gl.ARRAY_BUFFER, buffer);27 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(data), gl.STATIC_DRAW);28 return buffer;29}30function bindBuffer(gl, buffer, size) {31 gl.bindBuffer(gl.ARRAY_BUFFER, buffer);32 gl.vertexAttribPointer(positionAttributeLocation, size, gl.FLOAT, false, 0, 0);33 gl.enableVertexAttribArray(positionAttributeLocation);34}35function drawArrays(gl){36 gl.drawArrays(gl.TRIANGLES, 0, 3);37}38function clear(gl){39 gl.clear(gl.COLOR_BUFFER_BIT);40}41var gl = canvas.getContext("webgl");42var vertexShader = loadShader(gl, gl.VERTEX_SHADER, vertexShaderSource);43var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);44var program = createProgram(gl, vertexShader, fragmentShader);45var positionAttributeLocation = gl.getAttribLocation(program, "a_position");46var positionBuffer = createBuffer(gl, positions);47gl.useProgram(program);48bindBuffer(gl, positionBuffer, 2);49drawArrays(gl);50clear(gl);51var width = gl.getParameter(gl.VIEWPORT)[2];52var height = gl.getParameter(gl.VIEWPORT)[3];

Full Screen

Using AI Code Generation

copy

Full Screen

1var canvas = document.getElementById("canvas");2var gl = canvas.getContext("webgl");3var vertexShader = loadShader(gl, "vertex", "vertexShader");4var fragmentShader = loadShader(gl, "fragment", "fragmentShader");5var program = gl.createProgram();6gl.attachShader(program, vertexShader);7gl.attachShader(program, fragmentShader);8gl.linkProgram(program);9if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {10 throw new Error("Could not link shaders");11}12gl.useProgram(program);13gl.clearColor(0.0, 0.0, 0.0, 1.0);14gl.clear(gl.COLOR_BUFFER_BIT);15gl.drawArrays(gl.POINTS, 0, 1);16function loadShader(gl, type, id) {17 var shader;18 if (type == "vertex") {19 shader = gl.createShader(gl.VERTEX_SHADER);20 } else if (type == "fragment") {21 shader = gl.createShader(gl.FRAGMENT_SHADER);22 } else {23 throw new Error("Unknown shader type");24 }25 gl.shaderSource(shader, document.getElementById(id).text);26 gl.compileShader(shader);27 if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {28 throw new Error(gl.getShaderInfoLog(shader));29 }30 return shader;31}32var vertexShaderSource = "";33var fragmentShaderSource = "";34var vertexShader;35var fragmentShader;36var program;37var gl;38var canvas;39window.onload = function() {40 canvas = document.getElementById("canvas");41 gl = canvas.getContext("webgl");42 vertexShaderSource = loadShader("vertexShader");43 fragmentShaderSource = loadShader("fragmentShader");44 vertexShader = createShader(gl, vertexShaderSource, gl.VERTEX_SHADER);45 fragmentShader = createShader(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);46 program = createProgram(gl, vertexShader, fragmentShader);47 gl.useProgram(program);

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const path = require('path');3wptools.loadShader(path.join(__dirname, 'shader.frag'), (err, shader) => {4 if (err) {5 console.error(err);6 return;7 }8 console.log(shader);9});10out vec4 FragColor;11void main()12{13 FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);14}15const wptools = require('wptools');16const path = require('path');17wptools.loadShader(path.join(__dirname, 'shader.frag'), (err, shader) => {18 if (err) {19 console.error(err);20 return;21 }22 const program = wptools.createShaderProgram(shader, shader);23 wptools.useProgram(program);24});25out vec4 FragColor;26void main()27{28 FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);29}

Full Screen

Using AI Code Generation

copy

Full Screen

1var shader = loadShader('shader.vert', 'shader.frag');2var shader = loadShader('shader.vert', 'shader.frag');3var shader = loadShader('shader.vert', 'shader.frag');4var shader = loadShader('shader.vert', 'shader.frag');5var shader = loadShader('shader.vert', 'shader.frag');6var shader = loadShader('shader.vert', 'shader.frag');7var shader = loadShader('shader.vert', 'shader.frag');8var shader = loadShader('shader.vert', 'shader.frag');9var shader = loadShader('shader.vert', 'shader.frag');10var shader = loadShader('shader.vert', 'shader.frag');11var shader = loadShader('shader.vert', 'shader.frag');12var shader = loadShader('shader.vert', 'shader.frag');13var shader = loadShader('shader.vert', 'shader.frag');14var shader = loadShader('shader.vert', 'shader.frag');15var shader = loadShader('shader.vert', 'shader.frag');16var shader = loadShader('shader.vert', 'shader.frag');17var shader = loadShader('shader.vert', 'shader.f

Full Screen

Using AI Code Generation

copy

Full Screen

1var vertexShader = loadShader("shaders/vertex.glsl", gl.VERTEX_SHADER);2var fragmentShader = loadShader("shaders/fragment.glsl", gl.FRAGMENT_SHADER);3var program = gl.createProgram();4gl.attachShader(program, vertexShader);5gl.attachShader(program, fragmentShader);6gl.linkProgram(program);7if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {8 alert("Could not initialize shaders");9}10gl.useProgram(program);11var vertexPositionAttribute = gl.getAttribLocation(program, "aVertexPosition");12var vertexColorAttribute = gl.getAttribLocation(program, "aVertexColor");13var pMatrixUniform = gl.getUniformLocation(program, "uPMatrix");14var mvMatrixUniform = gl.getUniformLocation(program, "uMVMatrix");15var cubeVertexPositionBuffer = gl.createBuffer();16var cubeVertexColorBuffer = gl.createBuffer();17var cubeVertexIndexBuffer = gl.createBuffer();18gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer);

Full Screen

Using AI Code Generation

copy

Full Screen

1var shader = loadShader('shader.vert', 'shader.frag');2var shader = loadShader('shader.vert', 'shader.frag');3var shader = loadShader('shader.vert', 'shader.frag');4var shader = loadShader('shader.vert', 'shader.frag');5var shader = loadShader('shader.vert', 'shader.frag');6var shader = loadShader('shader.vert', 'shader.frag');7var shader = loadShader('shader.vert', 'shader.frag');8var shader = loadShader('shader.vert', 'shader.frag');9var shader = loadShader('shader.vert', 'shader.frag');10var shader = loadShader('shader.vert', 'shader.frag');11var shader = loadShader('shader.vert', 'shader.frag');12var shader = loadShader('shader.vert', 'shader.frag');13var shader = loadShader('shader.vert', 'shader.frag');14var shader = loadShader('shader.vert', 'shader.frag');15var shader = loadShader('shader.vert', 'shader.frag');16var shader = loadShader('shader.vert', 'shader.frag');17var shader = loadShader('shader.vert', 'shader.f

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const path = require('path');3wptools.loadShader(path.join(__dirname, 'shader.frag'), (err, shader) => {4 if (err) {5 console.error(err);6 return;7 }8 console.log(shader);9});10out vec4 FragColor;11void main()12{13 FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);14}15const wptools = require('wptools');16const path = require('path');17wptools.loadShader(path.join(__dirname, 'shader.frag'), (err, shader) => {18 if (err) {19 console.error(err);20 return;21 }22 const program = wptools.createShaderProgram(shader, shader);23 wptools.useProgram(program);24});25out vec4 FragColor;26void main()27{28 FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);29}

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools.js');2wptools.loadShader("shader.frag", function(data) {3 console.log(data);4});5attribute vec4 a_position;6attribute vec4 a_normal;7attribute vec4 a_color;8attribute vec2 a_texCoord;9attribute vec4 a_texCoord1;10attribute vec4 a_texCoord2;11attribute vec4 a_texCoord3;12attribute vec4 a_texCoord4;13attribute vec4 a_texCoord5;14attribute vec4 a_texCoord6;15attribute vec4 a_texCoord7;16attribute vec4 a_texCoord8;17attribute vec4 a_texCoord9;18attribute vec4 a_texCoord10;19attribute vec4 a_texCoord11;20attribute vec4 a_texCoord12;21attribute vec4 a_texCoord13;22attribute vec4 a_texCoord14;23attribute vec4 a_texCoord15;24attribute vec4 a_texCoord16;25attribute vec4 a_texCoord17;26attribute vec4 a_texCoord18;27attribute vec4 a_texCoord19;28attribute vec4 a_texCoord20;29attribute vec4 a_texCoord21;30attribute vec4 a_texCoord22;31attribute vec4 a_texCoord23;32attribute vec4 a_texCoord24;33attribute vec4 a_texCoord25;34attribute vec4 a_texCoord26;35attribute vec4 a_texCoord27;36attribute vec4 a_texCoord28;37attribute vec4 a_texCoord29;38attribute vec4 a_texCoord30;39attribute vec4 a_texCoord31;40attribute vec4 a_texCoord32;41attribute vec4 a_texCoord33;42attribute vec4 a_texCoord34;43attribute vec4 a_texCoord35;44attribute vec4 a_texCoord36;45attribute vec4 a_texCoord37;46attribute vec4 a_texCoord38;47attribute vec4 a_texCoord39;48attribute vec4 a_texCoord40;49attribute vec4 a_texCoord41;50attribute vec4 a_texCoord42;51attribute vec4 a_texCoord43;52attribute vec4 a_texCoord44;53attribute vec4 a_texCoord45;54attribute vec4 a_texCoord46;55attribute vec4 a_texCoord47;56attribute vec4 a_texCoord48;57attribute vec4 a_texCoord49;58attribute vec4 a_texCoord50;59attribute vec4 a_texCoord51;60attribute vec4 a_texCoord52;61attribute vec4 a_texCoord53;62attribute vec4 a_texCoord54;

Full Screen

Using AI Code Generation

copy

Full Screen

1wptc.loadShader("shader.vert", "vertex", "vertexShader", function(){2});3wptc.loadShader("shader.frag", "fragment", "fragmentShader", function(){4});5wptc.loadShader("shader.vert", "vertex", "vertexShader", function(){6});7wptc.loadShader("shader.frag", "fragment", "fragmentShader", function(){8});9wptc.createProgram("program", "vertexShader", "fragmentShader");10wptc.createBuffer("buffer", vertices, "float", "array");11wptc.createVAO("vao", "buffer", "program");12wptc.render("vao", "program", "triangle");

Full Screen

Using AI Code Generation

copy

Full Screen

1var shaderProgram = wptoolkit.loadShader("shader-vs", "shader-fs");2var aVertexPosition = gl.getAttribLocation(shaderProgram, "aVertexPosition");3var aVertexColor = gl.getAttribLocation(shaderProgram, "aVertexColor");4var uMVMatrix = gl.getUniformLocation(shaderProgram, "uMVMatrix");5var uPMatrix = gl.getUniformLocation(shaderProgram, "uPMatrix");6var vertexBuffer = gl.createBuffer();7gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);8var vertexArray = new Float32Array([9 ]);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful