Giter Site home page Giter Site logo

dagon's Introduction

dagon logo

The goal of this project is to create a modern, easy to use, extensible 3D game engine for D language. Dagon is based on OpenGL 4.0 core profile. It currently works on Windows and Linux.

The engine is still under development and lacks many important features. It is currently not recommended to use Dagon in production due to API instability. Follow the development on Trello to see the priority tasks.

Dagon uses modern graphics techniques and so requires a fairly powerful graphics card to run. Turing-based NVIDIA cards are recommended (although ray tracing support is not required). The engine is only desktop, support for mobile and web platforms is not planned.

If you like Dagon, support its development on Patreon or Liberapay. You can also make a one-time donation via NOWPayments. I appreciate any support. Thanks in advance!

GitHub Actions CI Status DUB Package DUB Downloads License

Screenshots

Screenshot1

Screenshot2

Screenshot3

Screenshot4

Screenshot5

Features

  • Static and animated meshes, glTF, OBJ and IQM formats support
  • Textures in PNG, JPG, DDS, HDR, TGA, BMP formats + GIF and PSD via extension
  • Deferred pipeline for opaque materials, forward pipeline for transparent materials and materials with custom shaders
  • Physically based rendering (PBR)
  • HDR rendering with Reinhard, Hable/Uncharted, Unreal, ACES, Filmic and AgX tonemappers
  • HDRI environment maps. Preconvolved DDS cubemaps
  • Directional lights with cascaded shadow mapping and volumetric scattering
  • Spherical and tube area lights, spot lights
  • Normal/parallax mapping, parallax occlusion mapping
  • Deferred decals with normal mapping and PBR material properties
  • Dynamic skydome with sun and day/night cycle
  • Particle system with force fields. Blended particles, soft particles, shaded particles with normal map support, particle shadows
  • Terrain rendering. Procedural terrain using OpenSimplex noise or any custom height field
  • Water rendering
  • Post-processing (FXAA, SSAO, DoF, lens distortion, motion blur, glow, color grading)
  • UTF-8 text rendering using TTF fonts via Freetype
  • GUI extension based on Dear ImGui
  • Keyboard, mouse and joystick input. Input manager with abstract bindings and file-based configuration
  • Unicode text input
  • Ownership memory model
  • Entity-component model
  • Built-in camera logics for easy navigation: freeview and first person views
  • Physics using Newton Dynamics.

Planned in future:

  • Screen-space reflections.

Getting Started

The recommended way to start using Dagon is creating a game template with dub init. Create an empty directory for the project, cd to it and run the following:

dub init --type=dagon
dub build

Do not delete data/__internal folder! It is used to store engine's internal data such as shaders and textures.

Runtime Dependencies

Runtime dependencies are automatically deployed on 64-bit Windows and Linux. On other platforms, you will have to install them manually.

Known Bugs and Limitations

  • The engine doesn't support macOS
  • dagon:nuklear extension has problems under Linux
  • dagon:newton crashes under Linux when loading Newton plugins (NewtonPhysicsWorld.loadPlugins)

Documentation

See tutorials and corresponding examples.

License

Copyright (c) 2016-2024 Timur Gafarov, Rafał Ziemniewski, Mateusz Muszyński, dayllenger, Konstantin Menshikov, Björn Roberg, Isaac S., ijet. Distributed under the Boost Software License, Version 1.0 (see accompanying file COPYING or at http://www.boost.org/LICENSE_1_0.txt).

Sponsors

Jan Jurzitza (WebFreak), Daniel Laburthe, Rafał Ziemniewski, Kumar Sookram, Aleksandr Kovalev, Robert Georges, Rais Safiullin (SARFEX), Benas Cernevicius, Koichi Takio, Konstantin Menshikov.

Made with Dagon

dagon's People

Contributors

burner avatar dayllenger avatar gecko0307 avatar isaacs-dev avatar mankeyyename avatar my-ijet avatar roobie avatar tichau avatar timu5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dagon's Issues

Windows 10 run failure of Documentation Hello Worlds

I successfully:

Installed DUB.
Installed DMD, + installed Visual D
Initialized a directory on my Desktop with dub init my_app
From within my_app ran dub generate visual.
For some reason I had to run it twice before it generated the .sln for visual studio.

Upon first running, you get a crap ton of errors. Luckily, those are fixed by creating a new Launch Configuration with x64 as the platform and duplicating from the default Win32 one.

Now all libraries, and demo application found at the start of this documentation

finally build and run. However, no window is shown other than a console window, which is blank, and which then immediately closes. The only error feedback I found was this in the Output tab of VS:

First-chance exception: 0xc0000096: Privileged instruction
Unhandled exception: 0xc0000096: Privileged instruction
The thread 0x3b30 has exited with code -1073741674 (0xc0000096).
The thread 0x10e8 has exited with code -1073741674 (0xc0000096).
The thread 0x35c8 has exited with code -1073741674 (0xc0000096).
The thread 0x1068 has exited with code -1073741674 (0xc0000096).
The program '[14752] diagram_chaser.exe' has exited with code -1073741674 (0xc0000096) 'Privileged instruction'.

Nuklear library not found

I tried to compile dagon-demo, tutorial 1 and dagon-shooter and there always was the same problem:
[deen@parrot] : [~/Programs/dagon-demo-master]
[$]> ./dagondemo
Error: Nuklear library is not found. Please, install Nuklear.

Even with sudo:
[deen@parrot] : [~/Programs/dagon-demo-master]
[$]> sudo !!
sudo ./dagondemo
[sudo] пароль для deen:
Error: Nuklear library is not found. Please, install Nuklear.

Even though dub downloads nuklear and builds it, all the projects i tried tell me that i need to install nuklear.

I cloned nuklear, went into c folder and ran cmake . :
image

After that i tried make && make install:
image

And tried running the demo again:
[deen@parrot] : [/Programs/bindbc-nuklear/c]
[$]> cd ../../dagon-demo-master/
[deen@parrot] : [
/Programs/dagon-demo-master]
[$]> ./dagondemo
Error: Nuklear library is not found. Please, install Nuklear.

What should i do to install nuklear?
Linux parrot 5.2.0-2parrot1-amd64 #1 SMP Parrot 5.2.7-2parrot1 (2019-08-12) x86_64 GNU/Linux

Win32 / x86 configuration run fails with DLL load exception

I'm on Windows 10, and using Visual D in VS 2017 community.

First-chance exception: derelict.util.exception.SharedLibLoadException Failed to load one or more shared libraries:
	SDL2.dll - The specified module could not be found. at ..\..\..\AppData\Local\dub\packages\derelict-util-3.0.0-beta.2\derelict-util\source\derelict\util\sharedlib.d(158) occurred

Call stack:

 	KernelBase.dll!76b817d2	
 	diagram_chaser.exe!__D2rt9deh_win329throwImplFC6object9ThrowableZv() + 0x37 bytes	D
>	diagram_chaser.exe!__D8derelict4util9exception22SharedLibLoadException8throwNewFAAyaQekQgZv() Line 67	D
 	diagram_chaser.exe!derelict.util.sharedlib.SharedLib.load( derelict.util.sharedlib.SharedLib* this ) Line 160	D
 	diagram_chaser.exe!derelict.util.loader.SharedLibLoader.load( derelict.util.loader.SharedLibLoader this ) Line 253	D
 	diagram_chaser.exe!derelict.util.loader.SharedLibLoader.load( derelict.util.loader.SharedLibLoader this ) Line 197	D
 	diagram_chaser.exe!derelict.util.loader.SharedLibLoader.load( derelict.util.loader.SharedLibLoader this ) Line 134 + 0x15 bytes	D
 	diagram_chaser.exe!dagon.core.application.Application.this( dagon.core.application.Application this ) Line 151	D
 	diagram_chaser.exe!dagon.resource.scene.SceneApplication.this( dagon.resource.scene.SceneApplication this ) Line 318	D
 	diagram_chaser.exe!main.MyApplication.this( main.MyApplication this ) Line 44	D
 	diagram_chaser.exe!std.conv.emplace!(main.MyApplication, string[]).emplace( const(char)[][]* _param_1 ) Line 4507	D
 	diagram_chaser.exe!std.conv.emplace!(main.MyApplication, string[]).emplace( const(char)[][]* _param_1 ) Line 4583	D
 	diagram_chaser.exe!dlib.core.memory.allocate!(main.MyApplication, string[]).allocate() Line 148 + 0xa bytes	D
 	diagram_chaser.exe!D main() Line 53 + 0xb bytes	D
 	diagram_chaser.exe!__D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv() + 0x1b bytes	D
 	diagram_chaser.exe!__D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv() + 0x89 bytes	D
 	diagram_chaser.exe!__d_run_main() + 0x253 bytes	D
 	diagram_chaser.exe!__entrypoint.main() Line 7 + 0x11 bytes	D
 	diagram_chaser.exe!_mainCRTStartup() + 0xa9 bytes	D
 	kernel32.dll!76128484	
 	ntdll.dll!7751305a	
 	ntdll.dll!7751302a	

What I've tried:

Placing SDL2.dll both the 32-bit and the 64-bit version in my project's target directory (with .EXE) and also in C:\Windows\System32. Same error results.

Compilation error ubuntu 16.04 x64

dagon-app ~master: building configuration "application"...
../../../../.dub/packages/dagon-0.8.0/dagon/src/dagon/graphics/materials/standard.d(119,16): Warning: C preprocessor directive #define is not supported
../../../../.dub/packages/dagon-0.8.0/dagon/src/dagon/graphics/materials/standard.d(120,16): Warning: C preprocessor directive #define is not supported
../../../../.dub/packages/dagon-0.8.0/dagon/src/dagon/graphics/materials/sky.d(90,16): Warning: C preprocessor directive #define is not supported
../../../../.dub/packages/dagon-0.8.0/dagon/src/dagon/graphics/materials/sky.d(91,16): Warning: C preprocessor directive #define is not supported
../../../../.dub/packages/dagon-0.8.0/dagon/src/dagon/graphics/filters/hdrprepass.d(68,16): Warning: C preprocessor directive #define is not supported
/usr/bin/dmd failed with exit code 1.

[gl33] New texture units layout

texture0 - diffuse (albedo) map + alpha
texture1 - normal map + height map
texture2 - roughness map + metallic map
texture3 - emission map
texture4 - environment map
texture5 - shadow map array (3 layers)
texture6 - light clusters map
texture7 - light attributes buffer
texture8 - light indices buffer

API Desing

Please take a look at babylonJS game framework for inspiration on API namings and design

Calling EntityController inherited functions

I'm trying to call a function I've defined in a class that inherits from a EntityController, but am having issues with the syntax.

I've instantiated a new Entity Controller as an "NPC" type character, for an ant-simulation

class NewAnt : EntityController
{
	Vector3f = home;
	this(Entity e){
		super(e);
	}
	override void update(double dt)
	{...}

	void setHome(in Vector3f location)
	{
		entity.position = location;
		home = location ;
	}
}

Within a

class NewScene : Scene
{
    NewAnt eAnt; 
    Entity ants;    // a parent entity to store all the ants
...
        auto ant = createEntity3D(ants);
        ant.drawable = aOBJFood.mesh;
        ant.material = antWithNoFoodMaterial;
        ant.rotation = rotationQuaternion(Axis.y, degtorad(180.0f));
        ant.scaling = Vector3f(0.5, 0.5, 0.5);

        ant.updateTransformation(0.0);

        auto antCtrl = New!NewAnt(ant);
        ant.controller = antCtrl;

        antCtrl.setHome(Vector3f(myRndXPos, 0.5f, myRndYPos));
}

This all works fine, and the function setHome gets called correctly when I am instantiating the EntityController. This program runs and does everything correctly.

However if I try to call the setHome function during the onUpdate I clearly am not doing it correctly.

ants.children[1].controller.setHome(Vector3f(0.0f, 0.0f, 0.0f));

Gives me

Error: no property setHome for type dagon.logics.controller.EntityController

The code at here should compile and run (not release mode yet :S). Adding in line 142 in Simulator.d causes the error.

Sky and environment mapping improvements

  • Use skybox instead of a sky sphere to eliminate a seam when using equirectangular environment map and allow individual face textures
  • Cubemaps support, generate cubemap from equirectangular map
  • Render sky into cubemap for environment mapping with Rayleigh / custom sky shaders

dmech physics integration

There're some benefits of integrating dmech right into Dagon:

  • easier to use, all required controllers and glue code will also be built-in
  • BVH can be used for visibility culling and spatial queries. It makes sense to manage BVH automatically by the engine for less user boilerplate code
  • dmech can be used for built-in particle collision and physics.

Irradiance probes

Probes are objects used to bake HDR cubemaps in key places of the scene. Once cubemaps are baked, probes can be used in the same way as deferred light sources - as volumes that are rasterized into final HDR buffer. Their fragment shader uses a cubemap to calculate reflection for a given pixel. Probes are rendered after existing environment pass, so they locally replace default environment irradiance (sky or HDRI). Cubemap mipmapping can be used to render blurry reflections on rough surfaces, like in default environment pass. Higher lod levels can be used for diffuse ambient shading as well.

Pros:

  • Simple to implement
  • Very fast
  • Deferred-friendly
  • Combines reflections + diffuse GI in one technique
  • Can be quite accurate if parallax-corrected cubemapping is used (very impressive and convenient for interior scenes - one probe per room)

Cons:

  • Uses prebaking, so is really suitable only for static environments. If lighting conditions change, cubemaps should be rerendered, or reflections will be incorrect. Dynamic objects are also cannot be taken into account
  • Requires manual placing of probes, which is actually a tolerable tradeoff

Conclusion:

Not an ultimate solution, but obviously much better than having no reflections/GI at all.

Planar reflection

Scene can be rendered to a separate buffer with some simplified forward shader, and that buffer can be used to render nice water reflections.

Virtual Reality (VR) support

I think it would be very cool if dagon supported VR out of the box, so basically some wrapper calls to check if a HMD is present, to fetch input from controllers and HMD and to render and output the game stereographically to the vr compositor.

I'm currently porting OpenVR to D and it's actually fairly easy to start getting it running on VR. To test this Steam also offers some debugging tools to run VR basically like an FPS game. After a few VR initialization calls you get some context pointer to use. Then you basically render the scene twice, once for the left eye and another time for the right eye. Afterwards you submit the render results as (framebuffer) texture (DirectX, OpenGL, Vulkan, IOSurface, DirectX12, DXGI shared handle or Metal) to the VR compositor which handles the lens distortion (optional) and other rendering things.

Before each frame you can either wait for the VR device to report the position of the headset or use an API to immediately obtain the last one or predict it for when the frame is going to be displayed.

The reported position is a translation matrix for rotation & translation of the head of the user. Additionally you then offset this translation matrix by the per-eye matrices before each render to get each eye translation. The head translation matrix is usually around [0, height, 0] where height is the height of the HMD from the floor. The user can freely move around in space, this is usually just a few meters away from the origin point and this should only really be considered as movement for the physics once the user moves with a joystick on the controller or when the user has passed some movement threshold.

The VR compositor or user may change the resolution of the eyes at any time, so this should be accounted for as well to recreate the eye framebuffers.

For the API as a user I would expect it to be opt-in at startup, with some API to query if a HMD is present and if controllers are present. Then there would be some kind of VR camera instead of a normal camera and it should be configurable what is visible on the normal game window. For example the normal game window might be just the left or the right view or it might be some third view from some entirely different viewpoint. It might also just be hidden or any arbitrary other content. Additionally when there is the VR view it should also be possible to trivially add 2D UI elements to the desktop window for recording purposes.

Adding this kind of VR API might also be a good point to think of AR functionality to additionally support showing game objects inside the real world through cameras and some kind of calculated origin points coming from some API. Additionally instead of only OpenVR this should also work with OpenXR and maybe others once there are D APIs for those.

PBR

Port PBR shader from DGL.

Major redesign

In upcoming Dagon 0.11, which will be a step towards 1.0, I'm rethinking some architectural concepts and parts of the API. This work is done in dagon-ng branch. Main points are the following:

  • Less coupling in module structure. Currently it's a total mess with modules from different packages randomly depending on each other. New structure will have strict layout with modules only depending on lower-level packages:

dagon-new-package-layout

  • Renderer reimplementation. It should be possible to easily switch different renderers and output modes (for example, to visualize gbuffer). In current Dagon it is nearly impossible for the user to implement his own renderer without rewriting much of the engine. My idea is to break up the renderer to pipelines and stages which will allow easy extending and reuse of built-in rendering functionality. Also deferred renderer will be improved and optimized.
  • Reduce shader switches to improve performance. Use entity groups whenever possible.
  • Post-processing filters will also be ported to stages.
  • Nuklear integration and Freetype fonts support will be moved to subpackages (dagon:nuklear and dagon:ftfont). Subconfigurations are cumbersome and not very intuitive, so all functionality that depends on additional external libraries should be plugged in explicitly. Core Dagon will depend only on SDL.
  • Use official bindbc-freetype instead of custom binding.
  • Use latest versions of other bindings.

This will be a breaking change. See editor.d for an example of new user-side code.

Status:

  • Window creation, event system
  • Scene menegement
  • Asset management
  • Deferred renderer
  • Forward renderer for transparent objects
  • Entities
  • Tweens
  • Built-in shapes
  • *.obj
  • *.iqm (will be implemented as extension)
  • *.asset
  • Animated models (will be implemented as extension)
  • Images
  • Textures
  • Materials, shaders
  • Environment maps
  • Sun lights
  • Area lights
  • Shadows
  • Terrain
  • Sky
  • Water
  • Particles
  • Decals
  • Post-processing
  • Text rendering
  • Nuklear GUI
  • Freeview controller
  • First person controller

Adding textLine causes an error

I have a program that works fine until I try to add a GUI.

helpText = New!TextLine(aFontDroidSans14.font, helpTextGeneral, assetManager);
helpText.color = Color4f(1.0, 0.2, 0.6, 1.0);

auto eText = createEntity2D();
eText.drawable = helpText;
eText.position = Vector3f(16.0f, 30.0f, 0.0f);

causes the compile to fail with
Program exited with code -11

I can't get any of the examples to work, with similar errors.

glTF support

glTF is a new 3D data interchange format designed specifically for OpenGL. It is becoming a new industry standard, so Dagon definitely should support it.

  • Basic mesh loading
  • Materials and textures, roughness/metallic PBR
  • Nodes
  • Scenes

[gl33] Optimize clustered light engine

  • Light attribute buffer, index buffer and cluster buffer shouldn't be rewritten and resent to VRAM every frame - this is only necessary when lights change. Currently light positions are stored in the buffer in eye space - they should be stored in world space and transformed to eye space in shader using view matrix. This would cause a negligible GPU overhead, but greatly reduce work on CPU side.
    Note: light transformation can be done in a compute shader, but Dagon currently targets OpenGL 3.3 which doesn't support them.
  • When updating buffers, only visible lights should be taken into account (lights that intersect the frustum). This would allow utilizing index buffer more efficiently, so that we won't need a giant index buffer for a big world and a large number of clusters.

Nuklear Errors

Hi! I'm getting these errors when trying to run

dagon 0.10.2: building configuration "library"...
../../../.dub/packages/dagon-0.10.2/dagon/src/dagon/ui/nuklear.d(1421,98): Error: function bindbc.nuklear.binddynamic.nk_filter_default(const(nk_text_edit)* e, uint unicode) is not callable using argument types ()
../../../.dub/packages/dagon-0.10.2/dagon/src/dagon/ui/nuklear.d(1421,98):        missing argument for parameter #1: const(nk_text_edit)* e
../../../.dub/packages/dagon-0.10.2/dagon/src/dagon/ui/nuklear.d(1426,102): Error: function bindbc.nuklear.binddynamic.nk_filter_default(const(nk_text_edit)* e, uint unicode) is not callable using argument types ()
../../../.dub/packages/dagon-0.10.2/dagon/src/dagon/ui/nuklear.d(1426,102):        missing argument for parameter #1: const(nk_text_edit)* e
../../../.dub/packages/dagon-0.10.2/dagon/src/dagon/ui/nuklear.d(1431,85): Error: function bindbc.nuklear.binddynamic.nk_filter_default(const(nk_text_edit)* e, uint unicode) is not callable using argument types ()
../../../.dub/packages/dagon-0.10.2/dagon/src/dagon/ui/nuklear.d(1431,85):        missing argument for parameter #1: const(nk_text_edit)* e
/usr/bin/dmd failed with exit code 1.

What could it be?
I'm using this in my config btw:

"dagon": "~>0.10.2"

Improve particle system

  • Force fields
  • Different blending modes
  • Dedicated material backend
  • Soft particles
  • Shaded particles
  • Particle normal maps
  • Particle shadows
  • Multiple emitters per system
  • Use any Entity as a paticle

Simplified rendering mode

In addition to deferred renderer, Dagon should have a built-in simple forward rendering mode for simple casual-style graphics.

  • Forward lighting system with a fixed array of lights.
  • Simple ubershader without PBR

Occlusion Query/Conditional Rendering

Conditional rendering is an OpenGL 3.x feature. The main idea behind it is rendering a simple bounding volume for object (like AABB) and testing if any of it is actually visible on screen. If it is, then we can render the object itself, but if it isn't, then we can safely discard the expensive rendering.

// Initialization:
GLuint query;
glGenQueries(1​, &query​);

// Rendering:
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);
glBeginQuery(GL_SAMPLES_PASSED, query);
// render bounding volume of an object
glEndQuery(GL_SAMPLES_PASSED);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthMask(GL_TRUE);

glBeginConditionalRender(query, GL_QUERY_WAIT​);
// render an object
glEndConditionalRender();

Conditional rendering can be an optional feature of Entity. This will require an additional interface on top of Drawable which defines AABB property.

It is possible to use Dagon as a 2D engine ?

Hello,
I'm new to D and wanted to make a simple game to try it, but I can't figure out how to draw a sprite. I wrote this code:

auto playerMaterial = this.createMaterial();
playerMaterial.diffuse = this.player.texture;

auto player = this.createEntity2D();
player.material = playerMaterial;
player.position = Vector2f(40, 40);
player.drawable = New!ShapeQuad(this.assetManager);

What is my mistake ?

Thanks

Terrain texture splatting

Rewrite terrain material backend to use 4 textures with masks. Masks and normal maps should be passed as an additional layers via texture arrays.

entity rotation causes disposition of scale.

I want my plane to do a barrel roll. it does with following code. However, disruptions in scale also occurs. Is it a bug or, am I on a totally wrong way?

auto q = rotationQuaternion(Axis.z, degtorad(stepAngle * dt)); // stepAngle = 150.0f;
plane.rotation.z += q.z;

Glyph ranges detection

What do you thinks about glyph ranges detection for text rendering in GUI. Personally I see four options for that matter:

  1. Static glyph ranges, either hard coded in code(current approach) or loaded from configuration.
  2. Based on system locale(it might be hard to find table that translate locale code into UTF ranges).
  3. Dynamic, loading glyph range when new character occurs in string.
  4. Utilize ftfont(and its character loading) for rendering instead of nuklear builtin font renderer.

Animated textures

Load spritesheet, play animation by changing texture coordinates over time.

Ununtu 16.04 compilation error

Using Dagon version 0.8.2 on Ubuntu 16.04 x64, DMD v2.081.2

Performing "debug" build using /usr/bin/dmd for x86_64.
derelict-util 3.0.0-beta.2: target for configuration "library" is up to date.
derelict-ft 2.0.0-beta.4: target for configuration "library" is up to date.
derelict-gl3 2.0.0-beta.6: target for configuration "library" is up to date.
derelict-sdl2 3.1.0-alpha.4: target for configuration "derelict-sdl2-dynamic" is up to date.
dlib 0.14.0: target for configuration "library" is up to date.
dagon 0.8.2: target for configuration "library" is up to date.
dagon-app ~master: target for configuration "application" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./dagon-app 
derelict.util.exception.SymbolLoadException@../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d(181): Failed to load symbol SDL_DequeueAudio from shared library libSDL2.so
----------------
../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/sharedlib.d:181 void* derelict.util.sharedlib.SharedLib.loadSymbol(immutable(char)[], bool) [0x5e4bc2]
../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/loader.d:382 void* derelict.util.loader.SharedLibLoader.loadSymbol(immutable(char)[], bool) [0x5e20ba]
../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/loader.d:71 void derelict.util.loader.SharedLibLoader.bindFunc(void**, immutable(char)[], bool) [0x5e1d64]
../../../../.dub/packages/derelict-sdl2-3.1.0-alpha.4/derelict-sdl2/source/derelict/sdl2/internal/sdl_dynload.d:100 void derelict.sdl2.internal.sdl_dynload.DerelictSDL2Loader.loadSymbols() [0x5ddb13]
../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/loader.d:253 void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0x5e1f3a]
../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/loader.d:196 void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0x5e1eb4]
../../../../.dub/packages/derelict-util-3.0.0-beta.2/derelict-util/source/derelict/util/loader.d:134 void derelict.util.loader.SharedLibLoader.load() [0x5e1d97]
../../../../.dub/packages/dagon-0.8.2/dagon/src/dagon/core/application.d:126 dagon.core.application.Application dagon.core.application.Application.__ctor(uint, uint, bool, immutable(char)[], immutable(char)[][]) [0x55b58b]
../../../../.dub/packages/dagon-0.8.2/dagon/src/dagon/resource/scene.d:316 dagon.resource.scene.SceneApplication dagon.resource.scene.SceneApplication.__ctor(uint, uint, bool, immutable(char)[], immutable(char)[][]) [0x582624]
source/app.d:42 main.MyApplication main.MyApplication.__ctor(immutable(char)[][]) [0x5486b3]
/usr/include/dmd/phobos/std/conv.d:4717 main.MyApplication std.conv.emplace!(main.MyApplication, immutable(char)[][]).emplace(main.MyApplication, ref immutable(char)[][]) [0x54d4f1]
/usr/include/dmd/phobos/std/conv.d:4800 main.MyApplication std.conv.emplace!(main.MyApplication, immutable(char)[][]).emplace(void[], ref immutable(char)[][]) [0x54d4be]
../../../../.dub/packages/dlib-0.14.0/dlib/dlib/core/memory.d:148 main.MyApplication dlib.core.memory.allocate!(main.MyApplication, immutable(char)[][]).allocate(immutable(char)[][]) [0x54d479]
source/app.d:52 _Dmain [0x548733]
Program exited with code 1

Reimplement shader system

Current shaders in Dagon are very ugly and cumbersome. The engine needs a unified approach for handling GLSL shader objects and uniforms. It should be both user- and renderer-friendly.
This task is being done in smartshader branch. Shader object wraps GLSL shader program and uniform initialization, providing generic setParameter methods. It will eventually replace the old material backend system.

Features:

  • Much simpler parameter handling
  • Reference and callback parameters which can be tied to objects, like in reactive programming
  • GLSL 4.0 subroutines support for maximum performance in ubershaders. As a consequence, no more implicit textures for diffuse/normal/PBR, so animated values are possible.

TODO list:

  • Shader wrapper
  • Import all shaders from files at compile time
  • Port deferred pipeline
  • Port forward pipeline
  • Parallax occlusion mapping
  • Height-corrected shadow mapping
  • Port sky shader
  • Port particle shader
  • Port shadow shader
  • Natively allow user-defined shaders in forward pipeline
  • Eliminate all redundant material classes, use one standard Material by default
  • Combine all the rendering code into a separate object - Renderer

Use BindBC

BindBC is a new @nogc dynamic binding framework by @mdparker, creator of Derelict. There are several advantages of BindBC over Derelict:

  • More actively developed and in fact is a successor of Derelict.
  • Doesn't use classes and garbage collector.
  • Supports OpenGL 4.6 and SDL 2.0.9.
  • Simpler to use, no more mysterious DerelictGL3.load() and DerelictGL3.reload(). Just create a context using SDL and then call loadOpenGL().
  • Better error handling.

This transition will not affect user API.

TODO list:

Terrain improvements

  • Heightmaps (generic height data source which can be an image or procedurally generated heightmap)
  • Specialized terrain shader
  • Terrain collision mesh

Need more details in documentation.

This engine attracts my attention, since I love playing around game engines as an amateur programmer and newbie for dlang. The first thing I realized is that the documentation do not cover many things. I digged into the source code a bit, and there are things I could not find out:

  1. Is there an approach like nodes in Ogre3d? You can have nested nodes behaving like hinges with Ogre3D. Or is it only posible to append Entities to a scene? Edit: I think the answer is in Entity class which may have children recursively: DynamicArray!Entity children; ?

  2. How to remove/deallocate an Entity after createEntity3D(). Edit: The way I found out is calling this.entities3D.removeKey(entity.id); entity.release(); in derived Scene class?

  3. Is there any built-in functionality to permit objects emitting stereo sound (something like an OpenAL integration)

  4. Is there any implementation similar to actions in cocos2dx (https://docs.cocos2d-x.org/cocos2d-x/en/actions/) or LibGdx (https://github.com/libgdx/libgdx/wiki/Scene2d#actions). I see a class member named "behaviours"?

Switch to OpenGL 3.3

There's a problem with GL_EXT_gpu_shader4 extension on AMD and Intel cards. Using modern GPU functionality and keeping compatibility with old hardware seems now impossible.

Tasks:

  • Get rid of GLU
  • Use VBOs instead of display lists to render static meshes
  • Use VBOs instead of vertex arrays to render animated models
  • Use VBOs to render text (one quad for all characters, resize to glyph size in vertex shader)
  • Use VBOs to render particles (do billboard camera-align in vertex shader)
  • Use VBOs to render default loading screen (progress bar)
  • VBO-friendly OBJ loader
  • Rework shadow map renderer to use shaders
  • Port post-processing framework, use VBO to draw a screen-aligned quad
  • Port clustered lighting engine
  • Implement default shader to replace old fixed-pipeline material backend
  • Blinn-Phong material backend
  • Blinn-Phong clustered material backend
  • Sky material backend

Invalid operation in active samplers

Attempting to use Dagon (master) on my machine always crashes with:

OpenGL error 1282: GL_INVALID_OPERATION

after the loading screen.

If I disable the error check, the tutorials seem to render correctly. For now I can use this as a work-around.

Utilizing RenderDoc and Tutorial 1, I was able to get a clearer error message:
GL_INVALID_OPERATION in active samplers with a different type refer to the same texture image unit

OS: Manjaro Linux
Driver: Mesa 18.3.2
GL Version: 4.5
Video Card: RX 580

Make Nuklear and Freetype optional

These are not critical to use the core engine, so I'm going to make them optional with some setting at compile time. I'm getting complaints from people who just want to try fresh Dagon under Linux without worrying about exotic dependencies.

Trying to run samples on x64 Linux results in "wrong ELF class: ELFCLASS32"

I'm working on a PR to solve this.

Full error message for reference:

Building package dagon:simple in ~/devel/dagon/
Performing "debug" build using dmd for x86_64.
dlib 0.10.0: target for configuration "library" is up to date.
dagon:simple 0.0.2: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./dagon_simple 
Allocated memory at start: 0
derelict.util.exception.SharedLibLoadException@src/derelict/util/exception.d(43): Failed to load one or more shared libraries:
	lib/libSDL2-2.0.so - lib/libSDL2-2.0.so: wrong ELF class: ELFCLASS32
----------------
??:? void derelict.util.exception.SharedLibLoadException.throwNew(const(char[][]), const(char[][])) [0xcb493062]
??:? void derelict.util.sharedlib.SharedLib.load(immutable(char)[][]) [0xcb493d3e]
??:? void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) [0xcb4936ae]
??:? void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) [0xcb493637]
??:? dagon.core.application.Application dagon.core.application.Application.__ctor(uint, uint, immutable(char)[], immutable(char)[][]) [0xcb3f8258]
??:? dagon.resource.scene.SceneApplication dagon.resource.scene.SceneApplication.__ctor(uint, uint, immutable(char)[], immutable(char)[][]) [0xcb439e61]
??:? main.MyApplication main.MyApplication.__ctor(immutable(char)[][]) [0xcb3f49f1]
??:? main.MyApplication std.conv.emplace!(main.MyApplication, immutable(char)[][]).emplace(void[], ref immutable(char)[][]) [0xcb4794e9]
??:? main.MyApplication dlib.core.memory.allocate!(main.MyApplication, immutable(char)[][]).allocate(immutable(char)[][]) [0xcb4275fe]
??:? _Dmain [0xcb3f4a98]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0xcb4d5447]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0xcb4d536f]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() [0xcb4d53ec]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0xcb4d536f]
??:? _d_run_main [0xcb4d52db]
??:? main [0xcb3f8049]
??:? __libc_start_main [0x32c352b0]
Program exited with code 1

Does this mean I have not enough OpenGL hardware support?

First-chance exception: derelict.util.exception.SymbolLoadException Failed to load OpenGL symbol [glTextureStorage1DEXT] at ..\..\..\AppData\Local\dub\packages\derelict-gl3-2.0.0-beta.7\derelict-gl3\source\derelict\opengl\glloader.d(185)

Call stack is:


 	KernelBase.dll!76b817d2	
 	diagram_chaser.exe!__D2rt9deh_win329throwImplFC6object9ThrowableZv() + 0x37 bytes	D
>	diagram_chaser.exe!derelict.opengl.glloader.GLLoader.bindGLFunc( derelict.opengl.glloader.GLLoader* this ) Line 186	D
 	diagram_chaser.exe!derelict.opengl.impl.glFreeFuncs!(cast(GLVersion)45, false).glLoaders!(cast(GLVersion)45, false).GL_ARB_texture_storage.load( bool doThrow ) Line 228 + 0x30 bytes	D
 	diagram_chaser.exe!derelict.opengl.glloader.GLLoader.loadExtensionSet( derelict.opengl.glloader.GLLoader* this ) Line 64 + 0xc bytes	D
 	diagram_chaser.exe!derelict.opengl.glloader.GLLoader.loadExtra( derelict.opengl.glloader.GLLoader* this ) Line 125	D
 	diagram_chaser.exe!derelict.opengl.gl.DerelictGL3Loader.reload( derelict.opengl.gl.DerelictGL3Loader this ) Line 45 + 0x12 bytes	D
 	diagram_chaser.exe!dagon.core.application.Application.this( dagon.core.application.Application this ) Line 211 + 0xa bytes	D
 	diagram_chaser.exe!dagon.resource.scene.SceneApplication.this( dagon.resource.scene.SceneApplication this ) Line 318	D
 	diagram_chaser.exe!app.MyApplication.this( app.MyApplication this ) Line 44	D
 	diagram_chaser.exe!std.conv.emplace!(app.MyApplication, string[]).emplace( const(char)[][]* _param_1 ) Line 4507	D
 	diagram_chaser.exe!std.conv.emplace!(app.MyApplication, string[]).emplace( const(char)[][]* _param_1 ) Line 4583	D
 	diagram_chaser.exe!dlib.core.memory.allocate!(app.MyApplication, string[]).allocate() Line 148 + 0xa bytes	D
 	diagram_chaser.exe!D main() Line 52 + 0xb bytes	D
 	diagram_chaser.exe!__D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv() + 0x1b bytes	D
 	diagram_chaser.exe!__D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv() + 0x89 bytes	D
 	diagram_chaser.exe!__d_run_main() + 0x253 bytes	D
 	diagram_chaser.exe!__entrypoint.main() Line 7 + 0x11 bytes	D
 	diagram_chaser.exe!_mainCRTStartup() + 0xa9 bytes	D
 	kernel32.dll!76128484	
 	ntdll.dll!7751305a	
 	ntdll.dll!7751302a	

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.