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{
12
13class RenderPointsObject : public virtual IRenderObject
14{
15public:
18
19 virtual bool render( const ModelRenderParams& params ) override;
20 virtual void renderPicker( const ModelBaseRenderParams& params, unsigned geomId ) override;
21 virtual size_t heapBytes() const override;
22 virtual size_t glBytes() const override;
23 virtual void forceBindAll() override;
24private:
25 const ObjectPointsHolder* objPoints_;
26
27 int vertPosSize_{ 0 };
28 int vertNormalsSize_{ 0 };
29 int vertColorsSize_{ 0 };
30 int validIndicesSize_{ 0 };
31 Vector2i vertSelectionTextureSize_;
32
33 int cachedRenderDiscretization_{ 1 };
34
35 RenderBufferRef<Vector3f> loadVertPosBuffer_();
36 RenderBufferRef<Vector3f> loadVertNormalsBuffer_();
37 RenderBufferRef<Color> loadVertColorsBuffer_();
38 RenderBufferRef<VertId> loadValidIndicesBuffer_();
39 RenderBufferRef<unsigned> loadVertSelectionTextureBuffer_();
40
41 typedef unsigned int GLuint;
42 GLuint pointsArrayObjId_{ 0 };
43 GLuint pointsPickerArrayObjId_{ 0 };
44
45 GlBuffer vertPosBuffer_;
46 GlBuffer vertNormalsBuffer_;
47 GlBuffer vertColorsBuffer_;
48 GlBuffer validIndicesBuffer_;
49
50 GlTexture2 vertSelectionTex_;
51
52 int maxTexSize_{ 0 };
53
54 void bindPoints_( GLStaticHolder::ShaderType shaderType );
55 void bindPointsPicker_();
56
58 void initBuffers_();
59
61 void freeBuffers_();
62
63 void update_();
64
65 bool hasNormalsBackup_{ false };
66
68 uint32_t dirty_;
69};
70
71}
Definition MRIRenderObject.h:134
Definition MRObjectPointsHolder.h:24
Definition MRRenderPointsObject.h:14
Visual Object.
Definition MRVisualObject.h:116
ShaderType
Definition MRGLStaticHolder.h:19
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
Returns true if something was rendered, or false if nothing to render.
virtual size_t glBytes() const override
returns the amount of memory this object allocated in OpenGL
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRIRenderObject.h:46
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:54