1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import * as THREE from 'three'
- type AttributesDescription = {
- vPosition:THREE.Vector3
-
- vTexCoord: THREE.Vector2
- }
- type VaryingDescription = {
- d: THREE.Vector2
- }
- const uniforms = {
- uModelViewProjectionMatrix: { value: new THREE.Matrix4 },
- uUVOffset: { value: new THREE.Vector2 },
- }
- export default {
- attributesDescription: undefined as AttributesDescription | undefined,
- varyingDescription: undefined as VaryingDescription | undefined,
- uniforms: uniforms,
-
- vetexShader: `
-
- precision highp float;
- uniform mat4 uModelViewProjectionMatrix;
- uniform vec2 uUVOffset;
-
- attribute vec3 vPosition;
- attribute vec2 vTexCoord;
-
- varying mediump vec2 d;
-
-
- vec4 mul(mat4 i,vec3 p) //mulPoint
- {
- return i[0] * p.x + ( i[1] * p.y + ( i[2]*p.z + i[3]) );
- }
-
- void main(void)
- {
- gl_Position= mul( uModelViewProjectionMatrix, vPosition.xyz);
- d = vTexCoord + uUVOffset;
- }
- `,
- fragmentShader: `
-
- precision mediump float;
- #include <matdither.glsl>
-
- uniform sampler2D tAlbedo;
-
- varying mediump vec2 vUv;
-
- void main()
- {
- float albedo=texture2D(tAlbedo,vUv).a;
-
- if(albedo<=f(vUv.x))
- {
- discard;
- }
-
- gl_FragColor=vec4(0.0);
- }
-
- `
- }
|