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

43 lines
1.4 KiB
Plaintext
Raw Normal View History

// pathfinder/shaders/gles2/direct-interior.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 ivec2 uPathColorsDimensions;
2017-08-22 21:25:32 -04:00
uniform ivec2 uPathTransformDimensions;
uniform ivec2 uPathHintsDimensions;
uniform sampler2D uPathColors;
2017-08-22 21:25:32 -04:00
uniform sampler2D uPathTransform;
uniform sampler2D uPathHints;
attribute vec2 aPosition;
2017-08-16 01:09:09 -04:00
attribute float aPathID;
varying vec4 vColor;
2017-08-16 01:09:09 -04:00
varying vec2 vPathID;
void main() {
2017-08-16 01:09:09 -04:00
int pathID = int(aPathID);
vec4 pathHints = fetchFloat4Data(uPathHints, pathID, uPathHintsDimensions);
2017-08-22 21:25:32 -04:00
vec4 pathTransform = fetchFloat4Data(uPathTransform, pathID, uPathTransformDimensions);
vec2 position = hintPosition(aPosition, pathHints);
position = transformVertexPositionST(position, pathTransform);
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);
vPathID = packPathID(pathID);
}