MeshLib
 
Loading...
Searching...
No Matches
MRRenderVolumeObject.h
Go to the documentation of this file.
1#pragma once
2#include "MRMesh/MRMeshFwd.h"
3#ifndef MRMESH_NO_OPENVDB
6#include "MRMesh/MRBuffer.h"
7#include "MRRenderGLHelpers.h"
8#include "MRRenderHelpers.h"
9
10namespace MR
11{
12class MRVIEWER_CLASS RenderVolumeObject : 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 ObjectVoxels* objVoxels_{ nullptr };
26
27 typedef unsigned int GLuint;
28 GLuint volumeArrayObjId_{ 0 };
29 GlBuffer volumeVertsBuffer_;
30 GlBuffer volumeIndicesBuffer_;
31
32 GlTexture3 volume_;
33 GlTexture2 denseMap_;
34
35 Vector2i activeVoxelsTextureSize_;
36 GlTexture2 activeVoxelsTex_;
37 int maxTexSize_{ 0 };
38
39 // When rendering for picker, `nonPickerParams` will be null and `geomId` will be zero.
40 void render_( const ModelBaseRenderParams& params, const ModelRenderParams* nonPickerParams, unsigned geomId );
41 void bindVolume_( bool picker );
42
43 // Create a new set of OpenGL buffer objects
44 void initBuffers_();
45
46 // Release the OpenGL buffer objects
47 void freeBuffers_();
48
49 void update_();
50
51 RenderBufferRef<unsigned> loadActiveVoxelsTextureBuffer_();
52
53 // Marks dirty buffers that need to be uploaded to OpenGL
54 uint32_t dirty_{ 0 };
55};
56
57}
58#endif
Definition MRIRenderObject.h:133
Definition MRObjectVoxels.h:17
Definition MRRenderVolumeObject.h:13
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
RenderVolumeObject(const VisualObject &visObj)
virtual void forceBindAll() override
binds all data for this render object, not to bind ever again (until object becomes dirty)
virtual bool render(const ModelRenderParams &params) override
virtual size_t glBytes() const override
returns the amount of memory this object allocated in OpenGL
virtual void renderPicker(const ModelBaseRenderParams &params, unsigned geomId) override
Visual Object.
Definition MRVisualObject.h:131
Definition MRCameraOrientationPlugin.h:7
Definition MRIRenderObject.h:42
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:50