https://github.com/zacharycarter/zengine
2D | 3D Game development library
https://github.com/zacharycarter/zengine
2d 3d game-development game-engine nim
Last synced: 8 months ago
JSON representation
2D | 3D Game development library
- Host: GitHub
- URL: https://github.com/zacharycarter/zengine
- Owner: zacharycarter
- Archived: true
- Created: 2017-07-08T15:06:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-03T21:29:50.000Z (about 8 years ago)
- Last Synced: 2024-08-04T01:15:21.552Z (over 1 year ago)
- Topics: 2d, 3d, game-development, game-engine, nim
- Language: Nim
- Homepage:
- Size: 58.5 MB
- Stars: 156
- Watchers: 9
- Forks: 13
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zengine
2D | 3D Game development library
NOTE - Please run examples from root directory for now
Progress -





Dependencies:
[Assimp](https://github.com/assimp/assimp)
```nim
import zengine, sdl2, opengl
type
LightKind = enum
Point, Directional, Spot
Light = ref object
id: int
enabled: bool
kind: LightKind
position: Vector3
target: Vector3
radius: float
diffuse: ZColor
intensity: float
coneAngle: float
const
WIDTH = 960
HEIGHT = 540
MAX_LIGHTS = 8
var lights: array[MAX_LIGHTS, Light]
var lightsCount = 0
var lightsLocs: array[MAX_LIGHTS, array[8, int]]
proc createLight(kind: LightKind, position: Vector3, diffuse: ZColor): Light =
result = nil
if lightsCount < MAX_LIGHTS:
result = Light(
id: lightsCount,
kind: kind,
enabled: true,
position: position,
target: vectorZero(),
intensity: 1.0,
diffuse: diffuse
)
lights[lightsCount] = result
inc(lightsCount)
else:
result = lights[lightsCount]
proc setShaderLightsValues(shader: Shader) =
var tempInt: array[8, GLint]
var tempFloat: array[8, GLfloat]
for i in 0..