MCPcopy Create free account
hub / github.com/city-super/Octree-GS / rectangle

Method rectangle

SIBR_viewers/src/core/view/interface/InterfaceUtils.cpp:146–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 void InterfaceUtilities::rectangle(const sibr::Vector3f & color, const UV11 & tl, const UV11 & br, bool fill, float alpha)
147 {
148
149 static sibr::Mesh::Ptr rectangleMesh;
150 static int lastContextId = -1;
151
152 if (lastContextId != sibr::Window::contextId) {
153 rectangleMesh = std::make_shared<sibr::Mesh>(true);
154 };
155
156
157 baseShader.begin();
158
159 scalingGL.set(sibr::Vector2f(1.0f,1.0f));
160 translationGL.set(sibr::Vector2f(0, 0));
161 colorGL.set(color);
162
163 rectangleMesh->vertices({
164 { tl.x(), tl.y() , 0 },
165 { tl.x(), br.y() , 0 },
166 { br.x(), br.y() , 0 },
167 { br.x(), tl.y() , 0 }
168 });
169
170 if (fill) {
171 rectangleMesh->triangles({
172 { 0,1,2 },
173 { 0,2,3 }
174 });
175
176 alphaGL.set(alpha);
177 glEnable(GL_BLEND);
178 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
179 glBlendEquation(GL_FUNC_ADD);
180 rectangleMesh->render(false, false);
181 }
182
183 rectangleMesh->triangles({
184 { 0,0,1 },{ 1,1,2 },{ 2,2,3 },{ 3,3,0 }
185 });
186
187 alphaGL.set(1.0f);
188 rectangleMesh->render(false, false, sibr::Mesh::LineRenderMode);
189
190 baseShader.end();
191 }
192
193 void InterfaceUtilities::rectanglePixels(const sibr::Vector3f & color, const sibr::Vector2f & center, const sibr::Vector2f & diagonal, bool fill, float alpha, const sibr::Vector2f & winSize)
194 {

Callers 3

highlightPixelMethod · 0.45
displayImagesMethod · 0.45
displayZoomMethod · 0.45

Calls 6

verticesMethod · 0.60
trianglesMethod · 0.60
beginMethod · 0.45
setMethod · 0.45
renderMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected