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

Function getPickerFragmentShader

source/MRViewer/MRShaderBlocks.cpp:7–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5{
6
7std::string getPickerFragmentShader( bool points, bool cornerMode )
8{
9 const std::string head =
10 MR_GLSL_VERSION_LINE R"(
11 precision highp float;
12 precision highp int;
13 uniform bool useClippingPlane;
14 uniform vec4 clippingPlane;
15 uniform uint uniGeomId;
16
17 in vec3 world_pos;
18
19 in float primitiveIdf0;
20 in float primitiveIdf1;
21
22 out highp uvec4 color;
23)";
24
25 const std::string primId =
26 cornerMode ? R"(
27 uint primitiveId = ( uint(primitiveIdf1) << 20u ) + uint(primitiveIdf0);
28)" : R"(
29 uint primitiveId = uint(gl_PrimitiveID);
30)";
31
32 const std::string tail = R"(
33 color.r = primitiveId;
34
35 color.g = uniGeomId;
36
37 color.a = uint(gl_FragCoord.z * 4294967295.0);
38)";
39
40 return
41 head +
42 getShaderMainBeginBlock( false ) +
43 ( points ? getFragmentShaderPointSizeBlock() : R"()" ) +
44 getFragmentShaderClippingBlock() +
45 primId +
46 tail +
47 getFragmentShaderEndBlock( ShaderTransparencyMode::None );
48}
49
50std::string getFragmentShaderClippingBlock()
51{

Callers 1

createShader_Method · 0.85

Tested by

no test coverage detected