mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
Small bug fixes
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "DataSphere";
|
||||
const int MAX_TEXTURES = 6;
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -155,7 +156,11 @@ bool DataSphere::initialize(){
|
||||
loadTexture();
|
||||
});
|
||||
|
||||
_dataOptions.onChange([this](){ loadTexture();} );
|
||||
_dataOptions.onChange([this](){
|
||||
if(_dataOptions.value().size() > MAX_TEXTURES)
|
||||
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
|
||||
loadTexture();
|
||||
});
|
||||
|
||||
_transferFunctionsFile.onChange([this](){
|
||||
setTransferFunctions(_transferFunctionsFile.value());
|
||||
@@ -257,8 +262,8 @@ bool DataSphere::readyToRender(){
|
||||
|
||||
void DataSphere::setUniformAndTextures(){
|
||||
std::vector<int> selectedOptions = _dataOptions.value();
|
||||
int activeTextures = selectedOptions.size();
|
||||
int activeTransferfunctions = _transferFunctions.size();
|
||||
int activeTextures = std::min((int)selectedOptions.size(), MAX_TEXTURES);
|
||||
int activeTransferfunctions = std::min((int)_transferFunctions.size(), MAX_TEXTURES);
|
||||
|
||||
ghoul::opengl::TextureUnit txUnits[10];
|
||||
int j = 0;
|
||||
@@ -272,6 +277,8 @@ void DataSphere::setUniformAndTextures(){
|
||||
);
|
||||
|
||||
j++;
|
||||
if(j >= MAX_TEXTURES) break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,6 +314,7 @@ void DataSphere::setUniformAndTextures(){
|
||||
);
|
||||
|
||||
j++;
|
||||
if(j >= MAX_TEXTURES) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,8 +353,10 @@ void DataSphere::setTransferFunctions(std::string tfPath){
|
||||
tfs.push_back(tf);
|
||||
}
|
||||
}
|
||||
tfFile.close();
|
||||
}
|
||||
|
||||
|
||||
if(!tfs.empty()){
|
||||
_transferFunctions.clear();
|
||||
_transferFunctions = tfs;
|
||||
|
||||
Reference in New Issue
Block a user