Skip to content

Commit

Permalink
Fix radiusMinPixels and radiusMaxPixels for METER_OFFSETS in scatterp…
Browse files Browse the repository at this point in the history
…lot (visgl#607)
  • Loading branch information
CrokinoleMaster authored and Shaojing Li committed Jun 1, 2017
1 parent 02f77bb commit e792e72
Showing 1 changed file with 16 additions and 36 deletions.
52 changes: 16 additions & 36 deletions src/shaderlib/project/project.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,47 +193,31 @@ float tan_fp32(float a) {
//
float project_scale(float meters) {
if (projectionMode == PROJECT_MERCATOR_OFFSETS) {
return meters;
} else {
return meters * projectionPixelsPerUnit.x;
}
return meters * projectionPixelsPerUnit.x;
}
vec2 project_scale(vec2 meters) {
if (projectionMode == PROJECT_MERCATOR_OFFSETS) {
return meters;
} else {
return vec2(
meters.x * projectionPixelsPerUnit.x,
meters.y * projectionPixelsPerUnit.x
);
}
return vec2(
meters.x * projectionPixelsPerUnit.x,
meters.y * projectionPixelsPerUnit.x
);
}
vec3 project_scale(vec3 meters) {
if (projectionMode == PROJECT_MERCATOR_OFFSETS) {
return meters;
} else {
return vec3(
meters.x * projectionPixelsPerUnit.x,
meters.y * projectionPixelsPerUnit.x,
meters.z * projectionPixelsPerUnit.x
);
}
return vec3(
meters.x * projectionPixelsPerUnit.x,
meters.y * projectionPixelsPerUnit.x,
meters.z * projectionPixelsPerUnit.x
);
}
vec4 project_scale(vec4 meters) {
if (projectionMode == PROJECT_MERCATOR_OFFSETS) {
return meters;
} else {
return vec4(
meters.x * projectionPixelsPerUnit.x,
meters.y * projectionPixelsPerUnit.x,
meters.z * projectionPixelsPerUnit.x,
meters.w
);
}
return vec4(
meters.x * projectionPixelsPerUnit.x,
meters.y * projectionPixelsPerUnit.x,
meters.z * projectionPixelsPerUnit.x,
meters.w
);
}
//
Expand All @@ -253,7 +237,6 @@ vec2 project_position(vec2 position) {
return position;
}
if (projectionMode == PROJECT_MERCATOR_OFFSETS) {
return position;
return project_scale(position);
}
// Covers projectionMode == PROJECT_MERCATOR
Expand All @@ -275,9 +258,6 @@ vec4 project_to_viewspace(vec4 position) {
}
vec4 project_to_clipspace(vec4 position) {
if (projectionMode == PROJECT_MERCATOR_OFFSETS) {
position = position * projectionPixelsPerUnit.x;
}
return projectionMatrix * position + projectionCenter;
}
Expand Down

0 comments on commit e792e72

Please sign in to comment.