|
@@ -1,4 +1,4 @@
|
|
|
-
|
|
|
+#version 300 es
|
|
|
precision highp float;
|
|
|
precision highp int;
|
|
|
|
|
@@ -22,8 +22,8 @@ precision highp int;
|
|
|
uniform vec3 pano1Position;
|
|
|
uniform mat4 pano1Matrix;
|
|
|
/*
|
|
|
- varying vec3 vWorldPosition0;
|
|
|
- varying vec3 vWorldPosition1;
|
|
|
+ out vec3 vWorldPosition0;
|
|
|
+ out vec3 vWorldPosition1;
|
|
|
*/
|
|
|
#endif
|
|
|
|
|
@@ -38,18 +38,18 @@ precision highp int;
|
|
|
|
|
|
|
|
|
|
|
|
-attribute vec3 position;
|
|
|
-attribute vec3 color;
|
|
|
-attribute float intensity;
|
|
|
-attribute float classification;
|
|
|
-attribute float returnNumber;
|
|
|
-attribute float numberOfReturns;
|
|
|
-attribute float pointSourceID;
|
|
|
-attribute vec4 indices; //每个点的index
|
|
|
-attribute float spacing;
|
|
|
-attribute float gpsTime;
|
|
|
-attribute vec3 normal;
|
|
|
-attribute float aExtra;
|
|
|
+in vec3 position;
|
|
|
+in vec3 color;
|
|
|
+in float intensity;
|
|
|
+in float classification;
|
|
|
+in float returnNumber;
|
|
|
+in float numberOfReturns;
|
|
|
+in float pointSourceID;
|
|
|
+in vec4 indices; //每个点的index
|
|
|
+in float spacing;
|
|
|
+in float gpsTime;
|
|
|
+in vec3 normal;
|
|
|
+in float aExtra;
|
|
|
|
|
|
uniform mat4 modelMatrix;
|
|
|
uniform mat4 modelViewMatrix;
|
|
@@ -135,7 +135,7 @@ uniform bool uIsLeafNode;
|
|
|
|
|
|
uniform vec3 uColor;
|
|
|
uniform float uOpacity;
|
|
|
-varying float vOpacity; //add
|
|
|
+out float vOpacity; //add
|
|
|
|
|
|
|
|
|
|
|
@@ -189,16 +189,16 @@ uniform mat4 uShadowProj[num_shadowmaps];
|
|
|
|
|
|
|
|
|
|
|
|
-varying vec3 vColor;
|
|
|
-varying float vLogDepth;
|
|
|
-varying vec3 vViewPosition;
|
|
|
-varying float vRadius;
|
|
|
-varying float vPointSize;
|
|
|
+out vec3 vColor;
|
|
|
+out float vLogDepth;
|
|
|
+out vec3 vViewPosition;
|
|
|
+out float vRadius;
|
|
|
+out float vPointSize;
|
|
|
|
|
|
|
|
|
-float round(float number){
|
|
|
+/*float round(float number){
|
|
|
return floor(number + 0.5);
|
|
|
-}
|
|
|
+}*/
|
|
|
|
|
|
//
|
|
|
// ### ######## ### ######## ######## #### ## ## ######## ###### #### ######## ######## ######
|
|
@@ -291,7 +291,7 @@ float getLOD(){//////we use this
|
|
|
index3d = floor(index3d + 0.5);
|
|
|
int index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));
|
|
|
|
|
|
- vec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));
|
|
|
+ vec4 value = texture(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));
|
|
|
int mask = int(round(value.r * 255.0));
|
|
|
|
|
|
if(isBitSet(mask, index)){
|
|
@@ -331,7 +331,7 @@ float getSpacing(){
|
|
|
index3d = floor(index3d + 0.5);
|
|
|
int index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));
|
|
|
|
|
|
- vec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));
|
|
|
+ vec4 value = texture(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));
|
|
|
int mask = int(round(value.r * 255.0));
|
|
|
float spacingFactor = value.a;
|
|
|
|
|
@@ -389,7 +389,7 @@ float getLOD(){
|
|
|
|
|
|
for(float i = 0.0; i <= 1000.0; i++){
|
|
|
|
|
|
- vec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));
|
|
|
+ vec4 value = texture(visibleNodes, vec2(iOffset / 2048.0, 0.0));
|
|
|
|
|
|
int children = int(value.r * 255.0);
|
|
|
float next = value.g * 255.0;
|
|
@@ -486,26 +486,26 @@ vec3 getGpsTime(){
|
|
|
float w = (gpsTime + uGpsOffset) * uGpsScale;
|
|
|
|
|
|
|
|
|
- vec3 c = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
|
|
|
+ vec3 c = texture(gradient, vec2(w, 1.0 - w)).rgb;
|
|
|
|
|
|
|
|
|
// vec2 r = uNormalizedGpsBufferRange;
|
|
|
// float w = gpsTime * (r.y - r.x) + r.x;
|
|
|
// w = clamp(w, 0.0, 1.0);
|
|
|
- // vec3 c = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
+ // vec3 c = texture(gradient, vec2(w,1.0-w)).rgb;
|
|
|
|
|
|
return c;
|
|
|
}
|
|
|
|
|
|
vec3 getElevation(vec4 world){
|
|
|
float w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);
|
|
|
- vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
+ vec3 cElevation = texture(gradient, vec2(w,1.0-w)).rgb;
|
|
|
return cElevation;
|
|
|
}
|
|
|
|
|
|
vec4 getClassification(){
|
|
|
vec2 uv = vec2(classification / 255.0, 0.5);
|
|
|
- vec4 classColor = texture2D(classificationLUT, uv);
|
|
|
+ vec4 classColor = texture(classificationLUT, uv);
|
|
|
|
|
|
return classColor;
|
|
|
}
|
|
@@ -569,14 +569,14 @@ vec3 getNumberOfReturns(){
|
|
|
|
|
|
float w = value / 6.0;
|
|
|
|
|
|
- vec3 color = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
|
|
|
+ vec3 color = texture(gradient, vec2(w, 1.0 - w)).rgb;
|
|
|
|
|
|
return color;
|
|
|
}
|
|
|
|
|
|
vec3 getSourceID(){
|
|
|
float w = mod(pointSourceID, 10.0) / 10.0;
|
|
|
- return texture2D(gradient, vec2(w,1.0 - w)).rgb;
|
|
|
+ return texture(gradient, vec2(w,1.0 - w)).rgb;
|
|
|
}
|
|
|
|
|
|
vec3 getCompositeColor(vec4 world){
|
|
@@ -641,7 +641,7 @@ vec3 getMatcap(){
|
|
|
vec3 r_en = reflect( eye, getNormal() ); // or r_en = e - 2. * dot( n, e ) * n;
|
|
|
float m = 2. * sqrt(pow( r_en.x, 2. ) + pow( r_en.y, 2. ) + pow( r_en.z + 1., 2. ));
|
|
|
vec2 vN = r_en.xy / m + .5;
|
|
|
- return texture2D(matcapTextureUniform, vN).rgb;
|
|
|
+ return texture(matcapTextureUniform, vN).rgb;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -650,7 +650,7 @@ vec3 getExtra(){
|
|
|
float w = (aExtra + uExtraOffset) * uExtraScale;
|
|
|
w = clamp(w, 0.0, 1.0);
|
|
|
|
|
|
- vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
+ vec3 color = texture(gradient, vec2(w,1.0-w)).rgb;
|
|
|
|
|
|
// vec2 r = uExtraNormalizedRange;
|
|
|
|
|
@@ -660,7 +660,7 @@ vec3 getExtra(){
|
|
|
|
|
|
// w = clamp(w, 0.0, 1.0);
|
|
|
|
|
|
- // vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
+ // vec3 color = texture(gradient, vec2(w,1.0-w)).rgb;
|
|
|
|
|
|
return color;
|
|
|
}
|
|
@@ -689,13 +689,13 @@ vec3 getColor(vec4 world){
|
|
|
color = getGpsTime();
|
|
|
#elif defined color_type_intensity_gradient
|
|
|
float w = getIntensity();
|
|
|
- color = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
+ color = texture(gradient, vec2(w,1.0-w)).rgb;
|
|
|
#elif defined color_type_color
|
|
|
color = uColor;
|
|
|
#elif defined color_type_level_of_detail
|
|
|
float depth = getLOD();
|
|
|
float w = depth / 10.0;
|
|
|
- color = texture2D(gradient, vec2(w,1.0-w)).rgb;
|
|
|
+ color = texture(gradient, vec2(w,1.0-w)).rgb;
|
|
|
#elif defined color_type_indices
|
|
|
color = indices.rgb;
|
|
|
#elif defined color_type_classification
|
|
@@ -1071,7 +1071,7 @@ void doClipping(vec4 world){
|
|
|
}else{
|
|
|
vec2 uv = vec2((world.x - xMin) / (xMax - xMin), (world.y - yMin) / (yMax - yMin) );
|
|
|
|
|
|
- vec4 color = texture2D(baseHeightAreaMap,uv);
|
|
|
+ vec4 color = texture(baseHeightAreaMap,uv);
|
|
|
//抗锯齿待写
|
|
|
|
|
|
|
|
@@ -1197,8 +1197,8 @@ void main() {
|
|
|
/*
|
|
|
vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);
|
|
|
vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz);
|
|
|
- vec4 colorFromPano0 = texture2D(pano0Map,samplerCoord0);
|
|
|
- vec4 colorFromPano1 = texture2D(pano1Map,samplerCoord1);
|
|
|
+ vec4 colorFromPano0 = texture(pano0Map,samplerCoord0);
|
|
|
+ vec4 colorFromPano1 = texture(pano1Map,samplerCoord1);
|
|
|
*/
|
|
|
|
|
|
|
|
@@ -1295,7 +1295,7 @@ void main() {
|
|
|
|
|
|
if(distance < 1.0){
|
|
|
float w = distance;
|
|
|
- vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
|
|
|
+ vec3 cGradient = texture(gradient, vec2(w, 1.0 - w)).rgb;
|
|
|
|
|
|
vColor = cGradient;
|
|
|
//vColor = cGradient * 0.7 + vColor * 0.3;
|
|
@@ -1337,7 +1337,7 @@ void main() {
|
|
|
float bias = vRadius * 2.0;
|
|
|
|
|
|
for(int j = 0; j < 9; j++){
|
|
|
- vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);
|
|
|
+ vec4 depthMapValue = texture(uShadowMap[i], vec2(u, v) + sampleLocations[j]);
|
|
|
|
|
|
float linearDepthFromSM = depthMapValue.x + bias;
|
|
|
float linearDepthFromViewer = distanceToLight;
|