mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-28 16:09:46 -06:00
Memory leak fix
This commit is contained in:
@@ -36,13 +36,14 @@ function postInitialization()
|
||||
|
||||
--openspace.iswa.addCygnet(-4,"Data");
|
||||
|
||||
--penspace.iswa.addCygnet(-1,"Data");
|
||||
--openspace.iswa.addCygnet(-1,"Data");
|
||||
--openspace.iswa.addCygnet(-2,"Data");
|
||||
--openspace.iswa.addCygnet(-3,"Data");
|
||||
|
||||
openspace.iswa.addCygnet(-3,"Data","GM");
|
||||
--openspace.iswa.addCygnet(-2,"Data","GM");
|
||||
--openspace.iswa.addCygnet(-1,"Data","GM");
|
||||
--openspace.iswa.addCygnet(-3,"Data","GM");
|
||||
|
||||
|
||||
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
|
||||
|
||||
|
||||
@@ -186,6 +186,7 @@ bool DataPlane::loadTexture() {
|
||||
|
||||
_dataBuffer = "";
|
||||
_dataBuffer.append(dataFile.buffer, dataFile.size);
|
||||
delete[] dataFile.buffer;
|
||||
}
|
||||
|
||||
// if the buffer in the datafile is empty, do not proceed
|
||||
@@ -209,6 +210,8 @@ bool DataPlane::loadTexture() {
|
||||
bool texturesReady = false;
|
||||
std::vector<int> selectedOptions = _dataOptions.value();
|
||||
|
||||
|
||||
|
||||
for(int option: selectedOptions){
|
||||
float* values = data[option];
|
||||
if(!values) continue;
|
||||
|
||||
@@ -180,6 +180,7 @@ bool DataSphere::loadTexture(){
|
||||
|
||||
_dataBuffer = "";
|
||||
_dataBuffer.append(dataFile.buffer, dataFile.size);
|
||||
delete[] dataFile.buffer;
|
||||
}
|
||||
|
||||
// if the buffer in the datafile is empty, do not proceed
|
||||
|
||||
@@ -188,7 +188,7 @@ void IswaCygnet::render(const RenderData& data){
|
||||
void IswaCygnet::update(const UpdateData& data){
|
||||
_openSpaceTime = Time::ref().currentTime();
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
_stateMatrix = TransformationManager::ref().frameTransformationMatrix(_data->frame, "GALACTIC", _openSpaceTime);
|
||||
_stateMatrix = TransformationManager::ref().frameTransformationMatrix(_data->frame, "GALACTIC", _openSpaceTime);
|
||||
|
||||
bool timeToUpdate = (fabs(_openSpaceTime-_lastUpdateOpenSpaceTime) >= _data->updateTime &&
|
||||
(_realTime.count()-_lastUpdateRealTime.count()) > _minRealTimeUpdateInterval);
|
||||
@@ -204,7 +204,10 @@ void IswaCygnet::update(const UpdateData& data){
|
||||
_textureDirty = true;
|
||||
}
|
||||
|
||||
if(_textureDirty) loadTexture();
|
||||
if(_textureDirty) {
|
||||
loadTexture();
|
||||
_textureDirty = false;
|
||||
}
|
||||
|
||||
if(!_transferFunctions.empty())
|
||||
for(auto tf : _transferFunctions)
|
||||
|
||||
@@ -62,7 +62,8 @@ bool TexturePlane::loadTexture() {
|
||||
if(_futureObject.valid() && DownloadManager::futureReady(_futureObject)){
|
||||
imageFile = _futureObject.get();
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -73,18 +74,17 @@ bool TexturePlane::loadTexture() {
|
||||
(void*) imageFile.buffer,
|
||||
imageFile.size,
|
||||
imageFile.format);
|
||||
// delete[] (char*) imageFile.buffer;
|
||||
// if (texture) {
|
||||
// LDEBUG("Loaded texture from image iswa cygnet with id: '" << _data->id << "'");
|
||||
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from image iswa cygnet with id: '" << _data->id << "'");
|
||||
// texture->uploadTexture();
|
||||
// // Textures of planets looks much smoother with AnisotropicMipMap rather than linear
|
||||
// texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
// _textures[0] = std::move(texture);
|
||||
// }
|
||||
|
||||
texture->uploadTexture();
|
||||
// Textures of planets looks much smoother with AnisotropicMipMap rather than linear
|
||||
texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
|
||||
_textures[0] = std::move(texture);
|
||||
}
|
||||
|
||||
return false;
|
||||
// return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user