Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refined README.md #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
2. basic key bindings, e.g. esc->quit
3. using texture with stb_image
4. use imgui for interaction
5. work with cmake
6. Updating into OpenGL3 with GLSL.
7. Allowing many interaction based on ImGui(for graphics study).
5. work with cmake (submodule, external depedencies)
6. Updating into OpenGL3 with GLSL, with GLFW
7. Basic algorithms: Float param, Halfedge structure(still caution with boundary)

### TODO:
1. add light (commonly good for light) settings, summarize those rendering things into imgui.
2. Allow more man-graphics interaction (mouse rasting)
3. Integral algorithms like meshlab.
4. Add more things I know: multy threads, argparser, json file for rendering, ply loader(![happly](happly))
5. CMake Tests and run time config(and loader)
6. More intuitive rotation.(4-dim numbers).
7. github workflows (and submodules for cross platform)
8. LICENSE(finally)
1. Package many things(light, material, shader, texture) into one `GL` object to manage, and allow more graphics lab.
2. Allow more human-graphics interaction (mouse rasting => select vertices, faces, change shapes, rotate => Hamilton number)
3. Using more fancy libs: argparser, json loader(for scenerio); make more concept about config.
4. More fancy algorithms: (marching cubes, ray tracing).
5. More modern things (tiny-cuda-nn).
### Main reference
Mainly learnt from [polyscope](), [libigl](), [learnopengl], thanks to all of them! without who I will never be able to play on such an amazing graphics playground.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/gl_egine/include/gl_egine.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class GL
}
public:
int add_obj(){

}

public:
Expand Down
64 changes: 60 additions & 4 deletions src/gl_egine/include/vertices.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,79 @@ class Vertices
int vao_ID;
int vbo_ID;
int veo_ID;
int n_faces;
float *vbo;
private:
void assign(float* vbo_, unsigned int element, unsigned delta, std::vector<glm::vec3>& vx, std::vector<glm::ivec3> fx){
for (int i = 0; i < fx.size(); i++)
{
glm::vec3 va = v[f[i].x];
glm::vec3 vb = v[f[i].y];
glm::vec3 vc = v[f[i].z];
vbo[i*3*element + element*0 + delta + 0]=va.x, vbo[i*3*element + element*0 + delta + 1]=va.y, vbo[i*3*element + element*0 + delta + 2]=va.z;
vbo[i*3*element + element*1 + delta + 0]=va.x, vbo[i*3*element + element*1 + delta + 1]=va.y, vbo[i*3*element + element*1 + delta + 2]=va.z;
vbo[i*3*element + element*2 + delta + 0]=va.x, vbo[i*3*element + element*2 + delta + 1]=va.y, vbo[i*3*element + element*2 + delta + 2]=va.z;
}
}

void assign(float* vbo_, unsigned int element, unsigned delta, std::vector<glm::vec2>& vx, std::vector<glm::ivec3> fx){
for (int i = 0; i < fx.size(); i++)
{
glm::vec3 va = v[f[i].x];
glm::vec3 vb = v[f[i].y];
glm::vec3 vc = v[f[i].z];
vbo[i*3*element + element*0 + delta + 0]=va.x, vbo[i*3*element + element*0 + delta + 1]=va.y;
vbo[i*3*element + element*1 + delta + 0]=va.x, vbo[i*3*element + element*1 + delta + 1]=va.y;
vbo[i*3*element + element*2 + delta + 0]=va.x, vbo[i*3*element + element*2 + delta + 1]=va.y;
}
}

public:
Vertices(std::vector<glm::vec3>& v, std::vector<glm::vec3>& f){
float a;
vbo = new float[3*(3+2+3)*f.size()];
assign(vbo, 8, 0, v, f);
n_faces = f.size();
};
Vertices(std::vector<glm::vec3>& v, std::vector<glm::vec3>& f, std::vector<glm::vec3>& vt, std::vector<glm::vec3>& ft){
vbo = new float[3*(3+2+3)*f.size()];
assign(vbo, 8, 0, v, f);
n_faces = f.size();
assign(vbo, 8, 3, vt, ft);

}

Vertices(std::vector<glm::vec3>& v, std::vector<glm::vec3>& f, std::vector<glm::vec3>& vt, std::vector<glm::vec3>& ft, std::vector<glm::vec3>& vn, std::vector<glm::vec3>& fn){

vbo = new float[3*(3+2+3)*f.size()];
assign(vbo, 8, 0, v, f);
n_faces = f.size();
assign(vbo, 8, 3, vt, ft);
assign(vbo, 8, 5, vn, fn);
}
~Vertices(){};
public:
void load(){
glGenBuffers(1, &vbo_ID);
glBindBuffer(GL_ARRAY_BUFFER, vbo_ID);
glBufferData(GL_ARRAY_BUFFER, sizeof(vbo), vbo, GL_STATIC_DRAW);
delete vbo;

glGenVertexArrays(1, &vao_ID);
glBindVertexArray(vao_ID);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void*)0);
glEnableVertexAttribArray(0);

glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 8*sizeof(float), (void*)(3*sizeof(float)));
glEnableVertexAttribArray(1);
};
void bind(){

glBindBuffer(GL_ARRAY_BUFFER, vbo_ID);
glBindVertexArray(vao_ID);
}
void render(){
if(false)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDrawArrays(GL_TRIANGLES, 0, 3*f.size());
}
};