pixijs-custom-rendering

安装量: 810
排名: #4869

安装

npx skills add https://github.com/pixijs/pixijs-skills --skill pixijs-custom-rendering

Custom shaders bind GLSL and WGSL programs to scene objects via Shader.from({ gl, gpu, resources }) . Uniforms live in typed UniformGroup s, textures are passed as separate resources, and the same shader can target both WebGL and WebGPU. Quick Start const uniforms = new UniformGroup ( { uTime : { value : 0 , type : "f32" } , } ) ; const shader = Shader . from ( { gl : { vertex : vertexSrc , fragment : fragmentSrc } , resources : { uniforms } , } ) ; const geometry = new MeshGeometry ( { positions : new Float32Array ( [ 0 , 0 , 100 , 0 , 100 , 100 , 0 , 100 ] ) , uvs : new Float32Array ( [ 0 , 0 , 1 , 0 , 1 , 1 , 0 , 1 ] ) , indices : new Uint32Array ( [ 0 , 1 , 2 , 0 , 2 , 3 ] ) , } ) ; const mesh = new Mesh ( { geometry , shader } ) ; app . stage . addChild ( mesh ) ; app . ticker . add ( ( ) => { shader . resources . uniforms . uniforms . uTime = performance . now ( ) / 1000 ; } ) ;

返回排行榜