correct orientation
This commit is contained in:
@@ -45,8 +45,8 @@ public:
|
||||
u_color = glGetUniformLocation(program, "color");
|
||||
|
||||
const int N = 3;
|
||||
const Mults &mults = schlafli<N>({4, 3});
|
||||
vert_data = vertices<N>(mults, {1, 1, 1});
|
||||
const Mults &mults = schlafli<N>({5, 3});
|
||||
vert_data = vertices<N>(mults, {10, 1, 1});
|
||||
edge_data = edges<N>(mults);
|
||||
face_data = faces<N>(mults);
|
||||
|
||||
@@ -89,9 +89,9 @@ public:
|
||||
|
||||
std::cout << "verts: " << vert_data.size() << std::endl;
|
||||
std::cout << "vendor: " << glGetString(GL_VENDOR) << std::endl
|
||||
<< "renderer: " << glGetString(GL_RENDERER) << std::endl
|
||||
<< "version: " << glGetString(GL_VERSION) << std::endl
|
||||
<< "shading version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||
<< "renderer: " << glGetString(GL_RENDERER) << std::endl
|
||||
<< "version: " << glGetString(GL_VERSION) << std::endl
|
||||
<< "shading version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||
}
|
||||
|
||||
void render() override {
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
const auto ax_1 = glm::vec3(0, 0, 1);
|
||||
const auto ax_2 = glm::vec3(.5, 1, 0.2);
|
||||
const auto t = glfwGetTime();
|
||||
const auto angle = (float) t / 2;
|
||||
const auto angle = (float) t / 5;
|
||||
|
||||
const float sc = 1.5f;
|
||||
const float ar = (float) w / (float) h;
|
||||
@@ -123,8 +123,8 @@ public:
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glPointSize(6.0f);
|
||||
glLineWidth(3.0f);
|
||||
glPointSize(10.0f);
|
||||
glLineWidth(5.0f);
|
||||
|
||||
glBindVertexArray(vert_vao);
|
||||
glUniform4f(u_color, 1, 0, 0, 1);
|
||||
@@ -136,10 +136,7 @@ public:
|
||||
|
||||
glBindVertexArray(face_vao);
|
||||
glCullFace(GL_BACK);
|
||||
glUniform4f(u_color, .3, .3, .3, 1);
|
||||
glDrawElements(GL_TRIANGLES, face_data.size(), GL_UNSIGNED_INT, 0);
|
||||
glCullFace(GL_FRONT);
|
||||
glUniform4f(u_color, .8, .8, .8, 1);
|
||||
glUniform4f(u_color, 1, 1, 1, 1);
|
||||
glDrawElements(GL_TRIANGLES, face_data.size(), GL_UNSIGNED_INT, 0);
|
||||
|
||||
swapbuffers();
|
||||
|
||||
@@ -70,15 +70,11 @@ std::vector<int> faces(const Mults &mults) {
|
||||
|
||||
Table *t_vert = solve<N>({}, mults);
|
||||
|
||||
// todo: try the combinations individually and try to find the pattern.
|
||||
|
||||
// for each *kind* of face
|
||||
// std::vector<int> sg_face{0,1};
|
||||
for (const auto &sg_face : combinations(N, 2)) {
|
||||
Table *cs_face = solve<N>(sg_face, mults);
|
||||
|
||||
// for each *kind* of edge
|
||||
// std::vector<int> sg_edge{1};
|
||||
for (const auto &sg_edge : combinations(sg_face, 1)) {
|
||||
Table *cs_edge = solve(sg_face, sg_edge, mults);
|
||||
|
||||
@@ -99,10 +95,14 @@ std::vector<int> faces(const Mults &mults) {
|
||||
}
|
||||
res.push_back(t_vert->apply(0, c_face));
|
||||
|
||||
int s = c_edge.size() + sg_edge[0];
|
||||
int t = c_face.size() + sg_face[0] + sg_face[1];
|
||||
if (c_edge.size() & 1u)
|
||||
std::swap(res[res.size() - 1], res[res.size() - 2]);
|
||||
|
||||
if (s % 2 == 0 xor t % 2 == 0) {
|
||||
unsigned ro_si1 = (sg_face[0] + sg_face[1]);
|
||||
unsigned flag = sg_edge[0] == sg_face[0];
|
||||
unsigned n_mirrors = c_face.size();
|
||||
|
||||
if ((n_mirrors + flag + ro_si1) & 1u) {
|
||||
std::swap(res[res.size() - 1], res[res.size() - 2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
glfwWindowHint(GLFW_ALPHA_BITS, 8);
|
||||
|
||||
|
||||
_window = glfwCreateWindow(640, 480, "GLFW App", nullptr, nullptr);
|
||||
_window = glfwCreateWindow(1920, 1080, "GLFW App", nullptr, nullptr);
|
||||
if (!_window) {
|
||||
fprintf(stderr, "Failed to create window;");
|
||||
glfwTerminate();
|
||||
|
||||
Reference in New Issue
Block a user