Merge-in all updates from master

This commit is contained in:
Gene Payne
2024-03-25 18:35:57 -06:00
634 changed files with 13476 additions and 9937 deletions

View File

@@ -26,7 +26,6 @@
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/stringhelper.h>
@@ -57,7 +56,7 @@ void TransferFunction::setPath(const std::string& filepath) {
if (_file) {
_file = nullptr;
}
std::filesystem::path f = absPath(filepath);
const std::filesystem::path f = absPath(filepath);
if (!std::filesystem::is_regular_file(f)) {
LERROR("Could not find transfer function file");
_file = nullptr;
@@ -72,7 +71,7 @@ void TransferFunction::setPath(const std::string& filepath) {
ghoul::opengl::Texture& TransferFunction::texture() {
ghoul_assert(_texture != nullptr, "Transfer function is null");
update();
return *_texture.get();
return *_texture;
}
void TransferFunction::update() {
@@ -128,10 +127,10 @@ void TransferFunction::setTextureFromTxt() {
upper = glm::clamp(upper, lower, 1.f);
}
else if (key == "mappingkey") {
float intensity;
glm::vec4 rgba = glm::vec4(0.f);
float intensity = 0.f;
glm::vec4 rgba;
iss >> intensity;
for(int i = 0; i < 4; ++i) {
for(int i = 0; i < 4; i++) {
iss >> rgba[i];
}
mappingKeys.emplace_back(intensity, rgba);
@@ -153,18 +152,22 @@ void TransferFunction::setTextureFromTxt() {
// allocate new float array with zeros
float* transferFunction = new float[width * 4];
for (int i = 0; i < 4 * width; ++i) {
for (int i = 0; i < 4 * width; i++) {
transferFunction[i] = 0.f;
}
size_t lowerIndex = static_cast<size_t>(floorf(lower * static_cast<float>(width-1)));
size_t upperIndex = static_cast<size_t>(floorf(upper * static_cast<float>(width-1)));
const size_t lowerIndex = static_cast<size_t>(
std::floor(lower * static_cast<float>(width - 1))
);
const size_t upperIndex = static_cast<size_t>(
std::floor(upper * static_cast<float>(width - 1))
);
auto prevKey = mappingKeys.begin();
auto currentKey = prevKey + 1;
auto lastKey = mappingKeys.end() -1;
for (size_t i = lowerIndex; i <= upperIndex; ++i) {
for (size_t i = lowerIndex; i <= upperIndex; i++) {
const float fpos = static_cast<float>(i) / static_cast<float>(width-1);
if (fpos > currentKey->position) {
prevKey = currentKey;