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

35 lines
974 B
Plaintext
Raw Normal View History

// pathfinder/shaders/gles2/direct-interior.vs.glsl
//
// Copyright (c) 2017 Mozilla Foundation
precision highp float;
uniform mat4 uTransform;
uniform ivec2 uFramebufferSize;
uniform ivec2 uPathColorsDimensions;
2017-08-22 21:25:32 -04:00
uniform ivec2 uPathTransformDimensions;
uniform sampler2D uPathColors;
2017-08-22 21:25:32 -04:00
uniform sampler2D uPathTransform;
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);
2017-08-22 21:25:32 -04:00
vec4 pathTransform = fetchFloat4Data(uPathTransform, pathID, uPathTransformDimensions);
vec2 position = transformVertexPositionST(aPosition, pathTransform);
position = transformVertexPosition(position, uTransform);
position = convertScreenToClipSpace(position, uFramebufferSize);
2017-08-22 21:25:32 -04:00
2017-08-16 01:09:09 -04:00
float depth = convertPathIndexToDepthValue(pathID);
gl_Position = vec4(position, depth, 1.0);
2017-08-16 01:09:09 -04:00
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
vPathID = packPathID(pathID);
}