|
@@ -107,6 +107,14 @@ uniform float uOrthoHeight;
|
|
|
#endif
|
|
|
|
|
|
|
|
|
+#if defined(num_prism) && num_prism > 0
|
|
|
+ uniform mat3 prismList[num_prism];
|
|
|
+ uniform vec2 prismPoints[prismPointCountSum];
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
uniform float size;
|
|
|
uniform float minSize;
|
|
|
uniform float maxSize;
|
|
@@ -485,11 +493,9 @@ vec3 getGpsTime(){
|
|
|
return c;
|
|
|
}
|
|
|
|
|
|
-vec3 getElevation(){
|
|
|
- vec4 world = modelMatrix * vec4( position, 1.0 );
|
|
|
+vec3 getElevation(vec4 world){
|
|
|
float w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);
|
|
|
vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
-
|
|
|
return cElevation;
|
|
|
}
|
|
|
|
|
@@ -569,7 +575,7 @@ vec3 getSourceID(){
|
|
|
return texture2D(gradient, vec2(w,1.0 - w)).rgb;
|
|
|
}
|
|
|
|
|
|
-vec3 getCompositeColor(){
|
|
|
+vec3 getCompositeColor(vec4 world){
|
|
|
vec3 c;
|
|
|
float w;
|
|
|
|
|
@@ -579,7 +585,7 @@ vec3 getCompositeColor(){
|
|
|
c += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);
|
|
|
w += wIntensity;
|
|
|
|
|
|
- c += wElevation * getElevation();
|
|
|
+ c += wElevation * getElevation(world);
|
|
|
w += wElevation;
|
|
|
|
|
|
c += wReturnNumber * getReturnNumber();
|
|
@@ -655,7 +661,7 @@ vec3 getExtra(){
|
|
|
return color;
|
|
|
}
|
|
|
|
|
|
-vec3 getColor(){
|
|
|
+vec3 getColor(vec4 world){
|
|
|
vec3 color;
|
|
|
|
|
|
#ifdef color_type_rgba
|
|
@@ -663,7 +669,7 @@ vec3 getColor(){
|
|
|
|
|
|
|
|
|
#elif defined color_type_height || defined color_type_elevation
|
|
|
- color = getElevation();
|
|
|
+ color = getElevation(world);
|
|
|
#elif defined color_type_rgb_height
|
|
|
vec3 cHeight = getElevation();
|
|
|
color = (1.0 - uTransition) * getRGB() + uTransition * cHeight;
|
|
@@ -706,7 +712,7 @@ vec3 getColor(){
|
|
|
#elif defined color_type_phong
|
|
|
color = color;
|
|
|
#elif defined color_type_composite
|
|
|
- color = getCompositeColor();
|
|
|
+ color = getCompositeColor(world);
|
|
|
#elif defined color_type_matcap
|
|
|
color = getMatcap();
|
|
|
#else
|
|
@@ -779,8 +785,8 @@ float getPointSize(){
|
|
|
}
|
|
|
|
|
|
|
|
|
-bool insideBox(mat4 clipBox){//add
|
|
|
- vec4 clipPosition = clipBox * modelMatrix * vec4( position, 1.0 );
|
|
|
+bool insideBox(mat4 clipBox, vec4 worldPos){//add
|
|
|
+ vec4 clipPosition = clipBox * worldPos;
|
|
|
bool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;
|
|
|
inside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;
|
|
|
inside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;
|
|
@@ -788,8 +794,44 @@ bool insideBox(mat4 clipBox){//add
|
|
|
return inside;
|
|
|
}
|
|
|
|
|
|
+#if defined(num_prism) && num_prism > 0
|
|
|
+
|
|
|
+ int insidePrism(mat3 prismInfo, int pointIndexStart, vec4 worldPos){//是否在棱柱里
|
|
|
+
|
|
|
+ float zMin = prismInfo[0][0];
|
|
|
+ float zMid = prismInfo[0][1];
|
|
|
+ float zMax = prismInfo[0][2];
|
|
|
+ float xMin = prismInfo[1][0];
|
|
|
+ float xMax = prismInfo[1][1];
|
|
|
+ float yMin = prismInfo[1][2];
|
|
|
+ float yMax = prismInfo[2][0];
|
|
|
+
|
|
|
+ int pointCount = int(round(prismInfo[2][1]));
|
|
|
+
|
|
|
+ if(worldPos.z < zMin || worldPos.z > zMax || worldPos.x < xMin || worldPos.x > xMax || worldPos.y < yMin || worldPos.y > yMax)return 0;
|
|
|
+
|
|
|
+ bool inside = false;
|
|
|
+
|
|
|
+ int j=pointCount-1;
|
|
|
+
|
|
|
+ for(int i=0; i<prism_maxPointsCount; i++){
|
|
|
+ if(i>pointCount)break;
|
|
|
+ float xi = prismPoints[i+pointIndexStart].x, yi = prismPoints[i+pointIndexStart].y, xj = prismPoints[j+pointIndexStart].x, yj = prismPoints[j+pointIndexStart].y;
|
|
|
|
|
|
-void doClipping(){
|
|
|
+ if(((yi > worldPos.y) != (yj > worldPos.y)) && (worldPos.x < (xj - xi) * (worldPos.y - yi) / (yj - yi) + xi)){
|
|
|
+ inside = !inside;
|
|
|
+ }
|
|
|
+ j=i;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(inside){
|
|
|
+ return worldPos.z < zMid ? 1 : 2;
|
|
|
+ }else return 0;
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+void doClipping(vec4 world){
|
|
|
|
|
|
{
|
|
|
vec4 cl = getClassification();
|
|
@@ -852,7 +894,7 @@ void doClipping(){
|
|
|
//总共三种box : 最外层可见、内层可见和不可见(外层可见和内层可见是交集,内层可见和内层不可见是并集)
|
|
|
|
|
|
#if defined(bigClipInBox)
|
|
|
- if(!insideBox(clipBoxBig_in)){
|
|
|
+ if(!insideBox(clipBoxBig_in, world)){
|
|
|
gl_Position = vec4(100.0, 100.0, 100.0, 1.0);
|
|
|
return;;
|
|
|
}
|
|
@@ -862,7 +904,7 @@ void doClipping(){
|
|
|
//当有可见box时,需要在任一可见box内才可见
|
|
|
bool visi1 = false;
|
|
|
for(int i = 0; i < num_in_clipboxes; i++){
|
|
|
- if(insideBox(clipBoxes_in[i])){
|
|
|
+ if(insideBox(clipBoxes_in[i], world)){
|
|
|
visi1 = true;
|
|
|
break;
|
|
|
}
|
|
@@ -878,7 +920,7 @@ void doClipping(){
|
|
|
//当有不可见box时,不在所有不可见box内才可见
|
|
|
bool visi2 = true;
|
|
|
for(int i = 0; i < num_out_clipboxes; i++){
|
|
|
- if(insideBox(clipBoxes_out[i])){
|
|
|
+ if(insideBox(clipBoxes_out[i], world)){
|
|
|
visi2 = false;
|
|
|
break;
|
|
|
}
|
|
@@ -894,7 +936,7 @@ void doClipping(){
|
|
|
//当有高亮box时,需要在任一可见高亮内都高宽
|
|
|
bool highlight = false;
|
|
|
for(int i = 0; i < num_highlightBox; i++){
|
|
|
- if(insideBox(boxes_highlight[i])){
|
|
|
+ if(insideBox(boxes_highlight[i], world)){
|
|
|
highlight = true;
|
|
|
break;
|
|
|
}
|
|
@@ -904,6 +946,28 @@ void doClipping(){
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #if defined(num_prism) && num_prism > 0
|
|
|
+ int highlight = 0;
|
|
|
+ int pointIndexStart = 0;
|
|
|
+ for(int i = 0; i < num_prism; i++){
|
|
|
+ highlight = insidePrism(prismList[i], pointIndexStart, world);
|
|
|
+
|
|
|
+ if(highlight>0){
|
|
|
+ if(highlight == 1){
|
|
|
+ vColor.r += 0.5;
|
|
|
+ }else if(highlight == 2){
|
|
|
+ vColor.g += 0.5;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ pointIndexStart += int(round(prismList[i][2][1]));
|
|
|
+ }
|
|
|
+ #endif
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -953,7 +1017,9 @@ void main() {
|
|
|
|
|
|
normalZ = abs(getNormal().z);
|
|
|
#endif
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ vec4 worldPos = modelMatrix * vec4(position, 1.0);
|
|
|
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );
|
|
|
vViewPosition = mvPosition.xyz;
|
|
|
gl_Position = projectionMatrix * mvPosition;
|
|
@@ -964,14 +1030,13 @@ void main() {
|
|
|
// COLOR
|
|
|
//加-------------------
|
|
|
#if defined(usePanoMap)
|
|
|
- vec4 worldPosition = modelMatrix * vec4(position, 1.0);
|
|
|
|
|
|
- vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;
|
|
|
+ vec3 positionLocalToPanoCenter0 = worldPos.xyz - pano0Position;
|
|
|
vec3 vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;
|
|
|
vWorldPosition0.x *= -1.0;
|
|
|
vWorldPosition0 = transformAxis(vWorldPosition0);
|
|
|
|
|
|
- vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;
|
|
|
+ vec3 positionLocalToPanoCenter1 = worldPos.xyz - pano1Position;
|
|
|
vec3 vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;
|
|
|
vWorldPosition1.x *= -1.0;
|
|
|
vWorldPosition1 = transformAxis(vWorldPosition1);
|
|
@@ -995,18 +1060,18 @@ void main() {
|
|
|
//float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色
|
|
|
if(progress < easeInOutRatio){
|
|
|
float easeProgress = (easeInOutRatio - progress) / easeInOutRatio;
|
|
|
- vec3 vColor1 = getColor();
|
|
|
+ vec3 vColor1 = getColor(worldPos);
|
|
|
vColor = mix(vColor,vColor1,easeProgress);
|
|
|
}else if(progress > 1.0 - easeInOutRatio){
|
|
|
float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio;
|
|
|
- vec3 vColor1 = getColor();
|
|
|
+ vec3 vColor1 = getColor(worldPos);
|
|
|
vColor = mix(vColor,vColor1,easeProgress);
|
|
|
}
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
- vColor = getColor();
|
|
|
+ vColor = getColor(worldPos);
|
|
|
|
|
|
#endif
|
|
|
|
|
@@ -1067,7 +1132,7 @@ void main() {
|
|
|
|
|
|
|
|
|
// CLIPPING
|
|
|
- doClipping();
|
|
|
+ doClipping(worldPos);
|
|
|
|
|
|
#if defined(num_clipspheres) && num_clipspheres > 0
|
|
|
for(int i = 0; i < num_clipspheres; i++){
|