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

Method renderPicker

source/MRViewer/MRRenderPointsObject.cpp:132–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132void RenderPointsObject::renderPicker( const ModelBaseRenderParams& parameters, unsigned geomId )
133{
134 MR_TIMER;
135 if ( !Viewer::constInstance()->isGLInitialized() )
136 {
137 objPoints_->resetDirty();
138 return;
139 }
140 update_();
141
142 if ( !objPoints_->hasVisualRepresentation() )
143 return;
144
145 GL_EXEC( glViewport( ( GLsizei )0, ( GLsizei )0, ( GLsizei )parameters.viewport.z, ( GLsizei )parameters.viewport.w ) );
146
147 bindPointsPicker_();
148
149 auto shader = GLStaticHolder::getShaderId( GLStaticHolder::Picker );
150
151 GL_EXEC( glUniformMatrix4fv( glGetUniformLocation( shader, "model" ), 1, GL_TRUE, parameters.modelMatrix.data() ) );
152 GL_EXEC( glUniformMatrix4fv( glGetUniformLocation( shader, "view" ), 1, GL_TRUE, parameters.viewMatrix.data() ) );
153 GL_EXEC( glUniformMatrix4fv( glGetUniformLocation( shader, "proj" ), 1, GL_TRUE, parameters.projMatrix.data() ) );
154
155 GL_EXEC( glUniform1ui( glGetUniformLocation( shader, "primBucketSize" ), 1 ) );
156
157 GL_EXEC( glUniform1i( glGetUniformLocation( shader, "useClippingPlane" ), objPoints_->globalClippedByPlane( parameters.viewportId ) ) );
158 GL_EXEC( glUniform4f( glGetUniformLocation( shader, "clippingPlane" ),
159 parameters.clipPlane.n.x, parameters.clipPlane.n.y, parameters.clipPlane.n.z, parameters.clipPlane.d ) );
160 GL_EXEC( glUniform1ui( glGetUniformLocation( shader, "uniGeomId" ), geomId ) );
161#ifdef __EMSCRIPTEN__
162 GL_EXEC( glUniform1f( glGetUniformLocation( shader, "pointSize" ), objPoints_->getPointSize() ) );
163#else
164 GL_EXEC( glPointSize( objPoints_->getPointSize() ) );
165#endif
166 GL_EXEC( glDepthFunc( getDepthFunctionLess( parameters.depthFunction ) ) );
167 GL_EXEC( glDrawElements( GL_POINTS, ( GLsizei )validIndicesSize_, GL_UNSIGNED_INT, 0 ) );
168 GL_EXEC( glDepthFunc( getDepthFunctionLess( DepthFunction::Default ) ) );
169}
170
171size_t RenderPointsObject::heapBytes() const
172{

Callers

nothing calls this directly

Calls 6

constInstanceFunction · 0.85
getDepthFunctionLessFunction · 0.85
resetDirtyMethod · 0.80
dataMethod · 0.45
getPointSizeMethod · 0.45

Tested by

no test coverage detected