2017-09-05 22:47:19 -04:00
|
|
|
// pathfinder/shaders/gles2/direct-3d-curve.vs.glsl
|
|
|
|
//
|
|
|
|
// 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;
|
2017-11-10 18:03:43 -05:00
|
|
|
uniform vec2 uEmboldenAmount;
|
2017-09-05 22:47:19 -04:00
|
|
|
uniform ivec2 uPathColorsDimensions;
|
|
|
|
uniform sampler2D uPathColors;
|
2017-11-29 13:50:47 -05:00
|
|
|
uniform ivec2 uPathTransformSTDimensions;
|
|
|
|
uniform sampler2D uPathTransformST;
|
|
|
|
uniform ivec2 uPathTransformExtDimensions;
|
|
|
|
uniform sampler2D uPathTransformExt;
|
2017-09-05 22:47:19 -04:00
|
|
|
|
|
|
|
attribute vec2 aPosition;
|
|
|
|
attribute vec2 aTexCoord;
|
|
|
|
attribute float aPathID;
|
|
|
|
attribute float aSign;
|
2017-11-10 18:03:43 -05:00
|
|
|
attribute float aNormalAngle;
|
2017-09-05 22:47:19 -04:00
|
|
|
|
|
|
|
varying vec4 vColor;
|
|
|
|
varying vec2 vPathID;
|
|
|
|
varying vec2 vTexCoord;
|
|
|
|
varying float vSign;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
int pathID = int(aPathID);
|
|
|
|
|
2017-11-29 13:50:47 -05:00
|
|
|
vec2 pathTransformExt;
|
|
|
|
vec4 pathTransformST = fetchPathAffineTransform(pathTransformExt,
|
|
|
|
uPathTransformST,
|
|
|
|
uPathTransformSTDimensions,
|
|
|
|
uPathTransformExt,
|
|
|
|
uPathTransformExtDimensions,
|
|
|
|
pathID);
|
2017-09-05 22:47:19 -04:00
|
|
|
|
2017-11-10 18:03:43 -05:00
|
|
|
vec2 position = dilatePosition(aPosition, aNormalAngle, uEmboldenAmount);
|
2017-11-29 13:50:47 -05:00
|
|
|
position = transformVertexPositionAffine(position, pathTransformST, pathTransformExt);
|
2017-09-05 22:47:19 -04:00
|
|
|
|
|
|
|
gl_Position = uTransform * vec4(position, 0.0, 1.0);
|
|
|
|
|
|
|
|
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
|
|
|
|
vPathID = packPathID(pathID);
|
|
|
|
vTexCoord = vec2(aTexCoord) / 2.0;
|
|
|
|
vSign = aSign;
|
|
|
|
}
|