MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / getVolumePickerFragmentShader

Function getVolumePickerFragmentShader

source/MRViewer/MRVolumeShader.cpp:303–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303std::string getVolumePickerFragmentShader()
304{
305 return MR_GLSL_VERSION_LINE R"(
306 precision highp float;
307 precision highp int;
308
309 uniform mat4 model;
310 uniform mat4 view;
311 uniform mat4 proj;
312
313 uniform vec4 viewport;
314 uniform vec3 voxelSize;
315 uniform vec3 minCorner;
316 uniform float minValue;
317 uniform float maxValue;
318 uniform float step;
319
320 uniform int shadingMode; // 0-none,1-dense grad,2-alpha grad
321
322 uniform highp sampler3D volume;
323 uniform highp sampler2D denseMap;
324
325 uniform highp usampler2D activeVoxels; // (in from base) selection BitSet
326 uniform bool useClippingPlane; // (in from base) clip primitive by plane if true
327 uniform vec4 clippingPlane; // (in from base) clipping plane
328
329 uniform uint uniGeomId;
330 out highp uvec4 outColor;
331)"
332+ getVolumeShaderCommonFunctions() +
333R"(
334
335 bool normalEye( in vec3 textCoord, in vec3 dimStepVoxel, in bool alphaGrad )
336 {
337 float minXVal = getVal( texture( volume, textCoord - vec3(dimStepVoxel.x,0,0)).r );
338 float maxXVal = getVal( texture( volume, textCoord + vec3(dimStepVoxel.x,0,0)).r );
339 float minYVal = getVal( texture( volume, textCoord - vec3(0,dimStepVoxel.y,0)).r );
340 float maxYVal = getVal( texture( volume, textCoord + vec3(0,dimStepVoxel.y,0)).r );
341 float minZVal = getVal( texture( volume, textCoord - vec3(0,0,dimStepVoxel.z)).r );
342 float maxZVal = getVal( texture( volume, textCoord + vec3(0,0,dimStepVoxel.z)).r );
343 if ( alphaGrad )
344 {
345 minXVal = getGradAlphaVal( minXVal );
346 maxXVal = getGradAlphaVal( maxXVal );
347 minYVal = getGradAlphaVal( minYVal );
348 maxYVal = getGradAlphaVal( maxYVal );
349 minZVal = getGradAlphaVal( minZVal );
350 maxZVal = getGradAlphaVal( maxZVal );
351 }
352 vec3 grad = -vec3( maxXVal - minXVal, maxYVal - minYVal, maxZVal - minZVal );
353 return dot( grad, grad ) >= 1.0e-5;
354 }
355
356 void main()
357 {
358 mat4 fullM = proj * view * model;
359 mat4 inverseFullM = inverse( fullM );
360

Callers 1

createShader_Method · 0.85

Calls 1

Tested by

no test coverage detected