Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/threejs_4_deno/src/renderers/shaders/ShaderLib/sprite_vert.glsl.js>default

A simple transformation of three.js for use within a Deno workflow
Go to Latest
variable default
import { default } from "https://deno.land/x/threejs_4_deno@v121/src/renderers/shaders/ShaderLib/sprite_vert.glsl.js";

type

` uniform float rotation; uniform vec2 center; #include <common> #include <uv_pars_vertex> #include <fog_pars_vertex> #include <logdepthbuf_pars_vertex> #include <clipping_planes_pars_vertex> void main() { #include <uv_vertex> vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include <logdepthbuf_vertex> #include <clipping_planes_vertex> #include <fog_vertex> } `