Skip to content

Commit

Permalink
It now works, but after a few seconds the debug halts, saying abort w…
Browse files Browse the repository at this point in the history
…as called

Not clear why
  • Loading branch information
Robadob committed Oct 19, 2024
1 parent 6ec944e commit 13f8513
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/flamegpu/visualiser/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ void Draw::save(bool replaceExisting) {
requiredLength += tState.count;
stateDirectory.insert({ tName, std::move(tState) });
}
bool Draw::has(const std::string &name) {
return stateDirectory.find(name) != stateDirectory.end();
}
Draw::State Draw::_save(bool isTemporary) {
if (tType == Type::Lines && tVertices.size() % 2 != 0) {
THROW VisAssert("Draw::_save(): Line drawings require an even number of vertices.\n");
Expand Down
4 changes: 4 additions & 0 deletions src/flamegpu/visualiser/Draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class Draw : Renderable {
* @throw Throws a runtime exception if called whilst the draw state is not open
*/
void save(bool replaceExisting = false);
/**
* Check whether a drawing with the name exists.
**/
bool has(const std::string &name);
/**
* Renders a saved drawstate
* @param name The name of the draw state to render
Expand Down
8 changes: 5 additions & 3 deletions src/flamegpu/visualiser/Visualiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ Visualiser::Visualiser(const ModelConfig& modelcfg)
// Process lines
for (auto &line : modelcfg.lines) {
addLine(lines_static, line, std::to_string(totalLines++), false);
}
}/*
for (auto& [name, line] : modelcfg.dynamic_lines) {
addLine(lines_dynamic, line, name, false);
}
}*/
// Default lighting, single point light attached to camera
// Maybe in future let user specify lights instead of this
{
Expand Down Expand Up @@ -468,7 +468,9 @@ void Visualiser::render() {
for (unsigned int i = 0; i < totalLines; ++i)
lines_static->render(std::to_string(i));
for (const auto &[name, _] : modelConfig.dynamic_lines)
lines_dynamic->render(name);
// Dynamic lines may begin uninitialised
if (lines_dynamic->has(name))
lines_dynamic->render(name);
GL_CALL(glDisable(GL_BLEND));
}
GL_CALL(glViewport(0, 0, windowDims.x, windowDims.y));
Expand Down
1 change: 1 addition & 0 deletions src/flamegpu/visualiser/config/ModelConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ModelConfig &ModelConfig::operator=(const ModelConfig &other) {
isPython = other.isPython;
isOrtho = other.isOrtho;
orthoZoom = other.orthoZoom;
dynamic_lines = other.dynamic_lines; // Here because they are probably empty at construction, so addLine() can't be used
// staticModels
// lines
// panels
Expand Down

0 comments on commit 13f8513

Please sign in to comment.