mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 05:42:53 +02:00
Fixed ui related files memory wastes
This commit is contained in:
parent
7688dc4779
commit
06119990e8
6 changed files with 38 additions and 17 deletions
|
@ -51,8 +51,12 @@ GLubyte identityIndices[] = { 0,2,1, 0,3,2, // Z-
|
|||
10,11,15, 10,15,14, // Y+
|
||||
4,5,6, 4,6,7 }; // Z+
|
||||
|
||||
VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) :
|
||||
NodeData(NULL), _treeScale(treeScale), _maxVoxels(maxVoxels) {
|
||||
VoxelSystem::VoxelSystem(float treeScale, int maxVoxels)
|
||||
: NodeData(NULL),
|
||||
_treeScale(treeScale),
|
||||
_maxVoxels(maxVoxels),
|
||||
_initialized(false) {
|
||||
|
||||
_voxelsInReadArrays = _voxelsInWriteArrays = _voxelsUpdated = 0;
|
||||
_writeRenderFullVBO = true;
|
||||
_readRenderFullVBO = true;
|
||||
|
@ -115,22 +119,25 @@ void VoxelSystem::clearFreeBufferIndexes() {
|
|||
}
|
||||
|
||||
VoxelSystem::~VoxelSystem() {
|
||||
delete[] _readVerticesArray;
|
||||
delete[] _writeVerticesArray;
|
||||
delete[] _readColorsArray;
|
||||
delete[] _writeColorsArray;
|
||||
delete[] _writeVoxelDirtyArray;
|
||||
delete[] _readVoxelDirtyArray;
|
||||
if (_initialized) {
|
||||
// Destroy glBuffers
|
||||
glDeleteBuffers(1, &_vboVerticesID);
|
||||
glDeleteBuffers(1, &_vboNormalsID);
|
||||
glDeleteBuffers(1, &_vboColorsID);
|
||||
glDeleteBuffers(1, &_vboIndicesID);
|
||||
|
||||
delete[] _readVerticesArray;
|
||||
delete[] _writeVerticesArray;
|
||||
delete[] _readColorsArray;
|
||||
delete[] _writeColorsArray;
|
||||
delete[] _writeVoxelDirtyArray;
|
||||
delete[] _readVoxelDirtyArray;
|
||||
}
|
||||
|
||||
delete _tree;
|
||||
pthread_mutex_destroy(&_bufferWriteLock);
|
||||
pthread_mutex_destroy(&_treeLock);
|
||||
|
||||
// Destroy glBuffers
|
||||
glDeleteBuffers(1, &_vboVerticesID);
|
||||
glDeleteBuffers(1, &_vboNormalsID);
|
||||
glDeleteBuffers(1, &_vboColorsID);
|
||||
glDeleteBuffers(1, &_vboIndicesID);
|
||||
|
||||
VoxelNode::removeDeleteHook(this);
|
||||
}
|
||||
|
||||
|
@ -639,6 +646,7 @@ void VoxelSystem::init() {
|
|||
|
||||
_perlinModulateProgramInitialized = true;
|
||||
}
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
void VoxelSystem::updateFullVBOs() {
|
||||
|
|
|
@ -49,9 +49,9 @@ private:
|
|||
QOpenGLFramebufferObject* createFramebufferObject();
|
||||
|
||||
GLuint _permutationNormalTextureID;
|
||||
|
||||
QOpenGLFramebufferObject* _primaryFramebufferObject;
|
||||
|
||||
GLuint _primaryDepthTextureID;
|
||||
QOpenGLFramebufferObject* _primaryFramebufferObject;
|
||||
QOpenGLFramebufferObject* _secondaryFramebufferObject;
|
||||
QOpenGLFramebufferObject* _tertiaryFramebufferObject;
|
||||
};
|
||||
|
|
|
@ -38,6 +38,12 @@ BandwidthDialog::BandwidthDialog(QWidget* parent, BandwidthMeter* model) :
|
|||
}
|
||||
}
|
||||
|
||||
BandwidthDialog::~BandwidthDialog() {
|
||||
for (int i = 0; i < BandwidthMeter::N_STREAMS; ++i) {
|
||||
delete _labels[i];
|
||||
}
|
||||
}
|
||||
|
||||
void BandwidthDialog::paintEvent(QPaintEvent* event) {
|
||||
|
||||
// Update labels
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
class BandwidthDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
// Sets up the UI based on the configuration of the BandwidthMeter
|
||||
BandwidthDialog(QWidget* parent, BandwidthMeter* model);
|
||||
~BandwidthDialog();
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -53,6 +53,12 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model) :
|
|||
}
|
||||
}
|
||||
|
||||
VoxelStatsDialog::~VoxelStatsDialog() {
|
||||
for (int i = 0; i <(int)VoxelSceneStats::ITEM_COUNT; ++i) {
|
||||
delete _labels[i];
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
|
||||
|
||||
// Update labels
|
||||
|
|
|
@ -19,6 +19,7 @@ class VoxelStatsDialog : public QDialog {
|
|||
public:
|
||||
// Sets up the UI
|
||||
VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model);
|
||||
~VoxelStatsDialog();
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
|
|
Loading…
Reference in a new issue