MeshLib
 
Loading...
Searching...
No Matches
MRRenderLabelObject.h
Go to the documentation of this file.
1#pragma once
3#include "MRMesh/MRVector2.h"
4#include "MRRenderGLHelpers.h"
5#include "MRRenderHelpers.h"
6#include "MRMesh/MRBox.h"
7
8namespace MR
9{
10class RenderLabelObject : public virtual IRenderObject
11{
12public:
15
16 virtual bool render( const ModelRenderParams& params ) override;
17 virtual void renderPicker( const ModelBaseRenderParams& params, unsigned geomId ) override;
18
19 virtual size_t heapBytes() const override;
20 virtual size_t glBytes() const override;
21
22 virtual void forceBindAll() override;
23
24private:
25 const ObjectLabel* objLabel_;
26
27 int faceIndicesSize_{ 0 };
28
29 RenderBufferRef<Vector3i> loadFaceIndicesBuffer_();
30
31 typedef unsigned int GLuint;
32
33 GLuint labelArrayObjId_{ 0 };
34 GlBuffer vertPosBuffer_;
35 GlBuffer facesIndicesBuffer_;
36
37 GLuint srcArrayObjId_{ 0 };
38 GlBuffer srcVertPosBuffer_;
39 GlBuffer srcIndicesBuffer_;
40 GlTexture2 srcIndicesSelectionTex_;
41
42 GLuint bgArrayObjId_{ 0 };
43 GlBuffer bgVertPosBuffer_;
44 GlBuffer bgFacesIndicesBuffer_;
45
46 GLuint llineArrayObjId_{ 0 };
47 GlBuffer llineVertPosBuffer_;
48 GlBuffer llineEdgesIndicesBuffer_;
49
50 void renderSourcePoint_( const ModelRenderParams& renderParams );
51 void renderBackground_( const ModelRenderParams& renderParams );
52 void renderLeaderLine_( const ModelRenderParams& renderParams );
53
54 void bindLabel_();
55
56 // Create a new set of OpenGL buffer objects
57 void initBuffers_();
58
59 // Release the OpenGL buffer objects
60 void freeBuffers_();
61
62 void update_();
63
64 // Marks dirty buffers that need to be uploaded to OpenGL
65 uint32_t dirty_;
66 bool dirtySrc_;
67 bool dirtyBg_;
68 bool dirtyLLine_;
69 Vector3f positionState_;
70 Vector2f pivotPointState_;
71 float backgroundPaddingState_;
72 Box3f meshBox_;
73};
74
75}
Box given by its min- and max- corners.
Definition MRBox3.h:8
Definition MRIRenderObject.h:133
Definition MRObjectLabel.h:25
Definition MRRenderHelpers.h:16
Definition MRRenderLabelObject.h:11
virtual void forceBindAll() override
binds all data for this render object, not to bind ever again (until object becomes dirty)
virtual size_t glBytes() const override
returns the amount of memory this object allocated in OpenGL
RenderLabelObject(const VisualObject &visObj)
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
virtual void renderPicker(const ModelBaseRenderParams &params, unsigned geomId) override
virtual bool render(const ModelRenderParams &params) override
Visual Object.
Definition MRVisualObject.h:131
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
Definition MRCameraOrientationPlugin.h:7
Definition MRIRenderObject.h:42
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:50