Git Product home page Git Product logo

an-prata / rain Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 1.33 MB

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.

License: MIT License

C# 93.25% GLSL 1.98% PowerShell 2.38% Shell 2.39%
game-engine graphics opengl

rain's Introduction

Top Languages

rain's People

Contributors

an-prata avatar spinny2005 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

spinny2005

rain's Issues

Rewrite current classes to follow more logical structure

  • 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);

Rework IRenderable creation so that Textures can be omitted in favor of solid colors

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.
  • #36
  • Have RenderableBase use Face rather that TexturedFace.
  • Adapt Scene.Draw() method to render without Texture objects.

Add Equilateral class for creating shapes of n sides of equal length

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.

Rotation methods do not rotate around object's center

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.

Add classes for 3D shapes

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.

Avoid use of Memory<T>.ToArray() as it copies rather than references memory

/// <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(BufferType type)
{
	// 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();
	}	
}

(Rain.Engine/Scene.cs)

The Memory.<T>ToArray() call copies rather than references memory, which could effectively double required memory. Consider replacements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.