MeshLib Documentation
Loading...
Searching...
No Matches
MRRenderVolumeObject.h
Go to the documentation of this file.
1#pragma once
2#include "MRViewerFwd.h"
3#ifndef MRVIEWER_NO_VOXELS
5
8#include "MRMesh/MRBuffer.h"
9#include "MRRenderGLHelpers.h"
10#include "MRRenderHelpers.h"
11
12namespace MR
13{
14class MRVIEWER_CLASS RenderVolumeObject : public virtual IRenderObject
15{
16public:
19
20 virtual bool render( const ModelRenderParams& params ) override;
21 virtual void renderPicker( const ModelBaseRenderParams& params, unsigned geomId ) override;
22 virtual size_t heapBytes() const override;
23 virtual size_t glBytes() const override;
24 virtual void forceBindAll() override;
25
26private:
27 const ObjectVoxels* objVoxels_{ nullptr };
28
29 typedef unsigned int GLuint;
30 GLuint volumeArrayObjId_{ 0 };
31 GlBuffer volumeVertsBuffer_;
32 GlBuffer volumeIndicesBuffer_;
33
34 GlTexture3 volume_;
35 GlTexture2 denseMap_;
36
37 Vector2i activeVoxelsTextureSize_;
38 GlTexture2 activeVoxelsTex_;
39 int maxTexSize_{ 0 };
40
41 // When rendering for picker, `nonPickerParams` will be null and `geomId` will be zero.
42 void render_( const ModelBaseRenderParams& params, const ModelRenderParams* nonPickerParams, unsigned geomId );
43 void bindVolume_( bool picker );
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 RenderBufferRef<unsigned> loadActiveVoxelsTextureBuffer_();
54
55 // Marks dirty buffers that need to be uploaded to OpenGL
56 uint32_t dirty_{ 0 };
57};
58
59}
60#endif
Definition MRIRenderObject.h:134
Definition MRObjectVoxels.h:17
Definition MRRenderVolumeObject.h:15
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:8
Definition MRIRenderObject.h:43
Mesh rendering parameters for primary rendering (as opposed to the picker).
Definition MRIRenderObject.h:51