WIP before removing barycentric coordinates

This commit is contained in:
Patrick Walton 2019-02-18 18:13:10 -08:00
parent 9af3bac11f
commit 3b8ecfd74c
3 changed files with 21 additions and 6 deletions

View File

@ -134,11 +134,13 @@ impl Renderer {
self.upload_solid_tiles(&built_scene.solid_tiles);
self.draw_solid_tiles(&built_scene);
/*
for batch in &built_scene.batches {
self.upload_batch(batch);
self.draw_batch_fills(batch);
self.draw_batch_mask_tiles(&built_scene, batch);
}
*/
if self.postprocessing_needed() {
self.postprocess();

View File

@ -63,14 +63,20 @@ void main() {
vec2 pixelPosition = (aTileOrigin + aTessCoord) * uTileSize + uViewBoxOrigin;
vec2 position = (pixelPosition / uFramebufferSize * 2.0 - 1.0) * vec2(1.0, -1.0);
vec4 depths = vec4(uQuadP0.z, uQuadP1.z, uQuadP2.z, uQuadP3.z);
float depth = dot(barycentricQuad(position), depths);
vec4 lambda = barycentricQuad(position);
//vec4 depths = vec4(uQuadP0.z, uQuadP1.z, uQuadP2.z, uQuadP3.z);
//float depth = dot(lambda, depths);
float red = lambda.x;
float green = lambda.y;
float blue = lambda.z + 1.0;
float depth = 0.0;
vec2 texCoord = computeTileOffset(tileIndex, uStencilTextureSize.x) + aTessCoord * uTileSize;
vec2 colorTexCoord = computeFillColorTexCoord(aObject, uFillColorsTextureSize);
vTexCoord = texCoord / uStencilTextureSize;
vBackdrop = float(aBackdrop);
vColor = texture(uFillColorsTexture, colorTexCoord);
//vColor = texture(uFillColorsTexture, colorTexCoord);
vColor = vec4(red, green, blue, 1.0);
gl_Position = vec4(position, depth, 1.0);
}

View File

@ -52,11 +52,18 @@ void main() {
vec2 pixelPosition = (aTileOrigin + aTessCoord) * uTileSize + uViewBoxOrigin;
vec2 position = (pixelPosition / uFramebufferSize * 2.0 - 1.0) * vec2(1.0, -1.0);
vec4 depths = vec4(uQuadP0.z, uQuadP1.z, uQuadP2.z, uQuadP3.z);
float depth = dot(barycentricQuad(position), depths);
//vec4 depths = vec4(uQuadP0.z, uQuadP1.z, uQuadP2.z, uQuadP3.z);
//float depth = dot(barycentricQuad(position), depths);
vec4 lambda = barycentricQuad(position);
float red = lambda.x;
float green = lambda.y;
float blue = lambda.z;
float depth = 0.0;
vec2 colorTexCoord = computeFillColorTexCoord(aObject, uFillColorsTextureSize);
vColor = texture(uFillColorsTexture, colorTexCoord);
//vColor = texture(uFillColorsTexture, colorTexCoord);
vColor = vec4(red, green, blue, 1.0);
gl_Position = vec4(position, depth, 1.0);
}