Rain is a game/graphics engine built to be intuitive and easy to use. Rain aims to also be free of any all-encompassing traits, instead letting you decide how to use it and when to start using your own code to interact with OpenGL.
I believe it would be best for these setters to scale the object with regards to its rotation, the getters already do, getting the length between specific points in the object or returning a backing field for keeping track of the value.
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:varmodels=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.varscene=new Scene(models);// In the GameWindow class:// Shaders could potentially be customizable, but for now use generic shaders for the whole program.varrenderer=new Renderer();// Draw all data given from scene.
renderer.Draw(scene);
By using an array of buffer sizes we can create vertex attributes with new sizes and skip over all previous vertices while calling draw functions in a loop.
When rendering a Solid produced by the Prism class (and quite possibly the Pyramid class as well) using the Scene.Draw() method, it only actually renders the first face.
Currently the code required to render a shape, especially a three dimensional one, is extremely cumbersome needing a Texture to be applied to each one in order to create a TexturedFace. IRenderables should be allowed to render without being provided a Texture. For untextured faces we can still use a Texture for now, but keep the IsEmpty property set to true, have Scene.Draw() check for this and omit the Textrue.Upload() call.
Constructors of other objects should have this empty texture as a default value so taht it can be omitted in construction as well.
Create Face class to be used as base for TexturedFace.
Should implement a constructor with a number of sides and a size (preferably a kind of diameter, being the length from a vertex to the center to another vertex in one straight line) as parameters and produces an equilateral with that number of sides. It may be necessary to make a Point in the center of the Equilateral and make n number of triangles, using the center point and side, in the case this is needed it should only be stored internally for rendering as the center Point should interfere with the Prism.MakePrism() and Pyramid.MakePyramid() methods.
The Solid.Rotate(float angle, Axes axis) overload method does not actually rotate around the center (currently only observed on axis: Axes.X and axis: Axes.Y). Exact reason is unknown but is likely something to do with the pre and post-rotate translations applied to the Solid.
Replace ITwoDimensional * TransformMatrix and RenderableBase * TransformMatrix with a Point[] * TransformMatrix and Vertex[] * TransformMatrix operators.
I would like to make it in such a way that there is a pyramid and prism class, each of which can be constructed with any ITwoDimensional. Other shapes can be added independently.
/// <summary> Gets a pointer to the data for a buffer of <c>type</c>. </summary>/// <param name="type"> The type of <c>Buffer</c> this pointer should be used in. </param>/// <returns> An <c>IntPtr</c> object. </returns>public IntPtr GetPointer(BufferTypetype){// If I am not mistaken, using ToArray() will copy the data, rather than reference it, effectively doubling the// required memory. TODO: find a way to remove duplicates of vertex and element data as they could easily be very// large in size.if(type== BufferType.VertexBuffer){vertexHandle= GCHandle.Alloc(vertexMemory.ToArray(), GCHandleType.Pinned);return vertexHandle.AddrOfPinnedObject();}else{elementHandle= GCHandle.Alloc(vertexMemory.ToArray(), GCHandleType.Pinned);return elementHandle.AddrOfPinnedObject();}}