UNPKG

macaw-threejs

Version:

Macaw Three.js is ready to use library to connect Three.js with your project.<br/> Under the hood is a fully optimized, clean Three.js set up to make it easy to implement effects for images (future text, etc.). With effects out of the box, you don't even

2 lines (1 loc) 1.07 kB
import{MacawShader as n}from"./index.js";class e extends n{constructor(){super({baseUniforms:{u_image:{value:0},u_scale:{value:[1,1]},u_time:{value:0},u_click:{value:0},u_clickPosition:{value:[.5,.5]}},baseFragment:{uniforms:"\n uniform sampler2D u_image;\n uniform float u_time;\n uniform vec2 u_scale;\n ",varying:"\n varying vec2 vUv;\n ",beforeGl_FragColor:"\n vec2 newUV = vUv*u_scale+vec2((u_scale.x - 1.) / 2. * -1.,0.);\n vec4 image = texture2D(u_image,newUV);\n ",afterGl_FragColor:"\n gl_FragColor = image;\n "},baseVertex:{uniforms:"\n uniform float u_time;\n uniform vec2 u_clickPosition;\n uniform float u_click;\n ",varying:"\n varying vec2 vUv;\n ",const:"\n const float PI = 3.1415925;\n ",beforeGl_Position:"\n vec3 newposition = position;\n ",afterGl_Position:"\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newposition, 1.0);\n "},isImage:!0})}}export{e as MacawImageShader};