<@include gpu/Config.slh@> <$VERSION_HEADER$> // Generated on <$_SCRIBE_DATE$> // sdf_text3D.vert // vertex shader // // Created by Brad Davis on 10/14/13. // Copyright 2013 High Fidelity, Inc. // Copyright 2024 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // <@include gpu/Inputs.slh@> <@include gpu/Color.slh@> <@include render-utils/ShaderConstants.h@> <@include gpu/Transform.slh@> <$declareStandardTransform()$> <@include sdf_text3D.slh@> layout(location=RENDER_UTILS_ATTR_POSITION_MS) out vec2 _positionMS; <@if HIFI_USE_TRANSLUCENT or HIFI_USE_FORWARD@> layout(location=RENDER_UTILS_ATTR_POSITION_ES) out vec4 _positionES; <@endif@> <@if not HIFI_USE_FORWARD@> layout(location=RENDER_UTILS_ATTR_PREV_POSITION_CS) out vec4 _prevPositionCS; <@endif@> layout(location=RENDER_UTILS_ATTR_NORMAL_WS) out vec3 _normalWS; layout(location=RENDER_UTILS_ATTR_TEXCOORD01) out vec4 _texCoord01; // we're reusing the fade texcoord locations here: layout(location=RENDER_UTILS_ATTR_FADE1) flat out vec4 _glyphBounds; layout(location=RENDER_UTILS_ATTR_FADE2) flat out float _isTofu; void main() { _positionMS = inPosition.xy; _texCoord01 = vec4(inTexCoord0.st, 0.0, 0.0); _glyphBounds = inTexCoord1; _isTofu = inTexCoord2.x; vec4 position = inPosition; // if we're in shadow mode, we need to move each subsequent quad slightly forward so it doesn't z-fight // with the shadows of the letters before it if (params.effect == 3) { // Shadow const int VERTICES_PER_QUAD = 4; // must match value in Font.cpp const float EPSILON = 0.001; position.z += float(gl_VertexID / VERTICES_PER_QUAD) * EPSILON; } TransformCamera cam = getTransformCamera(); TransformObject obj = getTransformObject(); <@if HIFI_USE_FORWARD@> <$transformModelToEyeAndClipPos(cam, obj, position, _positionES, gl_Position)$> <@elif HIFI_USE_TRANSLUCENT@> <$transformModelToEyeClipPosAndPrevClipPos(cam, obj, position, _positionES, gl_Position, _prevPositionCS)$> <@else@> <$transformModelToClipPosAndPrevClipPos(cam, obj, position, gl_Position, _prevPositionCS)$> <@endif@> const vec3 normal = vec3(0, 0, 1); <$transformModelToWorldDir(obj, normal, _normalWS)$> }