pathfinder/shaders/gles2/direct-curve.vs.glsl

56 lines
1.9 KiB
Plaintext
Raw Normal View History

// pathfinder/shaders/gles2/direct-curve.vs.glsl
//
2017-10-03 18:32:03 -04:00
// Copyright (c) 2017 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
precision highp float;
uniform mat4 uTransform;
uniform vec4 uHints;
uniform vec2 uEmboldenAmount;
uniform ivec2 uPathColorsDimensions;
uniform sampler2D uPathColors;
uniform ivec2 uPathTransformSTDimensions;
uniform sampler2D uPathTransformST;
uniform ivec2 uPathTransformExtDimensions;
uniform sampler2D uPathTransformExt;
attribute vec2 aPosition;
2017-08-13 16:39:51 -04:00
attribute vec2 aTexCoord;
2017-08-16 01:09:09 -04:00
attribute float aPathID;
2017-08-13 16:39:51 -04:00
attribute float aSign;
attribute float aNormalAngle;
varying vec4 vColor;
varying vec2 vTexCoord;
varying float vSign;
void main() {
2017-08-16 01:09:09 -04:00
int pathID = int(aPathID);
vec2 pathTransformExt;
vec4 pathTransformST = fetchPathAffineTransform(pathTransformExt,
uPathTransformST,
uPathTransformSTDimensions,
uPathTransformExt,
uPathTransformExtDimensions,
pathID);
2017-08-22 21:25:32 -04:00
vec2 position = dilatePosition(aPosition, aNormalAngle, uEmboldenAmount);
position = hintPosition(position, uHints);
position = transformVertexPositionAffine(position, pathTransformST, pathTransformExt);
2017-08-22 21:25:32 -04:00
position = transformVertexPosition(position, uTransform);
float depth = convertPathIndexToViewportDepthValue(pathID);
2017-08-16 01:09:09 -04:00
gl_Position = vec4(position, depth, 1.0);
2017-08-16 01:09:09 -04:00
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
vTexCoord = vec2(aTexCoord) / 2.0;
2017-08-13 16:39:51 -04:00
vSign = aSign;
}