Commit 0f47a9a8 authored by Frédéric Larue's avatar Frédéric Larue

Bug fixed in SelectionManagerMeshFaces.

parent 2f0d30b7
......@@ -12,11 +12,11 @@ const char* SelectionManagerMeshFaces::s_DisplayShaderVSH =
"in vec3 vertexPosition;"
"out float idFloat;"
"flat out int id;"
"void main()"
"{"
" idFloat = float( gl_VertexID / 3 );"
" id = gl_VertexID / 3;"
" gl_Position = u_ProjectionMatrix * u_ModelViewMatrix * vec4(vertexPosition,1.0f);"
"}";
......@@ -29,15 +29,13 @@ const char* SelectionManagerMeshFaces::s_DisplayShaderGSH =
"uniform sampler2D u_SelectionTexture;"
"in float idFloat[];"
"flat in int id[];"
"void main()"
"{"
" int id = int( idFloat[0] );"
" ivec2 bufferSize = textureSize( u_SelectionTexture, 0 );"
" float screenX = float( id % bufferSize.x ) + 0.5;"
" float screenY = float( id / bufferSize.x ) + 0.5;"
" float screenX = float( id[0] % bufferSize.x ) + 0.5;"
" float screenY = float( id[0] / bufferSize.x ) + 0.5;"
" vec2 texCoords = vec2(screenX,screenY) / vec2(bufferSize);"
" float selectionMask = texture(u_SelectionTexture,texCoords).x;"
......@@ -71,11 +69,11 @@ const char* SelectionManagerMeshFaces::s_SelectionShaderVSH =
"#version 330\n"
"in vec3 vertexPosition;"
"out float idFloat;"
"flat out int id;"
"void main()"
"{"
" idFloat = float( gl_VertexID / 3 );"
" id = gl_VertexID / 3;"
" gl_Position = vec4( vertexPosition, 1.0 );"
"}";
......@@ -89,7 +87,7 @@ const char* SelectionManagerMeshFaces::s_SelectionShaderGSH =
"uniform ivec2 u_OutBufferSize;"
"in float idFloat[];"
"flat in int id[];"
"vec3 getClippingCoordinates( vec3 );"
"bool isInsideViewport( vec3 );"
......@@ -112,10 +110,8 @@ const char* SelectionManagerMeshFaces::s_SelectionShaderGSH =
" passCullingTest(bary,faceNor) &&"
" passOcclusionTest(bary) )"
" {"
" int faceId = int( idFloat[0] );"
" float screenX = float( faceId % u_OutBufferSize.x ) + 0.5;"
" float screenY = float( faceId / u_OutBufferSize.x ) + 0.5;"
" float screenX = float( id[0] % u_OutBufferSize.x ) + 0.5;"
" float screenY = float( id[0] / u_OutBufferSize.x ) + 0.5;"
" gl_Position = vec4( 2.0 * screenX/float(u_OutBufferSize.x) - 1.0, 2.0 * screenY/float(u_OutBufferSize.y) - 1.0, 0.0, 1.0 );"
" EmitVertex();"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment