MeshLib Documentation
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
7namespace MR
8{
9class RenderPointsObject : public virtual IRenderObject
10{
11public:
14
15 virtual bool render( const ModelRenderParams& params ) override;
16 virtual void renderPicker( const ModelBaseRenderParams& params, unsigned geomId ) override;
17 virtual size_t heapBytes() const override;
18 virtual size_t glBytes() const override;
19 virtual void forceBindAll() override;
20private:
21 const ObjectPointsHolder* objPoints_;
22
23 int vertPosSize_{ 0 };
24 int vertNormalsSize_{ 0 };
25 int vertColorsSize_{ 0 };
26 int validIndicesSize_{ 0 };
27 Vector2i vertSelectionTextureSize_;
28
29 int cachedRenderDiscretization_{ 1 };
30
31 RenderBufferRef<Vector3f> loadVertPosBuffer_();
32 RenderBufferRef<Vector3f> loadVertNormalsBuffer_();
33 RenderBufferRef<Color> loadVertColorsBuffer_();
34 RenderBufferRef<VertId> loadValidIndicesBuffer_();
35 RenderBufferRef<unsigned> loadVertSelectionTextureBuffer_();
36
37 typedef unsigned int GLuint;
38 GLuint pointsArrayObjId_{ 0 };
39 GLuint pointsPickerArrayObjId_{ 0 };
40
41 GlBuffer vertPosBuffer_;
42 GlBuffer vertNormalsBuffer_;
43 GlBuffer vertColorsBuffer_;
44 GlBuffer validIndicesBuffer_;
45
46 GlTexture2 vertSelectionTex_;
47
48 int maxTexSize_{ 0 };
49
50 void bindPoints_( bool alphaSort );
51 void bindPointsPicker_();
52
53 // Create a new set of OpenGL buffer objects
54 void initBuffers_();
55
56 // Release the OpenGL buffer objects
57 void freeBuffers_();
58
59 void update_();
60
61 bool hasNormalsBackup_{ false };
62
63 // Marks dirty buffers that need to be uploaded to OpenGL
64 uint32_t dirty_;
65};
66
67}
Definition MRIRenderObject.h:134
Definition MRObjectPointsHolder.h:18
Definition MRRenderPointsObject.h:10
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:131
Definition MRCameraOrientationPlugin.h:8
Definition MRIRenderObject.h:43
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:51