Go 3D Game Engine http://g3n.rocks
Fork from https://github.com/g3n/engine

Daniel Salvadori 3c8b6f2195 Clean app-desktop 6 년 전
animation 4008c7c85e improved animation framework 7 년 전
app 3c8b6f2195 Clean app-desktop 6 년 전
audio 3d1a1d1a0d Only enable audio on desktop for now 6 년 전
camera ae5d622e4d Fix docs 6 년 전
core 3d7a9f0e74 Require reference to INode when initializing a Node 6 년 전
experimental fc88461e90 fixed docs 7 년 전
geometry c6c66dbb37 Remove SetVAO(), VAO() from Geometry 6 년 전
gls 220d625121 Move common GLS parts into gls.go 6 년 전
graphic 96f598f771 Fix skybox render order 6 년 전
gui ef4ac7b773 Fix GUI menu z-ordering 6 년 전
light 3d7a9f0e74 Require reference to INode when initializing a Node 6 년 전
loader 12e5177914 Add glTF extensions (fix) 6 년 전
material 9b599be9c7 Add SetDepthFunc() to Material 6 년 전
math32 d73b6db8e3 Minor improvements and doc fixes 6 년 전
renderer 5fcf703c82 Optimize and clean shaders 6 년 전
text 84132e511c gofmt 7 년 전
texture b44649e46a Implement WASM version of GLS API 6 년 전
tools cc8e77164f Fix g3nshaders producint non-standard output 6 년 전
util 07495753ba Remove application package 6 년 전
window 31fc77e272 Fix and improve window implementations 6 년 전
.gitattributes 60a4df0db5 mark audio/windows as linguist-vendored 7 년 전
LICENSE 3585b36aec first import 8 년 전
README.md d702c40a9f updated README.md 7 년 전

README.md

G3N Banner

<a href="https://godoc.org/github.com/g3n/engine"><img src="https://godoc.org/github.com/g3n/engine?status.svg" alt="Godoc"></img></a>
<a href="https://goreportcard.com/report/github.com/g3n/engine"><img src="https://goreportcard.com/badge/github.com/g3n/engine"  alt="Go Report Card"/></a>

G3N - Go 3D Game Engine

G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that show rich and dynamic 3D representations - not just games. A basic integrated GUI framework is provided, and 3D spatial audio is supported through OpenAL.

### To see G3N in action try the G3N demo or the Gokoban award winning game.

<img style="float: right;" src="https://raw.githubusercontent.com/g3n/g3nd/master/data/images/g3nd_screenshots.png" alt="G3ND In Action"/>

## Highlighted Projects

Gokoban - 3D Puzzle Game (1st place in the 2017 Gopher Game Jam)

## Dependencies

Go 1.8+ is required. The engine also requires the system to have an OpenGL driver and a GCC-compatible C compiler.

On Unix-based systems the engine depends on some C libraries that can be installed using the appropriate distribution package manager. See below for OS specific requirements.

### Ubuntu/Debian-like

$ sudo apt-get install xorg-dev libgl1-mesa-dev libopenal1 libopenal-dev libvorbis0a libvorbis-dev libvorbisfile3

### Fedora

$ sudo dnf -y install xorg-x11-proto-devel mesa-libGL mesa-libGL-devel openal-soft openal-soft-devel libvorbis libvorbis-devel glfw-devel libXi-devel

### CentOS 7

Enable the EPEL repository:

$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Then install the same packages as for Fedora - remember to use yum instead of dnf for the package installation command.

### Windows

The necessary audio libraries sources and DLLs are supplied but they need to be installed manually. Please see Audio libraries for Windows for details. We tested the Windows build using the mingw-w64 toolchain (you can download this file in particular).

### macOS

Install the development files of OpenAL and Vorbis using Homebrew:

brew install libvorbis openal-soft

## Installation

The following command will download and install the engine along with all its Go dependencies:

go get -u github.com/g3n/engine/...

## Features

  • Cross-platform: Windows, Linux, and macOS
  • Integrated GUI (graphical user interface) with many widgets
  • Hierarchical scene graph - nodes can contain other nodes
  • 3D spatial audio via OpenAL (.wav, .ogg)
  • Real-time lighting: ambient, directional, point, and spot lights
  • Physically-based rendering: fresnel reflectance, geometric occlusion, microfacet distribution
  • Model loaders: glTF (.gltf, .glb), Wavefront OBJ (.obj), and COLLADA (.dae)
  • Geometry generators: box, sphere, cylinder, torus, etc...
  • Geometries support morph targets and multimaterials
  • Support for animated sprites based on sprite sheets
  • Perspective and ortographic cameras
  • Text image generation and support for TrueType fonts
  • Image textures can be loaded from GIF, PNG or JPEG files
  • Animation framework for position, rotation, and scale of objects
  • Support for user-created GLSL shaders: vertex, fragment, and geometry shaders
  • Integrated basic physics engine (experimental/incomplete)
  • Support for HiDPI displays

<img style="float: right;" src="https://github.com/g3n/g3n.github.io/raw/master/img/g3n_banner_small.png" alt="G3N Banner"/>

## Hello G3N

The code below is a basic "hello world" application (hellog3n) that shows a blue torus. You can download and install hellog3n via:

go get -u github.com/g3n/demos/hellog3n

For more complex demos please see the G3N demo program.

  package main

  import (
      "github.com/g3n/engine/util/application"
      "github.com/g3n/engine/geometry"
      "github.com/g3n/engine/material"
      "github.com/g3n/engine/math32"
      "github.com/g3n/engine/graphic"
      "github.com/g3n/engine/light"
  )

  func main() {

      app, _ := application.Create(application.Options{
          Title:  "Hello G3N",
          Width:  800,
          Height: 600,
      })

      // Create a blue torus and add it to the scene
      geom := geometry.NewTorus(1, .4, 12, 32, math32.Pi*2)
      mat := material.NewPhong(math32.NewColor("DarkBlue"))
      torusMesh := graphic.NewMesh(geom, mat)
      app.Scene().Add(torusMesh)

      // Add lights to the scene
      ambientLight := light.NewAmbient(&math32.Color{1.0, 1.0, 1.0}, 0.8)
      app.Scene().Add(ambientLight)
      pointLight := light.NewPoint(&math32.Color{1, 1, 1}, 5.0)
      pointLight.SetPosition(1, 0, 2)
      app.Scene().Add(pointLight)

      // Add an axis helper to the scene
      axis := graphic.NewAxisHelper(0.5)
      app.Scene().Add(axis)

      app.CameraPersp().SetPosition(0, 0, 3)
      app.Run()
  }

<img style="float: right;" src="https://github.com/g3n/demos/blob/master/hellog3n/screenshot.png" alt="hellog3n Screenshot"/>

## Documentation

The complete engine API reference can be found here: GoDoc.

There is also the beginning of a Getting Started Guide, and a newly created list of Guides and Tutorials:

Along with those, a good way to learn how to use the engine is to see the source code of G3ND - the G3N demo.

## Contributing

If you find a bug or create a new feature you are encouraged to send pull requests!

## Community

Join our channel on Gophers Slack (Click here to register for Gophers Slack). It's a great way to have your questions answered quickly by the G3N community.