All Projects → weigert → Tinyengine

weigert / Tinyengine

Tiny OpenGL Wrapper / 3D Engine in C++

Projects that are alternatives of or similar to Tinyengine

Qfusion
Source code for cross-platform OpenGL gaming engine
Stars: ✭ 255 (+1.59%)
Mutual labels:  game-engine, game-engine-3d, opengl, 3d-engine
Xray 16
Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. Join OpenXRay! ;)
Stars: ✭ 1,806 (+619.52%)
Mutual labels:  game-engine, engine, opengl, 3d-engine
Innocenceengine
Cross-platform modern game engine.
Stars: ✭ 149 (-40.64%)
Mutual labels:  game-engine, engine, opengl
Raz
Modern & multiplatform game engine in C++17
Stars: ✭ 161 (-35.86%)
Mutual labels:  game-engine, opengl, 3d-engine
Simplerenderengine
Small C++14 render engine
Stars: ✭ 253 (+0.8%)
Mutual labels:  game-engine, opengl, shaders
Klayge
KlayGE is a cross-platform open source game engine with plugin-based architecture.
Stars: ✭ 1,646 (+555.78%)
Mutual labels:  game-engine, engine, opengl
Gamedev Resources
🎮 🎲 A wonderful list of Game Development resources.
Stars: ✭ 2,054 (+718.33%)
Mutual labels:  game-engine, engine, 3d-engine
Vxr
General purpose engine written in C++ with emphasis on materials rendering (PBR, clear coat, anisotropy, iridescence)
Stars: ✭ 181 (-27.89%)
Mutual labels:  game-engine, engine, opengl
Engine
Go 3D Game Engine
Stars: ✭ 1,362 (+442.63%)
Mutual labels:  game-engine, opengl, 3d-engine
Engine
A basic cross-platform 3D game engine
Stars: ✭ 208 (-17.13%)
Mutual labels:  game-engine, engine, opengl
Vulkan Renderer
A new 3D game engine using modern C++ and Vulkan API
Stars: ✭ 205 (-18.33%)
Mutual labels:  game-engine, engine, 3d-engine
Joymachine Public
All sorts of random publicly-available information, assets, scripts, and more as we (Joy Machine) work on our projects.
Stars: ✭ 210 (-16.33%)
Mutual labels:  game-engine, engine, shaders
Lionengine
Java 2D Game Engine
Stars: ✭ 106 (-57.77%)
Mutual labels:  game-engine, engine, audio
Openage
Free (as in freedom) open source clone of the Age of Empires II engine 🚀
Stars: ✭ 10,712 (+4167.73%)
Mutual labels:  game-engine, engine, opengl
Voxelman
Plugin-based client-server voxel game engine written in D language
Stars: ✭ 105 (-58.17%)
Mutual labels:  game-engine, engine, opengl
Protogame
This project has been sunset as of 1st Jan 2018 and is no longer supported or maintained
Stars: ✭ 166 (-33.86%)
Mutual labels:  game-engine, engine, shaders
Permafrost Engine
An OpenGL RTS game engine written in C
Stars: ✭ 851 (+239.04%)
Mutual labels:  game-engine, game-engine-3d, opengl
Photonbox
A portable modern OpenGL Game-Engine with focus on PBR
Stars: ✭ 93 (-62.95%)
Mutual labels:  game-engine, engine, opengl
Fishengine
Simple, Unity-like Game Engine.
Stars: ✭ 191 (-23.9%)
Mutual labels:  game-engine, engine, opengl
Etlegacy
ET: Legacy is an open source project based on the code of Wolfenstein: Enemy Territory which was released in 2010 under the terms of the GPLv3 license.
Stars: ✭ 212 (-15.54%)
Mutual labels:  game-engine, game-engine-3d, opengl

TinyEngine

Small OpenGL based 2D/3D Engine / Wrapper in C++

Rendering Example Program Simple generated perlin-noise heightmap rendered with normal vectors as colors (Example Program 2)

LINES OF CODE (without unreasonable compression):

	Main File: 103
	Main Classes: 264
	Utility Classes: 579
	Helpers Namespaces: 199
	Total: 1145

History:
	12. Apr 2020: 885
	29. Apr 2020: 1116
	17. May 2020: 1667
	23. May 2020: 1065
            01. Aug 2020: 1145
            21. Feb 2021: 1378

Description

Based on many previous OpenGL projects, I have a good idea of what features I need in an engine to build visually appealing visualizations of generated data. Many of the projects had the same overarching structure, and used the same OpenGL wrapping structures. This engine unifies those basic concepts.

The goal of this "engine" is to act as an intuitive wrapper for boilerplate OpenGL, allowing for quick and easy development of 2D / 3D visualizations of generated data. I also want to keep it as small as possible, giving only necessary abstractions of boilerplate OpenGL code, and doing the rest with user-defined behaviors passed to the engine.

This is also a learning project, for practicing engine / systems design. This is not intended as an optimized game development library, but can be used to generate beatiful visualizations of generated data.

If anybody likes the structure, they are free to adopt it or recommended additions / changes.

As I continue to build projects using this engine, I plan on slowly expanding its feature set, as long as new features fit elegantly into the overall structure and offer a large amount of functionality for little additional effort.

Multi-Julia Animation

Animated Julia-Set (Example 4). See my blog here.

Structure

The main engine interface is wrapped in a namespace Tiny. This namespace has three (global) static members, which are its main component classes:

- View Class (Tiny::view): 	Window handling, rendering, GUI interface
- Event Class (Tiny::event): 	Event handling for keyboard and mouse, window resizing
- Audio Class (Tiny::audio): 	Audio interface for playing / looping sounds

A number of utility classes wrap typical OpenGL features into easily useable structures. These have simple constructors and destructors that wrap the necessary OpenGL so you don't have to worry about it:

- Texture: 	OpenGL texture wrapper with constructors for different data types (e.g. algorithm, raw image, ...)
- Shader: 	Load, compile, link and use shader programs (vertex, fragment, geometry) easily, pass SSBO.
- Model: 	OpengL VAO/VBO wrapper. Construct from user-defined algorithm. Handles loading, updating, rendering.
- Target: 	OpenGL FBO wrapper. Bind a texture for render targeting. Handles 2D (billboards) and 3D (cubemaps).
- Instance: 	OpenGL instanced rendering wrapper (any Model object, any data). Simply add model buffers and render model instanced.

More information can be found on the wiki: Utility Classes

The behavior is combined through a standard game pipeline. The programs behavior is additionally changed through user-defined functions which are called in the relevant parts of the pipeline:

- Tiny::event.handler: 	Lets you define behavior based on user-inputs. Tiny::event stores input data
- Tiny::view.interface: Lets you define an ImGUI interface that can act on your data structures
- Tiny::view.pipeline: 	Combines utility classes to render your data structures to targets / windows
- Tiny:➿ 		Executed every cycle. Arbitrary code acting on your data structures every loop

A number of helper namespaces then supply additional algorithms and functions that are useful.

Example Images

All of the programs shown below are highly interactive and allow for live manipulation of the scene. All of them run in real time and allow for camera movement. Read the very brief example programs to see how TinyEngine is used to construct nice visualizations using very little code.

Procedural Tree A procedural 3D tree (example program 6), that has a leaf particle system and orthogonal projection shadow mapping.

Simple Lighting Scene A simple scene (example program 9) that uses .obj / .mtl files generated in Blender, and then uses cubemaps for point-light shading.

Shader Based Voronoi Texture

An example image of a shader-based voronoi texture generator I implemented as a small experiment (example program 11). Lets you do real-time voronoi filters because its very fast. Here seen for N = 2048. See my blog here here.

Usage

As the code-base is extremely brief, I recommend reading through the code and the example programs to understand how it works. The Wiki contains more information on the individual functions of the classes and how they are used.

Constructing a Program

Building a program with TinyEngine is extremely simple!

Example Program 0:

#include <TinyEngine/TinyEngine>

int main( int argc, char* args[] ) {

	Tiny::window("Example Window", 600, 400);   //Open Window

	Tiny::event.handler = [&](){ /*...*/ };   //Define Event Handler

	Tiny::view.interface = [&](){ /*...*/ };  //Define ImGUI Interface

	/*...Define Utility Classes...*/

	Tiny::view.pipeline = [&](){ /*...*/ };   //Define Rendering Pipeline

	Tiny::loop([&](){ //Start Main Game Loop
        		//... additional code here
	});

	Tiny::quit(); //Close the window, cleanup

	return 0;
}

Check the TinyEngine Wiki for more information on how to construct a basic program. Read the example programs to see how the utility classes are combined to create interactive 2D and 3D programs using OpenGL in very little code.

Compiling and Linking

As of 2021, TinyEngine is built as a statically linked library for easier inclusion in your project. This has a number of benefits:

  • TinyEngine does not need to be copied into your project directory
  • Easier continuous maintenance and updating
  • Faster compilation times

The installation process occurs in the makefile:

	sudo make setup     #Copy Core Header Files to Install Location
	sudo make helpers   #Copy Helper Headers
	sudo make install   #Compile TinyEngine and Copy to Install Location
	sudo make all       #All of the above! Run this for easy install.

The default install locations are /usr/local/lib for the compiled library and /usr/local/include for the header files.

Check the (brief!) makefile for options (e.g. install location, compiler flags).

Note that the installation has only been tested on GNU/Linux and install locations might need tuning for your system.

Building a Project

Building a project by default only requires inclusion of the TinyEngine header

	#inlude <TinyEngine/TinyEngine>

and optionally any helper namespace headers, e.g.

	//...
	#include <TinyEngine/object>
	#include <TinyEngine/image>
	//...

TinyEngine standalone is linked using:

	-lTinyEngine

but also requires linking of all additional dependencies! See the example programs to see exactly how to link the program (makefile). Note that all makesfiles are identical!

Compiled using g++ on Ubuntu 18/20 LTS.

Dependencies

(+ how to install on debian based systems)

- OpenGL3: apt-get install libglu1-mesa-dev
- SDL2:    apt-get install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libsdl2-image-dev
- GLEW:    apt-get install libglew-dev
- Boost:   apt-get install libboost-system-dev libboost-filesystem-dev

- DearImGUI (already included!)
- g++ (compiler)

Currently TinyEngine has only been tested on linux (Ubuntu 18 LTS). It would be possible to port to windows, but I lack a dedicated windows development environment to reliably port it. I might do this in the future.

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].