mirror of
https://github.com/FMS-Cat/condition.git
synced 2025-08-20 04:11:41 +02:00
fix: adopt with the latest version of glcat-ts
This commit is contained in:
@@ -25,7 +25,7 @@ export class Antialias extends Entity {
|
|||||||
fxaaFrag,
|
fxaaFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
material.addUniformTexture( 'sampler0', options.input.texture );
|
material.addUniformTextures( 'sampler0', options.input.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -52,7 +52,7 @@ export class BigBlur extends Entity {
|
|||||||
bigBlurFrag,
|
bigBlurFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
materialH.addUniformTexture( 'sampler0', options.input.texture );
|
materialH.addUniformTextures( 'sampler0', options.input.texture );
|
||||||
|
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
module.hot.accept( '../shaders/big-blur.frag', () => {
|
module.hot.accept( '../shaders/big-blur.frag', () => {
|
||||||
@@ -76,7 +76,7 @@ export class BigBlur extends Entity {
|
|||||||
initOptions: { geometry: quadGeometry, target: dummyRenderTarget }
|
initOptions: { geometry: quadGeometry, target: dummyRenderTarget }
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
materialV.addUniformTexture( 'sampler0', targetH.texture );
|
materialV.addUniformTextures( 'sampler0', targetH.texture );
|
||||||
|
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
module.hot.accept( '../shaders/big-blur.frag', () => {
|
module.hot.accept( '../shaders/big-blur.frag', () => {
|
||||||
|
@@ -54,7 +54,7 @@ export class Bloom extends Entity {
|
|||||||
);
|
);
|
||||||
|
|
||||||
material.addUniform( 'level', '1f', i );
|
material.addUniform( 'level', '1f', i );
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler0',
|
'sampler0',
|
||||||
isFirst ? options.input.texture : swap.i.texture,
|
isFirst ? options.input.texture : swap.i.texture,
|
||||||
);
|
);
|
||||||
@@ -88,7 +88,7 @@ export class Bloom extends Entity {
|
|||||||
);
|
);
|
||||||
|
|
||||||
material.addUniform( 'level', '1f', i );
|
material.addUniform( 'level', '1f', i );
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler0',
|
'sampler0',
|
||||||
swap.i.texture,
|
swap.i.texture,
|
||||||
);
|
);
|
||||||
|
@@ -123,7 +123,7 @@ export class Condition extends Entity {
|
|||||||
const materials = { cubemap, deferred };
|
const materials = { cubemap, deferred };
|
||||||
|
|
||||||
objectValuesMap( materials, ( material ) => {
|
objectValuesMap( materials, ( material ) => {
|
||||||
material.addUniformTexture( 'samplerSvg', texture );
|
material.addUniformTextures( 'samplerSvg', texture );
|
||||||
|
|
||||||
auto( 'Condition/phaseWidth', ( { value } ) => {
|
auto( 'Condition/phaseWidth', ( { value } ) => {
|
||||||
material.addUniform( 'phaseWidth', '1f', value );
|
material.addUniform( 'phaseWidth', '1f', value );
|
||||||
|
@@ -33,8 +33,8 @@ export class DVi extends Entity {
|
|||||||
dviFrag,
|
dviFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
material.addUniformTexture( 'sampler0', options.input.texture );
|
material.addUniformTextures( 'sampler0', options.input.texture );
|
||||||
material.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
material.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -79,13 +79,13 @@ export class DeferredCamera extends Entity {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
for ( let i = 0; i < 2; i ++ ) { // it doesn't need 2 and 3
|
for ( let i = 0; i < 2; i ++ ) { // it doesn't need 2 and 3
|
||||||
aoMaterial.addUniformTexture(
|
aoMaterial.addUniformTextures(
|
||||||
'sampler' + i,
|
'sampler' + i,
|
||||||
this.cameraTarget.getTexture( gl.COLOR_ATTACHMENT0 + i )
|
this.cameraTarget.getTexture( gl.COLOR_ATTACHMENT0 + i )!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
aoMaterial.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
aoMaterial.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
const aoQuad = new Quad( {
|
const aoQuad = new Quad( {
|
||||||
material: aoMaterial,
|
material: aoMaterial,
|
||||||
@@ -146,16 +146,16 @@ export class DeferredCamera extends Entity {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
for ( let i = 0; i < 4; i ++ ) {
|
for ( let i = 0; i < 4; i ++ ) {
|
||||||
shadingMaterial.addUniformTexture(
|
shadingMaterial.addUniformTextures(
|
||||||
'sampler' + i,
|
'sampler' + i,
|
||||||
this.cameraTarget.getTexture( gl.COLOR_ATTACHMENT0 + i )
|
this.cameraTarget.getTexture( gl.COLOR_ATTACHMENT0 + i )!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
shadingMaterial.addUniformTexture( 'samplerAo', aoTarget.texture );
|
shadingMaterial.addUniformTextures( 'samplerAo', aoTarget.texture );
|
||||||
shadingMaterial.addUniformTexture( 'samplerIBLLUT', options.textureIBLLUT );
|
shadingMaterial.addUniformTextures( 'samplerIBLLUT', options.textureIBLLUT );
|
||||||
shadingMaterial.addUniformTexture( 'samplerEnv', options.textureEnv );
|
shadingMaterial.addUniformTextures( 'samplerEnv', options.textureEnv );
|
||||||
shadingMaterial.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
shadingMaterial.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
this.components.push(
|
this.components.push(
|
||||||
this.camera,
|
this.camera,
|
||||||
|
@@ -53,8 +53,8 @@ export class EnvironmentMap extends Entity {
|
|||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
materialIntegrate.addUniform( 'uniformSeed', '4f', rng.gen(), rng.gen(), rng.gen(), rng.gen() );
|
materialIntegrate.addUniform( 'uniformSeed', '4f', rng.gen(), rng.gen(), rng.gen(), rng.gen() );
|
||||||
materialIntegrate.addUniformTexture( 'sampler0', swap.i.texture );
|
materialIntegrate.addUniformTextures( 'sampler0', swap.i.texture );
|
||||||
materialIntegrate.addUniformCubemap( 'samplerCubemap', cubemap.texture );
|
materialIntegrate.addUniformTextures( 'samplerCubemap', cubemap.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
@@ -78,7 +78,7 @@ export class EnvironmentMap extends Entity {
|
|||||||
environmentMapMergeFrag,
|
environmentMapMergeFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
materialMerge.addUniformTexture( 'sampler0', swap.i.texture );
|
materialMerge.addUniformTextures( 'sampler0', swap.i.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -30,7 +30,7 @@ export class FlickyParticles extends Entity {
|
|||||||
|
|
||||||
materialCompute.addUniform( 'particlesSqrt', '1f', PARTICLES_SQRT );
|
materialCompute.addUniform( 'particlesSqrt', '1f', PARTICLES_SQRT );
|
||||||
materialCompute.addUniform( 'particles', '1f', PARTICLES );
|
materialCompute.addUniform( 'particles', '1f', PARTICLES );
|
||||||
materialCompute.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
materialCompute.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
@@ -91,7 +91,7 @@ export class FlickyParticles extends Entity {
|
|||||||
const materialsRender = { forward, cubemap: forward, depth };
|
const materialsRender = { forward, cubemap: forward, depth };
|
||||||
|
|
||||||
objectValuesMap( materialsRender, ( material ) => {
|
objectValuesMap( materialsRender, ( material ) => {
|
||||||
material.addUniformTexture( 'samplerRandomStatic', randomTextureStatic.texture );
|
material.addUniformTextures( 'samplerRandomStatic', randomTextureStatic.texture );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
|
@@ -85,15 +85,15 @@ export class GPUParticles extends Entity {
|
|||||||
for ( let i = 0; i < computeNumBuffers; i ++ ) {
|
for ( let i = 0; i < computeNumBuffers; i ++ ) {
|
||||||
const attachment = gl.COLOR_ATTACHMENT0 + i;
|
const attachment = gl.COLOR_ATTACHMENT0 + i;
|
||||||
|
|
||||||
materialCompute.addUniformTexture(
|
materialCompute.addUniformTextures(
|
||||||
`samplerCompute${ i }`,
|
`samplerCompute${ i }`,
|
||||||
swapCompute.i.getTexture( attachment )
|
swapCompute.i.getTexture( attachment )!
|
||||||
);
|
);
|
||||||
|
|
||||||
objectValuesMap( materialsRender, ( material ) => {
|
objectValuesMap( materialsRender, ( material ) => {
|
||||||
material?.addUniformTexture(
|
material?.addUniformTextures(
|
||||||
`samplerCompute${ i }`,
|
`samplerCompute${ i }`,
|
||||||
swapCompute.o.getTexture( attachment )
|
swapCompute.o.getTexture( attachment )!
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ export class Glitch extends Entity {
|
|||||||
glitchFrag,
|
glitchFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
this.material.addUniformTexture( 'sampler0', options.input.texture );
|
this.material.addUniformTextures( 'sampler0', options.input.texture );
|
||||||
|
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
module.hot.accept( '../shaders/glitch.frag', () => {
|
module.hot.accept( '../shaders/glitch.frag', () => {
|
||||||
|
@@ -125,7 +125,7 @@ const spritesheets = styles.map( ( style, iStyle ) => {
|
|||||||
let texture: GLCatTexture = textureSpriteSheet;
|
let texture: GLCatTexture = textureSpriteSheet;
|
||||||
|
|
||||||
( style.preprocessorMaterials ?? [] ).map( ( material, i ) => {
|
( style.preprocessorMaterials ?? [] ).map( ( material, i ) => {
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler0',
|
'sampler0',
|
||||||
i === 0 ? textureSpriteSheet : swapIntermediate.o.texture,
|
i === 0 ? textureSpriteSheet : swapIntermediate.o.texture,
|
||||||
);
|
);
|
||||||
@@ -144,7 +144,7 @@ const spritesheets = styles.map( ( style, iStyle ) => {
|
|||||||
name: process.env.DEV && `Greetings/spriteSheet${ iStyle }`,
|
name: process.env.DEV && `Greetings/spriteSheet${ iStyle }`,
|
||||||
} );
|
} );
|
||||||
|
|
||||||
materialBlurH.addUniformTexture( 'sampler0', texture );
|
materialBlurH.addUniformTextures( 'sampler0', texture );
|
||||||
|
|
||||||
quadPreprocessor.material = materialBlurH;
|
quadPreprocessor.material = materialBlurH;
|
||||||
quadPreprocessor.target = dest;
|
quadPreprocessor.target = dest;
|
||||||
@@ -263,7 +263,7 @@ export class Greetings extends Entity {
|
|||||||
|
|
||||||
const materials = { forward };
|
const materials = { forward };
|
||||||
|
|
||||||
forward.addUniformTextureArray( 'samplerSpriteSheets', spritesheets );
|
forward.addUniformTextures( 'samplerSpriteSheets', ...spritesheets );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -49,7 +49,7 @@ export class IBLLUT extends Entity {
|
|||||||
);
|
);
|
||||||
material.addUniform( 'samples', '1f', samples );
|
material.addUniform( 'samples', '1f', samples );
|
||||||
material.addUniform( 'vdc', '1f', vdc( samples, 2.0 ) );
|
material.addUniform( 'vdc', '1f', vdc( samples, 2.0 ) );
|
||||||
material.addUniformTexture( 'sampler0', this.swap.i.texture );
|
material.addUniformTextures( 'sampler0', this.swap.i.texture );
|
||||||
|
|
||||||
const quad = new Quad( {
|
const quad = new Quad( {
|
||||||
target: this.swap.o,
|
target: this.swap.o,
|
||||||
@@ -68,7 +68,7 @@ export class IBLLUT extends Entity {
|
|||||||
} else {
|
} else {
|
||||||
material.addUniform( 'samples', '1f', samples );
|
material.addUniform( 'samples', '1f', samples );
|
||||||
material.addUniform( 'vdc', '1f', vdc( samples, 2.0 ) );
|
material.addUniform( 'vdc', '1f', vdc( samples, 2.0 ) );
|
||||||
material.addUniformTexture( 'sampler0', this.swap.i.texture );
|
material.addUniformTextures( 'sampler0', this.swap.i.texture );
|
||||||
|
|
||||||
quad.target = this.swap.o;
|
quad.target = this.swap.o;
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ export class LightEntity extends Entity {
|
|||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
material.addUniform( 'isVert', '1i', i );
|
material.addUniform( 'isVert', '1i', i );
|
||||||
material.addUniformTexture( 'sampler0', swap.i.texture );
|
material.addUniformTextures( 'sampler0', swap.i.texture );
|
||||||
|
|
||||||
this.components.push( new Quad( {
|
this.components.push( new Quad( {
|
||||||
target: swap.o,
|
target: swap.o,
|
||||||
|
@@ -49,8 +49,8 @@ export class LightShaft extends Entity {
|
|||||||
|
|
||||||
forward.addUniform( 'intensity', '1f', intensity ?? 0.01 );
|
forward.addUniform( 'intensity', '1f', intensity ?? 0.01 );
|
||||||
|
|
||||||
forward.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
forward.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
forward.addUniformTexture( 'samplerShadow', light.shadowMap.texture );
|
forward.addUniformTextures( 'samplerShadow', light.shadowMap.texture );
|
||||||
|
|
||||||
const materials = { forward };
|
const materials = { forward };
|
||||||
|
|
||||||
@@ -95,6 +95,6 @@ export class LightShaft extends Entity {
|
|||||||
* どうやってフレームバッファのデプスを取るかわかりませんでした 許してほしい
|
* どうやってフレームバッファのデプスを取るかわかりませんでした 許してほしい
|
||||||
*/
|
*/
|
||||||
public setDefferedCameraTarget( deferredCameraTarget: BufferRenderTarget ): void {
|
public setDefferedCameraTarget( deferredCameraTarget: BufferRenderTarget ): void {
|
||||||
this.__forward.addUniformTexture( 'samplerDeferred0', deferredCameraTarget.texture );
|
this.__forward.addUniformTextures( 'samplerDeferred0', deferredCameraTarget.texture );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,7 @@ export class Phantom extends Entity {
|
|||||||
);
|
);
|
||||||
|
|
||||||
forward.addUniform( 'range', '4f', -1.0, -1.0, 1.0, 1.0 );
|
forward.addUniform( 'range', '4f', -1.0, -1.0, 1.0, 1.0 );
|
||||||
forward.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
forward.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV && module.hot ) {
|
if ( process.env.DEV && module.hot ) {
|
||||||
module.hot.accept( [ '../shaders/phantom.frag' ], () => {
|
module.hot.accept( [ '../shaders/phantom.frag' ], () => {
|
||||||
@@ -76,6 +76,6 @@ export class Phantom extends Entity {
|
|||||||
* どうやってフレームバッファのデプスを取るかわかりませんでした 許してほしい
|
* どうやってフレームバッファのデプスを取るかわかりませんでした 許してほしい
|
||||||
*/
|
*/
|
||||||
public setDefferedCameraTarget( deferredCameraTarget: BufferRenderTarget ): void {
|
public setDefferedCameraTarget( deferredCameraTarget: BufferRenderTarget ): void {
|
||||||
this.__forward.addUniformTexture( 'samplerDeferred0', deferredCameraTarget.texture );
|
this.__forward.addUniformTextures( 'samplerDeferred0', deferredCameraTarget.texture );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,11 +81,11 @@ export class PixelSorter extends Entity {
|
|||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
material.addUniform( 'mul', '1f', mul );
|
material.addUniform( 'mul', '1f', mul );
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler0',
|
'sampler0',
|
||||||
options.input.texture,
|
options.input.texture,
|
||||||
);
|
);
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler1',
|
'sampler1',
|
||||||
this.swapBuffer.o.texture,
|
this.swapBuffer.o.texture,
|
||||||
);
|
);
|
||||||
@@ -118,11 +118,11 @@ export class PixelSorter extends Entity {
|
|||||||
);
|
);
|
||||||
material.addUniform( 'dir', '1f', dir );
|
material.addUniform( 'dir', '1f', dir );
|
||||||
material.addUniform( 'comp', '1f', comp );
|
material.addUniform( 'comp', '1f', comp );
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler0',
|
'sampler0',
|
||||||
( isFirst ? options.input : this.swapBuffer.o ).texture,
|
( isFirst ? options.input : this.swapBuffer.o ).texture,
|
||||||
);
|
);
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler1',
|
'sampler1',
|
||||||
bufferIndex.texture,
|
bufferIndex.texture,
|
||||||
);
|
);
|
||||||
|
@@ -45,8 +45,8 @@ export class Post extends Entity {
|
|||||||
postFrag,
|
postFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
material.addUniformTexture( 'sampler0', options.input.texture );
|
material.addUniformTextures( 'sampler0', options.input.texture );
|
||||||
material.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
material.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -133,8 +133,8 @@ export class RTInspector extends Entity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const texture = target.getTexture( attachment );
|
const texture = target.getTexture( attachment )!;
|
||||||
this.materialSingle.addUniformTexture( 'sampler0', texture );
|
this.materialSingle.addUniformTextures( 'sampler0', texture );
|
||||||
|
|
||||||
this.entitySingle.active = true;
|
this.entitySingle.active = true;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -30,7 +30,7 @@ export class Racer extends Entity {
|
|||||||
|
|
||||||
materialCompute.addUniform( 'trails', '1f', TRAILS );
|
materialCompute.addUniform( 'trails', '1f', TRAILS );
|
||||||
materialCompute.addUniform( 'trailLength', '1f', TRAIL_LENGTH );
|
materialCompute.addUniform( 'trailLength', '1f', TRAIL_LENGTH );
|
||||||
materialCompute.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
materialCompute.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -56,16 +56,16 @@ export class SSR extends Entity {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
material.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
material.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
for ( let i = 0; i < 4; i ++ ) {
|
for ( let i = 0; i < 4; i ++ ) {
|
||||||
material.addUniformTexture(
|
material.addUniformTextures(
|
||||||
'sampler' + i,
|
'sampler' + i,
|
||||||
options.camera.cameraTarget.getTexture( gl.COLOR_ATTACHMENT0 + i )
|
options.camera.cameraTarget.getTexture( gl.COLOR_ATTACHMENT0 + i )!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
material.addUniformTexture( 'samplerShaded', options.shaded.texture );
|
material.addUniformTextures( 'samplerShaded', options.shaded.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -55,8 +55,8 @@ export class Serial extends Entity {
|
|||||||
serialEncodeFrag,
|
serialEncodeFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
materialEncode.addUniformTexture( 'sampler0', options.input.texture );
|
materialEncode.addUniformTextures( 'sampler0', options.input.texture );
|
||||||
materialEncode.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
materialEncode.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
@@ -84,8 +84,8 @@ export class Serial extends Entity {
|
|||||||
serialDecodeFrag,
|
serialDecodeFrag,
|
||||||
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
{ initOptions: { geometry: quadGeometry, target: dummyRenderTarget } },
|
||||||
);
|
);
|
||||||
materialDecode.addUniformTexture( 'sampler0', bufferEncode.texture );
|
materialDecode.addUniformTextures( 'sampler0', bufferEncode.texture );
|
||||||
materialDecode.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
materialDecode.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -29,7 +29,7 @@ export class SphereParticles extends Entity {
|
|||||||
|
|
||||||
materialCompute.addUniform( 'particlesSqrt', '1f', PARTICLES_SQRT );
|
materialCompute.addUniform( 'particlesSqrt', '1f', PARTICLES_SQRT );
|
||||||
materialCompute.addUniform( 'particles', '1f', PARTICLES );
|
materialCompute.addUniform( 'particles', '1f', PARTICLES );
|
||||||
materialCompute.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
materialCompute.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
@@ -88,8 +88,8 @@ export class SphereParticles extends Entity {
|
|||||||
|
|
||||||
const materialsRender = { deferred, depth };
|
const materialsRender = { deferred, depth };
|
||||||
|
|
||||||
deferred.addUniformTexture( 'samplerRandomStatic', randomTextureStatic.texture );
|
deferred.addUniformTextures( 'samplerRandomStatic', randomTextureStatic.texture );
|
||||||
depth.addUniformTexture( 'samplerRandomStatic', randomTextureStatic.texture );
|
depth.addUniformTextures( 'samplerRandomStatic', randomTextureStatic.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -94,8 +94,8 @@ export class SufferTexts extends Entity {
|
|||||||
|
|
||||||
const materialsRender = { forward };
|
const materialsRender = { forward };
|
||||||
|
|
||||||
forward.addUniformTexture( 'samplerRandomStatic', randomTextureStatic.texture );
|
forward.addUniformTextures( 'samplerRandomStatic', randomTextureStatic.texture );
|
||||||
forward.addUniformTexture( 'samplerTinyChar', tinyCharTexture );
|
forward.addUniformTextures( 'samplerTinyChar', tinyCharTexture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -26,7 +26,7 @@ export class TestScreen extends Entity {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
material.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
material.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
|
@@ -59,8 +59,8 @@ export class Tetrahedron extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
objectValuesMap( materials, ( material ) => {
|
objectValuesMap( materials, ( material ) => {
|
||||||
material.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
material.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
material.addUniformTexture( 'samplerRandomStatic', randomTextureStatic.texture );
|
material.addUniformTextures( 'samplerRandomStatic', randomTextureStatic.texture );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// -- updater ----------------------------------------------------------------------------------
|
// -- updater ----------------------------------------------------------------------------------
|
||||||
|
@@ -79,7 +79,7 @@ export class TextOverlay extends Entity {
|
|||||||
blend: [ gl.ONE, gl.ONE ],
|
blend: [ gl.ONE, gl.ONE ],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
material.addUniformTexture( 'sampler0', textures[ 0 ] );
|
material.addUniformTextures( 'sampler0', textures[ 0 ] );
|
||||||
|
|
||||||
if ( process.env.DEV ) {
|
if ( process.env.DEV ) {
|
||||||
if ( module.hot ) {
|
if ( module.hot ) {
|
||||||
@@ -98,7 +98,7 @@ export class TextOverlay extends Entity {
|
|||||||
|
|
||||||
// -- auto -------------------------------------------------------------------------------------
|
// -- auto -------------------------------------------------------------------------------------
|
||||||
auto( 'TextOverlay/texture', ( { value } ) => {
|
auto( 'TextOverlay/texture', ( { value } ) => {
|
||||||
material.addUniformTexture( 'sampler0', textures[ value ] );
|
material.addUniformTextures( 'sampler0', textures[ value ] );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
auto( 'TextOverlay/amp', ( { value } ) => {
|
auto( 'TextOverlay/amp', ( { value } ) => {
|
||||||
|
@@ -62,8 +62,8 @@ export class Wobbleball extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
objectValuesMap( materials, ( material ) => {
|
objectValuesMap( materials, ( material ) => {
|
||||||
material.addUniformTexture( 'samplerRandom', randomTexture.texture );
|
material.addUniformTextures( 'samplerRandom', randomTexture.texture );
|
||||||
material.addUniformTexture( 'samplerRandomStatic', randomTextureStatic.texture );
|
material.addUniformTextures( 'samplerRandomStatic', randomTextureStatic.texture );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// -- updater ----------------------------------------------------------------------------------
|
// -- updater ----------------------------------------------------------------------------------
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { GLCatProgram, GLCatProgramLinkOptions, GLCatProgramUniformMatrixVectorType, GLCatProgramUniformType, GLCatProgramUniformVectorType, GLCatTexture, GLCatTextureCubemap } from '@fms-cat/glcat-ts';
|
import { GLCatProgram, GLCatProgramLinkOptions, GLCatProgramUniformMatrixVectorType, GLCatProgramUniformType, GLCatProgramUniformVectorType, GLCatTexture } from '@fms-cat/glcat-ts';
|
||||||
import { Geometry } from './Geometry';
|
import { Geometry } from './Geometry';
|
||||||
import { RenderTarget } from './RenderTarget';
|
import { RenderTarget } from './RenderTarget';
|
||||||
import { SHADERPOOL } from './ShaderPool';
|
import { SHADERPOOL } from './ShaderPool';
|
||||||
@@ -46,23 +46,11 @@ export class Material {
|
|||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
protected __uniformTextures: {
|
protected __uniformTextures: {
|
||||||
[ name: string ]: {
|
|
||||||
texture: GLCatTexture | null;
|
|
||||||
};
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
protected __uniformTextureArrays: {
|
|
||||||
[ name: string ]: {
|
[ name: string ]: {
|
||||||
textures: GLCatTexture[];
|
textures: GLCatTexture[];
|
||||||
};
|
};
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
protected __uniformCubemaps: {
|
|
||||||
[ name: string ]: {
|
|
||||||
texture: GLCatTextureCubemap | null;
|
|
||||||
};
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
private __vert: string;
|
private __vert: string;
|
||||||
|
|
||||||
public get vert(): string {
|
public get vert(): string {
|
||||||
@@ -138,16 +126,8 @@ export class Material {
|
|||||||
this.__uniformMatrixVectors[ name ] = { type, value };
|
this.__uniformMatrixVectors[ name ] = { type, value };
|
||||||
}
|
}
|
||||||
|
|
||||||
public addUniformTexture( name: string, texture: GLCatTexture | null ): void {
|
public addUniformTextures( name: string, ...textures: GLCatTexture[] ): void {
|
||||||
this.__uniformTextures[ name ] = { texture };
|
this.__uniformTextures[ name ] = { textures };
|
||||||
}
|
|
||||||
|
|
||||||
public addUniformTextureArray( name: string, textures: GLCatTexture[] ): void {
|
|
||||||
this.__uniformTextureArrays[ name ] = { textures };
|
|
||||||
}
|
|
||||||
|
|
||||||
public addUniformCubemap( name: string, texture: GLCatTextureCubemap | null ): void {
|
|
||||||
this.__uniformCubemaps[ name ] = { texture };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public setUniforms(): void {
|
public setUniforms(): void {
|
||||||
@@ -167,16 +147,8 @@ export class Material {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Object.entries( this.__uniformTextures ).forEach( ( [ name, { texture } ] ) => {
|
Object.entries( this.__uniformTextures ).forEach( ( [ name, { textures } ] ) => {
|
||||||
program.uniformTexture( name, texture );
|
program.uniformTexture( name, ...textures );
|
||||||
} );
|
|
||||||
|
|
||||||
Object.entries( this.__uniformTextureArrays ).forEach( ( [ name, { textures } ] ) => {
|
|
||||||
program.uniformTextures( name, textures );
|
|
||||||
} );
|
|
||||||
|
|
||||||
Object.entries( this.__uniformCubemaps ).forEach( ( [ name, { texture } ] ) => {
|
|
||||||
program.uniformCubemap( name, texture );
|
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,8 +50,8 @@ export function setLightUniforms(
|
|||||||
) ).flat(),
|
) ).flat(),
|
||||||
);
|
);
|
||||||
|
|
||||||
material.addUniformTextureArray(
|
material.addUniformTextures(
|
||||||
'samplerShadow',
|
'samplerShadow',
|
||||||
activeLights.map( ( light ) => light.shadowMap.texture ),
|
...activeLights.map( ( light ) => light.shadowMap.texture ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user