MeshLib Documentation
Loading...
Searching...
No Matches
MRRenderLinesObject.h
Go to the documentation of this file.
1#pragma once
2#include "exports.h"
5#include <MRMesh/MRId.h>
6#include "MRGLStaticHolder.h"
7#include "MRRenderGLHelpers.h"
8#include "MRRenderHelpers.h"
9
10namespace MR
11{
12class RenderLinesObject : public virtual IRenderObject
13{
14public:
17
18 virtual bool render( const ModelRenderParams& params ) override;
19 virtual void renderPicker( const ModelBaseRenderParams& params, unsigned geomId ) override;
20 virtual size_t heapBytes() const override;
21 virtual size_t glBytes() const override;
22 virtual void forceBindAll() override;
23
24private:
25 const ObjectLinesHolder* objLines_ = nullptr;
26 int lineIndicesSize_{ 0 };
27
28 typedef unsigned int GLuint;
29
30 GLuint linesArrayObjId_{ 0 };
31 GLuint linesPickerArrayObjId_{ 0 };
32
33 GlTexture2 positionsTex_;
34 GlTexture2 vertColorsTex_;
35 GlTexture2 lineColorsTex_;
36
37 void render_( const ModelRenderParams& params, bool points );
38 void renderPicker_( const ModelBaseRenderParams& params, unsigned geomId, bool points );
39
40 void bindPositions_( GLuint shaderId );
41
42 void bindLines_( GLStaticHolder::ShaderType shaderType );
43 void bindLinesPicker_( GLStaticHolder::ShaderType shaderType );
44
45 // Create a new set of OpenGL buffer objects
46 void initBuffers_();
47
48 // Release the OpenGL buffer objects
49 void freeBuffers_();
50
51 void update_();
52
53 // Marks dirty buffers that need to be uploaded to OpenGL
54 uint32_t dirty_;
55};
56
57// Returns the range of line widths that are allowed by current renderer
58MRVIEWER_API const Vector2f& GetAvailableLineWidthRange();
59
60}
ShaderType
Definition MRGLStaticHolder.h:16
Definition MRIRenderObject.h:134
Definition MRObjectLinesHolder.h:19
Definition MRRenderLinesObject.h:13
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
virtual size_t glBytes() const override
returns the amount of memory this object allocated in OpenGL
RenderLinesObject(const VisualObject &visObj)
virtual bool render(const ModelRenderParams &params) override
virtual void forceBindAll() override
binds all data for this render object, not to bind ever again (until object becomes dirty)
virtual void renderPicker(const ModelBaseRenderParams &params, unsigned geomId) override
Visual Object.
Definition MRVisualObject.h:131
Definition MRCameraOrientationPlugin.h:8
MRVIEWER_API const Vector2f & GetAvailableLineWidthRange()
Definition MRIRenderObject.h:43
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:51