Skip to content

Latest commit

 

History

History
71 lines (66 loc) · 2.44 KB

File metadata and controls

71 lines (66 loc) · 2.44 KB

OSE

OpenGL 4D rendering engine.

Description

This engine is designed for rendering objects in 4-dimensional space. It allows loading 3D models of various formats, which will be automatically converted to 4D. Interaction with objects is based on an event system.

Examples

Rendering two hypercubes

Hypercubes

Build

CMake targets:

  • OSE - Engine dynamic library
  • SandboxBundle - sandbox executable for testing

Build options

  • OSE_DISABLE_LOGGING - disable logging (default ON)
  • S_APP_NAME=App - define app name (default "APP")

Setup

Using Sandbox project

  • Clone this repository
  • Put your code into ./Sandbox/src
  • Build target SandboxBundle

Custom setup

OSE is designed as dynamic library

  • Build library
  • Include OSE.h
  • Inherit from Engine
class ExamapleGame : public OSE::Engine {
    // Use constructor for initialization
    ExamapleGame() {
        //create player and so on
    }
};
  • Define CreateApplication callback
OSE::Engine* OSE::CreateApplication() {
	return new ExamapleGame();
}
  • Do not define/declare entry point ("main" function), it is already defined in OSE.h
  • See Sandbox.cpp for more examples
  • Use bundle(target relative_path_to_assets) CMake function to add custom target for building final application

Essential docs

Events

OSE::EventListener - template class, inherite from it to subsribe for events

class Player : public OSE::EventListener<OSE::KeyPressedEvent> {
    void onEvent(OSE::KeyPressedEvent& ev) override {
        OSE_LOG(LOG_APP_TRACE, ev.getKeyCode());
    }
}

OSE::TickEvent - event type for tick events: fired each update ~ each frame.

OSE::RenderEvent - event called each frame to render entites. Perform all rendering on receive.

void onRender(OSE::Renderer* renderer) override {
    renderer->drawStaticMesh(OSE::AssetSystem::instance->getStaticMesh("cube") , &this->getTransform());
}

OSE::Actor - base class of in-game entities. If something is intended as a dynamic entity it should inherit from this class. OSE::Actor will receive Tick Events by default.

OSE::AssetSystem - class for loading assets from files, is a singleton instance. Never throws! Returns nullptr if failed.

OSE::AssetSystem::instance->setAssetDir("assets/");
if (!OSE::AssetSystem::instance->loadStaticMesh("cube", "cube.obj")) {
    OSE_LOG(LOG_APP_WARNING, "Failed to load asset");
}