MeshLib C++ Docs
Loading...
Searching...
No Matches
MRRenderPointsObject.h
Go to the documentation of this file.
1#pragma once
2
4#include "MRRenderGLHelpers.h"
5#include "MRRenderHelpers.h"
6#include "MRGLStaticHolder.h"
7
8namespace MR
9{
10class RenderPointsObject : 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 virtual size_t heapBytes() const override;
19 virtual size_t glBytes() const override;
20 virtual void forceBindAll() override;
21private:
22 const ObjectPointsHolder* objPoints_;
23
24 int vertPosSize_{ 0 };
25 int vertNormalsSize_{ 0 };
26 int vertColorsSize_{ 0 };
27 int validIndicesSize_{ 0 };
28 Vector2i vertSelectionTextureSize_;
29
30 int cachedRenderDiscretization_{ 1 };
31
32 RenderBufferRef<Vector3f> loadVertPosBuffer_();
33 RenderBufferRef<Vector3f> loadVertNormalsBuffer_();
34 RenderBufferRef<Color> loadVertColorsBuffer_();
35 RenderBufferRef<VertId> loadValidIndicesBuffer_();
36 RenderBufferRef<unsigned> loadVertSelectionTextureBuffer_();
37
38 typedef unsigned int GLuint;
39 GLuint pointsArrayObjId_{ 0 };
40 GLuint pointsPickerArrayObjId_{ 0 };
41
42 GlBuffer vertPosBuffer_;
43 GlBuffer vertNormalsBuffer_;
44 GlBuffer vertColorsBuffer_;
45 GlBuffer validIndicesBuffer_;
46
47 GlTexture2 vertSelectionTex_;
48
49 int maxTexSize_{ 0 };
50
51 void bindPoints_( GLStaticHolder::ShaderType shaderType );
52 void bindPointsPicker_();
53
54 // Create a new set of OpenGL buffer objects
55 void initBuffers_();
56
57 // Release the OpenGL buffer objects
58 void freeBuffers_();
59
60 void update_();
61
62 bool hasNormalsBackup_{ false };
63
64 // Marks dirty buffers that need to be uploaded to OpenGL
65 uint32_t dirty_;
66};
67
68}
ShaderType
Definition MRGLStaticHolder.h:16
Definition MRIRenderObject.h:131
Definition MRObjectPointsHolder.h:21
Definition MRRenderPointsObject.h:11
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
RenderPointsObject(const VisualObject &visObj)
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
virtual bool render(const ModelRenderParams &params) override
virtual size_t glBytes() const override
returns the amount of memory this object allocated in OpenGL
Visual Object.
Definition MRVisualObject.h:119
Definition MRCameraOrientationPlugin.h:8
Definition MRIRenderObject.h:43
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:51