mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 19:01:14 +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+
|
10,11,15, 10,15,14, // Y+
|
||||||
4,5,6, 4,6,7 }; // Z+
|
4,5,6, 4,6,7 }; // Z+
|
||||||
|
|
||||||
VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) :
|
VoxelSystem::VoxelSystem(float treeScale, int maxVoxels)
|
||||||
NodeData(NULL), _treeScale(treeScale), _maxVoxels(maxVoxels) {
|
: NodeData(NULL),
|
||||||
|
_treeScale(treeScale),
|
||||||
|
_maxVoxels(maxVoxels),
|
||||||
|
_initialized(false) {
|
||||||
|
|
||||||
_voxelsInReadArrays = _voxelsInWriteArrays = _voxelsUpdated = 0;
|
_voxelsInReadArrays = _voxelsInWriteArrays = _voxelsUpdated = 0;
|
||||||
_writeRenderFullVBO = true;
|
_writeRenderFullVBO = true;
|
||||||
_readRenderFullVBO = true;
|
_readRenderFullVBO = true;
|
||||||
|
@ -115,22 +119,25 @@ void VoxelSystem::clearFreeBufferIndexes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelSystem::~VoxelSystem() {
|
VoxelSystem::~VoxelSystem() {
|
||||||
delete[] _readVerticesArray;
|
if (_initialized) {
|
||||||
delete[] _writeVerticesArray;
|
// Destroy glBuffers
|
||||||
delete[] _readColorsArray;
|
glDeleteBuffers(1, &_vboVerticesID);
|
||||||
delete[] _writeColorsArray;
|
glDeleteBuffers(1, &_vboNormalsID);
|
||||||
delete[] _writeVoxelDirtyArray;
|
glDeleteBuffers(1, &_vboColorsID);
|
||||||
delete[] _readVoxelDirtyArray;
|
glDeleteBuffers(1, &_vboIndicesID);
|
||||||
|
|
||||||
|
delete[] _readVerticesArray;
|
||||||
|
delete[] _writeVerticesArray;
|
||||||
|
delete[] _readColorsArray;
|
||||||
|
delete[] _writeColorsArray;
|
||||||
|
delete[] _writeVoxelDirtyArray;
|
||||||
|
delete[] _readVoxelDirtyArray;
|
||||||
|
}
|
||||||
|
|
||||||
delete _tree;
|
delete _tree;
|
||||||
pthread_mutex_destroy(&_bufferWriteLock);
|
pthread_mutex_destroy(&_bufferWriteLock);
|
||||||
pthread_mutex_destroy(&_treeLock);
|
pthread_mutex_destroy(&_treeLock);
|
||||||
|
|
||||||
// Destroy glBuffers
|
|
||||||
glDeleteBuffers(1, &_vboVerticesID);
|
|
||||||
glDeleteBuffers(1, &_vboNormalsID);
|
|
||||||
glDeleteBuffers(1, &_vboColorsID);
|
|
||||||
glDeleteBuffers(1, &_vboIndicesID);
|
|
||||||
|
|
||||||
VoxelNode::removeDeleteHook(this);
|
VoxelNode::removeDeleteHook(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,6 +646,7 @@ void VoxelSystem::init() {
|
||||||
|
|
||||||
_perlinModulateProgramInitialized = true;
|
_perlinModulateProgramInitialized = true;
|
||||||
}
|
}
|
||||||
|
_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelSystem::updateFullVBOs() {
|
void VoxelSystem::updateFullVBOs() {
|
||||||
|
|
|
@ -49,9 +49,9 @@ private:
|
||||||
QOpenGLFramebufferObject* createFramebufferObject();
|
QOpenGLFramebufferObject* createFramebufferObject();
|
||||||
|
|
||||||
GLuint _permutationNormalTextureID;
|
GLuint _permutationNormalTextureID;
|
||||||
|
|
||||||
QOpenGLFramebufferObject* _primaryFramebufferObject;
|
|
||||||
GLuint _primaryDepthTextureID;
|
GLuint _primaryDepthTextureID;
|
||||||
|
QOpenGLFramebufferObject* _primaryFramebufferObject;
|
||||||
QOpenGLFramebufferObject* _secondaryFramebufferObject;
|
QOpenGLFramebufferObject* _secondaryFramebufferObject;
|
||||||
QOpenGLFramebufferObject* _tertiaryFramebufferObject;
|
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) {
|
void BandwidthDialog::paintEvent(QPaintEvent* event) {
|
||||||
|
|
||||||
// Update labels
|
// Update labels
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
class BandwidthDialog : public QDialog {
|
class BandwidthDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Sets up the UI based on the configuration of the BandwidthMeter
|
// Sets up the UI based on the configuration of the BandwidthMeter
|
||||||
BandwidthDialog(QWidget* parent, BandwidthMeter* model);
|
BandwidthDialog(QWidget* parent, BandwidthMeter* model);
|
||||||
|
~BandwidthDialog();
|
||||||
|
|
||||||
signals:
|
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) {
|
void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
|
||||||
|
|
||||||
// Update labels
|
// Update labels
|
||||||
|
|
|
@ -19,6 +19,7 @@ class VoxelStatsDialog : public QDialog {
|
||||||
public:
|
public:
|
||||||
// Sets up the UI
|
// Sets up the UI
|
||||||
VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model);
|
VoxelStatsDialog(QWidget* parent, VoxelSceneStats* model);
|
||||||
|
~VoxelStatsDialog();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void closed();
|
void closed();
|
||||||
|
|
Loading…
Reference in a new issue