2024-08-11 17:38:06 +00:00
|
|
|
|
|
|
|
vec3 localToWorld( vec3 _VERTEX, mat4 _MODEL_MATRIX )
|
|
|
|
{
|
2024-09-14 06:41:52 +00:00
|
|
|
return ( _MODEL_MATRIX * vec4( _VERTEX, 1.0 ) ).xyz;
|
2024-08-11 17:38:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
vec3 worldToLocal( vec3 _VERTEX, mat4 _MODEL_MATRIX )
|
|
|
|
{
|
2024-09-14 06:41:52 +00:00
|
|
|
return ( inverse( _MODEL_MATRIX ) * vec4( _VERTEX, 1.0 ) ).xyz;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec2 tilingOffset( vec2 uv, vec4 tilingOffset )
|
|
|
|
{
|
|
|
|
uv *= tilingOffset.xy;
|
|
|
|
uv += tilingOffset.zw;
|
|
|
|
|
|
|
|
return uv;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec2 tilingOffsetRepeat( vec2 uv, vec4 tilingOffset )
|
|
|
|
{
|
|
|
|
uv *= tilingOffset.xy;
|
|
|
|
uv += tilingOffset.zw;
|
|
|
|
|
|
|
|
return mod( uv, vec2(1,1) );
|
2024-08-11 17:38:06 +00:00
|
|
|
}
|