Skip to content

Commit

Permalink
Fix NULLGL.
Browse files Browse the repository at this point in the history
  • Loading branch information
t-paul committed Feb 17, 2022
1 parent 8d1fa8a commit 864443d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 32 deletions.
29 changes: 0 additions & 29 deletions src/NULLGL.cc
Expand Up @@ -12,35 +12,6 @@ void GLView::showCrosshairs(const Color4f& col) {}
void GLView::setColorScheme(const ColorScheme& cs){assert(false && "not implemented");}
void GLView::setColorScheme(const std::string& cs) {assert(false && "not implemented");}

#include "ThrownTogetherRenderer.h"

ThrownTogetherRenderer::ThrownTogetherRenderer(shared_ptr<class CSGProducts> root_products,
shared_ptr<CSGProducts> highlight_products,
shared_ptr<CSGProducts> background_products) {}
void ThrownTogetherRenderer::draw(bool showfaces, bool showedges) const {}
BoundingBox ThrownTogetherRenderer::getBoundingBox() const
{
assert(false && "not implemented");
return BoundingBox();
}
void ThrownTogetherRenderer::renderCSGProducts(const CSGProducts& products, bool highlight_mode, bool background_mode, bool showedges,
bool fberror) const {}
void ThrownTogetherRenderer::renderChainObject(const class CSGChainObject& csgobj, bool highlight_mode,
bool background_mode, bool showedges, bool fberror, OpenSCADOperator type) const {}

#include "CGALRenderer.h"

CGALRenderer::CGALRenderer(shared_ptr<const class Geometry> geom) {}
CGALRenderer::~CGALRenderer() {}
void CGALRenderer::draw(bool showfaces, bool showedges) const {}
BoundingBox CGALRenderer::getBoundingBox() const {
assert(false && "not implemented");
return BoundingBox();
}
void CGALRenderer::setColorScheme(const ColorScheme& cs){assert(false && "not implemented");}



#include "system-gl.h"

double gl_version() { return -1; }
Expand Down
10 changes: 10 additions & 0 deletions src/export_png.cc
Expand Up @@ -6,6 +6,8 @@
#include "polyset.h"
#include "rendersettings.h"

#ifndef NULLGL

#ifdef ENABLE_CGAL
#include "cgal.h"
#include "cgalutils.h"
Expand Down Expand Up @@ -104,3 +106,11 @@ bool export_png(const OffscreenView& glview, std::ostream& output)
}

#endif // ENABLE_CGAL

#else // NULLGL

bool export_png(const shared_ptr<const Geometry>& root_geom, const ViewOptions& options, Camera& camera, std::ostream& output) { return false; }
std::unique_ptr<OffscreenView> prepare_preview(Tree& tree, const ViewOptions& options, Camera& camera) { return nullptr; }
bool export_png(const OffscreenView& glview, std::ostream& output) { return false; }

#endif // NULLGL
16 changes: 13 additions & 3 deletions src/renderer.cc
Expand Up @@ -12,6 +12,8 @@
#include "grid.h"
#include <Eigen/LU>

#ifndef NULLGL

Renderer::Renderer() : colorscheme(nullptr)
{
PRINTD("Renderer() start");
Expand Down Expand Up @@ -262,7 +264,6 @@ static void draw_triangle(const Renderer::shaderinfo_t *shaderinfo, const Vector
}
#endif // ifdef ENABLE_OPENCSG

#ifndef NULLGL
static void draw_tri(const Vector3d& p0, const Vector3d& p1, const Vector3d& p2, double z, bool mirror)
{
glVertex3d(p0[0], p0[1], p0[2] + z);
Expand Down Expand Up @@ -456,9 +457,18 @@ void Renderer::render_edges(const PolySet& ps, csgmode_e csgmode) const
glEnable(GL_LIGHTING);
}


#else //NULLGL
static void gl_draw_triangle(const Renderer::shaderinfo_t *shaderinfo, const Vector3d& p0, const Vector3d& p1, const Vector3d& p2, bool e0, bool e1, bool e2, double z, bool mirrored) {}

Renderer::Renderer() : colorscheme(nullptr) {}
void Renderer::resize(int /*w*/, int /*h*/) {}
bool Renderer::getColor(Renderer::ColorMode colormode, Color4f& col) const { return false; }
std::string Renderer::loadShaderSource(const std::string& name) { return ""; }
Renderer::csgmode_e Renderer::get_csgmode(const bool highlight_mode, const bool background_mode, const OpenSCADOperator type) const { return {}; }
void Renderer::setColor(const float color[4], const shaderinfo_t *shaderinfo) const {}
Color4f Renderer::setColor(ColorMode colormode, const float color[4], const shaderinfo_t *shaderinfo) const { return {}; }
void Renderer::setColor(ColorMode colormode, const shaderinfo_t *shaderinfo) const {}
void Renderer::setColorScheme(const ColorScheme& cs) {}
void Renderer::render_surface(const PolySet& ps, csgmode_e csgmode, const Transform3d& m, const shaderinfo_t *shaderinfo) const {}
void Renderer::render_edges(const PolySet& ps, csgmode_e csgmode) const {}

#endif //NULLGL

0 comments on commit 864443d

Please sign in to comment.