fix issue where some projected 5d wires cross over w=4

This commit is contained in:
2020-05-23 11:03:36 -04:00
parent 350ee5652f
commit 47f8da7192
2 changed files with 35 additions and 75 deletions

View File

@@ -2,7 +2,7 @@
layout(location=2) uniform vec3 col; layout(location=2) uniform vec3 col;
layout(location=0) in vec3 pos; layout(location=0) in vec4 pos;
layout(location=2) in vec3 normal; layout(location=2) in vec3 normal;
out vec4 color; out vec4 color;

View File

@@ -207,52 +207,6 @@ struct DirectRenderer : public Renderer<N> {
} }
}; };
//struct WireframeRenderer : public DirectRenderer<2> {
// WireframeRenderer() : DirectRenderer<2>() {
// cgl::pgm::vert direct_stereo = cgl::pgm::vert::file(
// "shaders/direct-ortho.vs.glsl");
// cgl::pgm::frag solid = cgl::pgm::frag::file(
// "shaders/solid.fs.glsl");
//
// glProgramUniform3f(solid, 2, .3f, .3f, .3f);
//
// this->pipe.stage(direct_stereo);
// this->pipe.stage(solid);
// }
//};
//
//struct WireframeStereoRenderer : public WireframeRenderer {
// WireframeStereoRenderer() : WireframeRenderer() {
// cgl::pgm::vert direct_stereo = cgl::pgm::vert::file(
// "shaders/direct-stereo.vs.glsl");
// cgl::pgm::frag solid = cgl::pgm::frag::file(
// "shaders/solid.fs.glsl");
//
// glProgramUniform3f(solid, 2, .3f, .3f, .4f);
//
// this->pipe.stage(direct_stereo);
// this->pipe.stage(solid);
// }
//};
//
//struct WireframeStereoCurveRenderer : public WireframeStereoRenderer {
// WireframeStereoCurveRenderer() : WireframeStereoRenderer() {
// cgl::pgm::vert direct_stereo = cgl::pgm::vert::file(
// "shaders/direct-stereo.vs.glsl");
// cgl::pgm::geom curve = cgl::pgm::geom::file(
// "shaders/curve-stereo.gm.glsl"
// );
// cgl::pgm::frag solid = cgl::pgm::frag::file(
// "shaders/solid.fs.glsl");
//
// glProgramUniform3f(solid, 2, .4f, .3f, .3f);
//
// this->pipe.stage(direct_stereo);
// this->pipe.stage(curve);
// this->pipe.stage(solid);
// }
//};
struct WireframeProp : public Prop<2> { struct WireframeProp : public Prop<2> {
vec3 color; vec3 color;
@@ -320,6 +274,8 @@ void run(const std::string &config_file, GLFWwindow *window) {
state.dimension = scene["dimension"].as<int>(); state.dimension = scene["dimension"].as<int>();
const float NORM_SCALE = 0.8; // to keep things from crossing above w=1 after being projected down from 5d -> 4d.
for (const auto &group_info : scene["groups"]) { for (const auto &group_info : scene["groups"]) {
auto symbol = group_info["symbol"].as<std::vector<int>>(); auto symbol = group_info["symbol"].as<std::vector<int>>();
auto group = tc::schlafli(symbol); auto group = tc::schlafli(symbol);
@@ -335,6 +291,8 @@ void run(const std::string &config_file, GLFWwindow *window) {
exclude = slice_info["exclude"].as<std::vector<std::vector<int>>>(); exclude = slice_info["exclude"].as<std::vector<std::vector<int>>>();
} }
root = root * NORM_SCALE;
if (slice_info["subgroups"].IsDefined()) { if (slice_info["subgroups"].IsDefined()) {
auto subgroups = slice_info["subgroups"].as<std::vector<std::vector<int>>>(); auto subgroups = slice_info["subgroups"].as<std::vector<std::vector<int>>>();
sRen.props.push_back(SliceProp<4>::build( sRen.props.push_back(SliceProp<4>::build(
@@ -361,6 +319,8 @@ void run(const std::string &config_file, GLFWwindow *window) {
exclude = wire_info["exclude"].as<std::vector<std::vector<int>>>(); exclude = wire_info["exclude"].as<std::vector<std::vector<int>>>();
} }
root = root * NORM_SCALE;
if (wire_info["subgroups"].IsDefined()) { if (wire_info["subgroups"].IsDefined()) {
auto subgroups = wire_info["subgroups"].as<std::vector<std::vector<int>>>(); auto subgroups = wire_info["subgroups"].as<std::vector<std::vector<int>>>();