Jump to content
  • Advertisement

Gorgon

Hardware accelerated 2D graphics API for .NET

Latest Updates from OMG NUB!

Details

What is Gorgon?

A modular set of libraries useful for graphics and/or video game development. Gorgon uses Direct 3D 11.4 (via SharpDX) to provide high performance graphics for your applications.

What is not Gorgon?

Building applications with Gorgon requires that you write code. There's no nodes, no blueprints, etc... It does not contain:

  • A fully featured game engine.
  • An all-in-one editor that uses drag and drop to build your application.
  • A scripting system.

Gorgon is meant for people that want to write their own functionality, get down into the guts of their applications and not have to deal with a black boxed scripting system, or editor. In short, it's more work, but more customizable.

For those that want a more complete (and polished) package to build their applications there's Unity, Unreal or Godot.

What’s the licensing?

Gorgon is licensed under the MIT license.

How far along are you? Is it done yet? How about now?

Gorgon 3.0 is currently in sporadic development as time allows. At this point, there's no release planned.

What can it do?

Gorgon provides a set of libraries that are capable of handling pretty much any task thrown at it. It includes:

  • [x] Gorgon.Core

    Core functionality, plug in support and utility functionality. This is the base library that everything else uses.

  • [x] Gorgon.Windows

    Core Windows specific functionality. Provides UI functionality, such as custom message box dialogs, timing functionality using QPC and/or the windows multimedia timer and various other bits of utility/diagnostic functionality.

  • [x] Gorgon.FileSystem

    A virtual file system that can mount a directory as a file system root, or using various file system providers, can mount a packed file as a virtual file system root. This code is based on the popular PhysFS library.

    By default, Gorgon's basic virtual file system is based on the folder/files on the Windows file system, but using filesystem providers via plug ins, applications can read any type of file storage container can be used if the appropriate plug in is available for it. Gorgon comes with two plug ins for file system providers:

    By default, the file system provider

  • [x] Gorgon.Input

    A flexible input library to handle joysticks/gamepads, keyboard and mouse input. The input library can use events or polling to retrieve data from the various input sources.

    Keyboard and mouse input is provided using the Windows Raw Input API, and joystick/gamepad support is driven by the following plug ins:

  • [x] Gorgon.Graphics.Core

    A "low-level" graphics API that sits on top of Direct 3D 11.4. Provides a simplified system to build objects such as render targets, swap chains, buffers, etc... The rendering portion of the API provides a simple mechanism to submit batched state and draw information back to the underlying D3D API.

  • [x] Gorgon.Graphics.Imaging

    Functionality to read and write image formats. This also contains functionality to use a fluent interface to manipulate images for things like cropping, scaling, etc...

    Gorgon uses codecs to read/write images and includes codecs for the following formats:

    • DDS - Direct Draw Surface
    • TGA - Truevision Targa
    • PNG - Portable Network Graphics
    • JPG - Joint Photographic Experts Group
    • BMP - Windows Bitmap
    • GIF - Graphic Interchange Format (supports animated gifs as well)

    In additon to the support above, applications can extend the support for file formats by adding their own custom codec plug in to read/write in their desired format(s).

  • [x] Gorgon.Graphics.Fonts

    An extensive bitmap font creation interface (within the graphics module) that supports kerning, outlining of font glyphs, and other customizations to help generate impressive looking text.

    Currently Gorgon supports reading and writing of font files through codecs. Support is included for:

    • GorFont: A proprietary binary format for Gorgon.
    • BmFont: A popular font file type created by Andreas Jönsson (Note: this support is limited to the text based file format at this time).

    In addition to the support above, applications can introduce their own codecs to read/write whatever font types they wish by extending the GorgonFontCodec type. (Plug in support is pending at this time)

  • [x] Gorgon.Renderers.Gorgon2D

    A 2D renderer that sits on top of the graphics module to make developing 2D games/applications much easier. It supports:

    • Sprites
    • Primitives (triangles, lines, ellipses, arcs, and rectangles)
    • Text rendering
    • A shader based effects system

    All of these are provided using batched rendering, similar to MonoGame for maximum performance.

  • [x] Gorgon.IO.Gorgon2D

    IO functionality for serializing sprite and polysprite data to and from various formats using codecs.

  • [x] Gorgon.Animation

    An animation module that allows the creation and playback of key framed animations for various types of objects.

    Animation controllers for the 2D renderer are provided by the Gorgon.Animation.Gorgon2D assembly.

  • [x] Gorgon.Editor (In Development)

    A flexible content editor to allow for the creation and editing of content.

    • Supports a plug in based architecture to allow developers to extend the editor indefinitely.
    • Supports file management of content by using a simple tree layout for folders and files.
    • Comes with an image editor plug in which allows users to add depth slices to 3D images (I have yet, for the life of me to find anything on the web that does this), mip maps and array indices, and other simple functions.
    • Comes with a sprite editor plug in which allows users to clip sprites from an image and store them as a file.
    • Can output the files as a packed file. The type of file that be written out is provided via plug in support (currently only supports the proprietary Gorgon packed file format).
    • Can import packed files using file system plug ins (currently has support for zip and the proprietary Gorgon packed file formats - included with Gorgon as file system plug ins).
    • TBD...

What's required?

  • .NET 4.7.2
  • Windows 10 (Build 15063 or later).
  • Microsoft DirectX 11.4

To compile the library

To use the library

  • You may use any .NET 4.7.2 enabled language (e.g. Visual Basic .NET) to write an application with Gorgon.

Source code

The master branch contains the current release version of Gorgon 3.0.

Acknowledgements

Gorgon uses icons from the following sources:

Oxygen https://github.com/pasnox/oxygen-icons-png
http://www.iconarchive.com/show/oxygen-icons-by-oxygen-icons.org.html

Icons8 http://https://icons8.com

Sprites example textures from: http://millionthvector.blogspot.com/

This following image(s) is/are not redistributable without permission from the original author.

"HotPocket.dds" by Starkiteckt https://www.deviantart.com/starkiteckt/art/Hot-Pocket-433337115

Third Party True Type fonts:

Tequila by uZiMweB \ A Charming Font by GemFonts \ Sunset by Harold's Fonts \ Monsters Attack ! by The Empire of the Claw \ Grunja by Apostrophic Labs \ The Bold Font by ???

Comments

Dear Tap_Worm team,

I got no result with Bloom effect. Please have a look in my code and help me. Thank you in advance!

I use this function to create a Gorgon image:

private static GorgonImage CreateCustomImage(int w, int h, GorgonColor nqColor)
        {
            
            // Create the image at the original size.
            var sourceImage = new GorgonImage(new GorgonImageInfo(ImageType.Image2D, BufferFormat.R8G8B8A8_UNorm)
            {
                Width = w,
                Height = h
            });

            //int dpi = 96.Max(DEFAULT_DPI);

            // Draw something pretty...
            float width = sourceImage.Width;
            float height = sourceImage.Height;
            for (int x = 0; x < sourceImage.Width; ++x)
            {
                float rColorFade = ((x / width) * 1.5f).Cos();

                for (int y = 0; y < sourceImage.Height; ++y)
                {
                    float bColorFade = ((y / height) * 1.5f).Sin();

                    int pixelStride = sourceImage.Buffers[0].PitchInformation.RowPitch / sourceImage.Buffers[0].Width;
                    // This is the position inside of the buffer, in bytes.
                    int position = (y * sourceImage.Buffers[0].PitchInformation.RowPitch) + (x * pixelStride);
                    var color = new GorgoncColor(/*rColorFade*/1.0f, /*1.0f - rColorFade*/0.5f, /*bColorFade*/0.2f, 0.3f);

                    ref int pixel = ref sourceImage.Buffers[0].Data.ReadAs<int>(position);
                    pixel = nqColor.ToARGB()/*color.ToARGB()*/;
                }
            }
            return sourceImage;
        }

Then i call it to create a GorgonImage and GorgonTexture2DView, GorgonRenderTargetView2D:

GorgonColor c = new GorgonColor(System.Drawing.Color.FromArgb(77, 255, 127, 51).ToArgb());
GorgonImage _image = CreateCustomImage(360, 270, c);

GorgonTexture2DInfo texInfo = new GorgonTexture2DInfo()
                {
                    ArrayCount = 2,
                    Binding = TextureBinding.ShaderResource| TextureBinding.RenderTarget,
                    Format = _image.Format,
                    Width = _image.Width,
                    Height = _image.Height,
                    MipLevels = 1,
                    Usage = Gorgon.Graphics.Core.ResourceUsage.Default
                };


GorgonTexture2DView _imageTextureView = GorgonTexture2DView.CreateTexture(_graphics, texInfo, _image);

GorgonRenderTarget2DView   _imageRender2D = _imageTextureView.GetRenderTargetView();

I create a Bloom Effect with Red color:

Gorgon2DBloomEffect _bloomEffect = new Gorgon2DBloomEffect(_renderer)
            {
                Threshold = 1.11f,
                BloomIntensity = 3.0f,
                BlurAmount = 1.6f,
                ColorIntensity = 3.15f,
                Color = GorgonColor.DarkRed,
            };
            _bloomEffect.Precache();

In Idle loop function, i draw a Rectangle with Red color on _imageTextureView with Red color, render bloom effect and render final seen:

//Render Bosstown Dynamic video
mMediaPlayer.OnRender();
//
_graphics.SetRenderTarget(_imageRender2D);
_renderer.Begin();
_renderer.DrawRectangle(new SharpDX.RectangleF(10, 10, 340, 250), new GorgonColor(1.0f,0,0, 1.0f), 2);
_renderer.End();

_bloomEffect.Render((_, __, size) =>
            {
                _renderer.DrawFilledRectangle(new SharpDX.RectangleF(0, 0, _imageTextureView.Width, _imageTextureView.Height), GorgonColor.White, _imageTextureView, new SharpDX.RectangleF(0, 0, 1, 1));
            }, _imageRender2D );

_graphics.SetRenderTarget(_screen.RenderTargetView);     
_renderer.Begin();

int x = 20, y= 1080 - _image.Height - 40, delta_x = _image.Width + 20;
_renderer.DrawFilledRectangle(new SharpDX.RectangleF(x, y , _image.Width, _image.Height), GorgonColor.White, _imageTextureView, new SharpDX.RectangleF(0f, 0f, 1f, 1f));
_renderer.End();

I got final sceen without Bloom effect, it is filled by Red color like this:

https://imge.to/i/Mv9tV

 



 

Snapshot_19-08-12_13-29-38.png

Edited by hoahong

Share this comment


Link to comment
Guest
You are commenting as a guest. If you have an account, please sign in.
Have a question or feedback about this project?

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  1. Developer
  2. Category
    Developer Tool
  3. Type
    Library/API
  4. Status
    In Development
  5. Platforms
  6. Engine
    None

Development Team

Last updated 08/12/19
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!