Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435
  1. import * as THREE from "three"
  2. import { IcosahedronGeometry, MeshStandardMaterial, Mesh, ShaderMaterial } from "three";
  3. export class VaringBox {
  4. material: ShaderMaterial;
  5. private vertexShader = `
  6. uniform float time;
  7. varying vec3 vPos;
  8. void main() {
  9. vPos=position;
  10. vPos.x += sin( time + vPos.z * 4.0 ) / 4.0;
  11. //vPos.y += cos( time + vPos.z * 4.0 ) / 4.0;
  12. gl_Position = projectionMatrix * modelViewMatrix * vec4( vPos, 1.0 );
  13. }
  14. `;
  15. private fragmentShader = `
  16. varying vec3 vPos;
  17. void main() {
  18. gl_FragColor = vec4( vPos*2.0, 1.0 );
  19. }
  20. `;
  21. constructor() {
  22. this.material = new ShaderMaterial({
  23. uniforms: {
  24. time: {
  25. value: 0
  26. }
  27. },
  28. vertexShader: this.vertexShader,
  29. fragmentShader: this.fragmentShader
  30. });
  31. }
  32. }