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

Rewrite current classes to follow more logical structure #8

Closed
an-prata opened this issue Jun 27, 2022 · 1 comment · Fixed by #9
Closed

Rewrite current classes to follow more logical structure #8

an-prata opened this issue Jun 27, 2022 · 1 comment · Fixed by #9
Assignees
Labels
rework Rewrite to existing features to improve performance, maintainability, or consistency

Comments

@an-prata
Copy link
Owner

  • Scene (Should contain all shape and texture data needed to render)
    • Renderable Objects
      • Textured Faces Struct (responsible for keeping duplicate textures within a single model to a minimum, should be able to take an index, correlating to a face, and give back that face and its texture)
        • Textures (Produced by, and reliant on shaders)
          • An OpenGL Handle
          • An Image (can be disposed of after calling GL.TexImage2D())
        • 2 Dimensional Faces
          • Points
            • Vertices
            • Colors
            • Texture Coordinates (for an untextured face all texture coordinates should be 0,0)
        • An integer array where indices correlate to indices for the 2D Faces, and the value to a Textures index
  • Renderer
    • Buffers
      • A Vertex Buffer
      • An Element Buffer
    • Shader Program
      • An OpenGL Handle
      • A Vertex Shader
      • A Fragment Shader

By the end of all this the code needed to use it should look similar in nature to the following.

// In code using the library:

var models = new Renderable[]
{
    new Cube(location, sideLength, color)
};

// You could repeat this for all faces, any not manually assigned should be given empty textures.
models[0].Faces[0].AddTexture("texture.bmp");

// models should still be writable in some capacity at this point.
var scene = new Scene(models);

// In the GameWindow class:

// Shaders could potentially be customizable, but for now use generic shaders for the whole program.
var renderer = new Renderer();

// Draw all data given from scene.
renderer.Draw(scene);
@an-prata an-prata added the rework Rewrite to existing features to improve performance, maintainability, or consistency label Jun 27, 2022
@an-prata an-prata self-assigned this Jun 27, 2022
@an-prata
Copy link
Owner Author

Textures should be handed to OpenGL in the Renderer class rather than in the Renderable/Model class since shaders will be loaded at that time.

@an-prata an-prata linked a pull request Jun 27, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rework Rewrite to existing features to improve performance, maintainability, or consistency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant