Adapt to new Ghoul; fix previously undetected errors in uniform setting

This commit is contained in:
Alexander Bock
2021-02-11 14:44:13 +01:00
parent 548d673e8b
commit 88122d1dbb
6 changed files with 24 additions and 15 deletions

View File

@@ -438,13 +438,11 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
);
_program->setUniform(
_uniformCache.lightIntensities,
_lightIntensitiesBuffer.data(),
nLightSources
_lightIntensitiesBuffer
);
_program->setUniform(
_uniformCache.lightDirectionsViewSpace,
_lightDirectionsViewSpaceBuffer.data(),
nLightSources
_lightDirectionsViewSpaceBuffer
);
_program->setUniform(
_uniformCache.modelViewTransform,

View File

@@ -481,7 +481,7 @@ void RenderablePlanetProjection::imageProjectGPU(
if (_geometry->hasProperty("Radius")) {
std::any r = _geometry->property("Radius")->get();
if (glm::vec3* radius = std::any_cast<glm::vec3>(&r)){
_fboProgramObject->setUniform(_fboUniformCache.radius, radius);
_fboProgramObject->setUniform(_fboUniformCache.radius, *radius);
}
}
else {

View File

@@ -135,8 +135,8 @@ void BasicVolumeRaycaster::preRaycast(const RaycastData& data,
int nClips = static_cast<int>(clipNormals.size());
program.setUniform("nClips_" + id, nClips);
program.setUniform("clipNormals_" + id, clipNormals.data(), nClips);
program.setUniform("clipOffsets_" + id, clipOffsets.data(), nClips);
program.setUniform("clipNormals_" + id, clipNormals);
program.setUniform("clipOffsets_" + id, clipOffsets);
program.setUniform("opacity_" + id, _opacity);
program.setUniform("rNormalization_" + id, _rNormalization);
program.setUniform("rUpperBound_" + id, _rUpperBound);

View File

@@ -101,11 +101,15 @@ void GenerateRawVolumeTask::perform(const Task::ProgressCallback& progressCallba
ghoul::lua::LuaState state;
ghoul::lua::runScript(state, _valueFunctionLua);
#if (defined(NDEBUG) || defined(DEBUG))
ghoul::lua::verifyStackSize(state, 1);
#endif
int functionReference = luaL_ref(state, LUA_REGISTRYINDEX);
#if (defined(NDEBUG) || defined(DEBUG))
ghoul::lua::verifyStackSize(state, 0);
#endif
glm::vec3 domainSize = _upperDomainBound - _lowerDomainBound;
@@ -117,14 +121,18 @@ void GenerateRawVolumeTask::perform(const Task::ProgressCallback& progressCallba
glm::vec3 coord = _lowerDomainBound +
glm::vec3(cell) / glm::vec3(_dimensions) * domainSize;
#if (defined(NDEBUG) || defined(DEBUG))
ghoul::lua::verifyStackSize(state, 0);
#endif
lua_rawgeti(state, LUA_REGISTRYINDEX, functionReference);
lua_pushnumber(state, coord.x);
lua_pushnumber(state, coord.y);
lua_pushnumber(state, coord.z);
#if (defined(NDEBUG) || defined(DEBUG))
ghoul::lua::verifyStackSize(state, 4);
#endif
if (lua_pcall(state, 3, 1, 0) != LUA_OK) {
return;

View File

@@ -129,17 +129,20 @@ namespace openspace::documentation {
const std::string DocumentationEntry::Wildcard = "*";
std::string concatenate(const std::vector<TestResult::Offense>& offenses) {
std::string result = "Error in specification (";
for (const TestResult::Offense& o : offenses) {
result += o.offender + ',';
}
result.back() = ')';
return result;
}
SpecificationError::SpecificationError(TestResult res, std::string comp)
: ghoul::RuntimeError("Error in specification", std::move(comp))
: ghoul::RuntimeError(concatenate(res.offenses), std::move(comp))
, result(std::move(res))
{
ghoul_assert(!result.success, "Result's success must be false");
message += " (";
for (const TestResult::Offense& o : result.offenses) {
message += o.offender + ',';
}
message.back() = ')';
}
DocumentationEntry::DocumentationEntry(std::string k, std::shared_ptr<Verifier> v,