|
1 | | -// Copyright (c) 2015 Uber Technologies, Inc. |
| 1 | +// Copyright (c) 2016 Uber Technologies, Inc. |
2 | 2 | // |
3 | 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | 4 | // of this software and associated documentation files (the "Software"), to deal |
@@ -29,14 +29,23 @@ attribute vec3 instancePickingColors; |
29 | 29 | uniform float opacity; |
30 | 30 | uniform float radius; |
31 | 31 | uniform float renderPickingBuffer; |
| 32 | +uniform mat4 flatMatrix; |
32 | 33 |
|
33 | 34 | varying vec4 vColor; |
| 35 | +varying float vFragDepth; |
34 | 36 |
|
35 | 37 | void main(void) { |
36 | | - vec3 center = preproject(instancePositions.xyz); |
| 38 | + vec3 center = project_position(instancePositions.xyz); |
37 | 39 | vec3 vertex = positions * scale(radius * instancePositions.w); |
38 | | - gl_Position = project(vec4(center, 1.0)) + |
39 | | - project(vec4(vertex, 0.0)); |
| 40 | + vec4 position = |
| 41 | + project_to_clipspace(vec4(center, 1.0)) + |
| 42 | + project_to_clipspace(vec4(vertex, 0.0)); |
| 43 | + vec4 positionFlat = |
| 44 | + project_to_clipspace(vec4(center.xy, 0.0, 1.0)) + |
| 45 | + project_to_clipspace(vec4(vertex.xy, 0.0, 0.0)); |
| 46 | + |
| 47 | + gl_Position = positionFlat; |
| 48 | + vFragDepth = position.z / position.w; |
40 | 49 |
|
41 | 50 | vec4 color = vec4(instanceColors / 255.0, opacity); |
42 | 51 | vec4 pickingColor = vec4(instancePickingColors / 255.0, 1.); |
|
0 commit comments