Removed while loops from path_vs that caused driver issues with big w values

Removed error that caused the postDraw method not to be called on slave nodes
This commit is contained in:
Alexander Bock
2015-07-04 15:41:43 +02:00
parent a9824dabc1
commit 003a438602
4 changed files with 88 additions and 72 deletions
+2 -1
View File
@@ -186,6 +186,8 @@ void RenderablePath::render(const RenderData& data) {
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(_vertexArray.size()));
glBindVertexArray(0);
glDisable(GL_PROGRAM_POINT_SIZE);
_programObject->deactivate();
}
@@ -197,7 +199,6 @@ void RenderablePath::update(const UpdateData& data) {
calculatePath(_observer);
sendToGPU();
_needsSweep = false;
return;
}
if (_programObject->isDirty())
+1 -2
View File
@@ -23,6 +23,7 @@
****************************************************************************************/
#version __CONTEXT__
layout(location = 0) in vec4 vs_point_position;
layout(location = 1) flat in int isHour;
layout(location = 2) in vec4 vs_point_color;
@@ -43,5 +44,3 @@ void main() {
ABufferStruct_t frag = createGeometryFragment(diffuse, position, depth);
addToBuffer(frag);
}
+84 -68
View File
@@ -31,22 +31,26 @@ uniform vec4 lastPosition;
//this function does not consider cases where w component is negative
float psc_distance(vec4 v1, vec4 v2) {
// reduce position numbers
/*while(v1.w > 1 && v2.w > 1) {
v1.w -= 1;
v2.w -= 1;
} */
// get position in vec3
while(v1.w > 1) {
v1.xyz *= 10;
v1.w -= 1;
}
while(v2.w > 1 ) {
v2.xyz *= 10;
v2.w -= 1;
}
// using native distance function
return distance(v1.xyz, v2.xyz);
// reduce position numbers
/*while(v1.w > 1 && v2.w > 1) {
v1.w -= 1;
v2.w -= 1;
} */
// get position in vec3
if (v1.w > 1) {
float f = floor(v1.w);
v1.xyz *= pow(10, f);
v1.w -= f;
}
if (v2.w > 1) {
float f = floor(v2.w);
v2.xyz *= pow(10, f);
v2.w -= f;
}
// using native distance function
return distance(v1.xyz, v2.xyz);
}
layout(location = 0) in vec4 in_point_position;
@@ -60,59 +64,71 @@ layout(location = 2) out vec4 vs_point_color;
#include "PowerScaling/powerScaling_vs.hglsl"
void main() {
void main() {
vec4 gray = vec4(0.6f, 0.6f, 0.6f, 0.8f);
float cameraTooFar = 1 * pow(k, 10);
float bigPoint = 5.f;
float smallPoint = 2.f;
vec4 tmp = in_point_position;
vec4 position = pscTransform(tmp, ModelTransform);
vs_point_position = tmp;
position = ViewProjection * position;
gl_Position = z_normalization(position);
vec4 gray = vec4(0.6f, 0.6f, 0.6f, 0.8f);
float cameraTooFar = 1 * pow(k, 10);
float bigPoint = 5.f;
float smallPoint = 2.f;
vec4 tmp = in_point_position;
vec4 position = pscTransform(tmp, ModelTransform);
vs_point_position = tmp;
position = ViewProjection * position;
gl_Position = z_normalization(position);
int id = gl_VertexID;
float hour = mod(id, 4);
vs_point_color.xyz = color;
vs_point_color[3] = 1.f;
vec4 v1 = campos;
vec4 v2 = vs_point_position;
float cameraDistance = psc_distance(v1,v2);
int id = gl_VertexID;
float hour = mod(id, 4);
vs_point_color.xyz = color;
vs_point_color[3] = 1.f;
vec4 temp = in_point_position;
vec4 templast = lastPosition;
while(temp.w > 1) {
temp.xyz *= 10;
temp.w -= 1;
}
while(templast.w > 1) {
templast.xyz *= 10;
templast.w -= 1;
}
float observerDistance = length(temp.xyz);
float lastDistance = length(templast.xyz);
if(hour > 0.1f) {
isHour = 0;
vs_point_color = gray;
gl_PointSize = bigPoint;
}
else {
isHour = 1;
gl_PointSize = bigPoint;
}
if (observerDistance > (lastDistance/20)) {
gl_PointSize = smallPoint;
//vs_point_color = gray;
}
/*if (cameraDistance > cameraTooFar ) {
vs_point_color[3] = 0.0f;
}*/
vec4 v1 = campos;
vec4 v2 = vs_point_position;
float cameraDistance = psc_distance(v1,v2);
vec4 temp = in_point_position;
vec4 templast = lastPosition;
if (temp.w > 1) {
float f = floor(temp.w);
temp.w -= f;
temp.xyz *= pow(10, f);
}
if (templast.w > 1) {
float f = floor(templast.w);
templast.w -= f;
templast.xyz *= pow(10, f);
}
// while(temp.w > 1) {
// temp.xyz *= 10;
// temp.w -= 1;
// }
// while(templast.w > 1) {
// templast.xyz *= 10;
// templast.w -= 1;
// }
float observerDistance = length(temp.xyz);
float lastDistance = length(templast.xyz);
if(hour > 0.1f) {
isHour = 0;
vs_point_color = gray;
gl_PointSize = bigPoint;
}
else {
isHour = 1;
gl_PointSize = bigPoint;
}
if (observerDistance > (lastDistance/20)) {
gl_PointSize = smallPoint;
//vs_point_color = gray;
}
/*if (cameraDistance > cameraTooFar ) {
vs_point_color[3] = 0.0f;
}*/
}