Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rozenmad/Menori
Library for 3D rendering with LÖVE.
https://github.com/rozenmad/Menori
3d love2d lua
Last synced: 6 days ago
JSON representation
Library for 3D rendering with LÖVE.
- Host: GitHub
- URL: https://github.com/rozenmad/Menori
- Owner: rozenmad
- Created: 2020-07-26T23:07:34.000Z (over 4 years ago)
- Default Branch: dev
- Last Pushed: 2024-09-08T09:58:09.000Z (2 months ago)
- Last Synced: 2024-10-21T06:27:03.496Z (18 days ago)
- Topics: 3d, love2d, lua
- Language: Lua
- Homepage:
- Size: 7.7 MB
- Stars: 153
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-love2d - Menori - Library for 3D rendering with LÖVE. (3D)
README
# Menori
LÖVE library for 3D rendering based on scene graph. Support glTF 2.0 (implemented: meshes, materials, textures, skins, skeletons, animations). Assets may be provided either in JSON (.gltf) or binary (.glb) format.
Works on LÖVE 11.4 and higher.
[Web version](https://rozenmad.github.io/menori_demo1201/)
Built using [love-web-builder](https://github.com/rozenmad/love-web-builder)[Documentation](https://rozenmad.github.io)
You can generate documentation using `ldoc -c menori/docs/config.ld -o index .`
![preview_example](preview.png)
# Usage Example
``` lua
local menori = require 'menori'local ml = menori.ml
local vec3 = ml.vec3
local quat = ml.quatfunction love.load()
local _, _, w, h = menori.app:get_viewport()
camera = menori.PerspectiveCamera(60, w/h, 0.5, 1024)
environment = menori.Environment(camera)root_node = menori.Node()
local gltf = menori.glTFLoader.load('examples/assets/etrian_odyssey_3_monk.glb')
local scenes = menori.NodeTreeBuilder.create(gltf, function (scene, builder)
animations = menori.glTFAnimations(builder.animations)
animations:set_action(1)scene:traverse(function (node)
if node.mesh then
node.material:set("baseColor", {0.85, 0.95, 1.0, 1})
end
end)
end)root_node:attach(scenes[1])
endlocal scene = menori.Scene()
function love.draw()
love.graphics.clear(0.3, 0.25, 0.2)
scene:render_nodes(root_node, environment, {
node_sort_comp = menori.Scene.alpha_mode_comp
})love.graphics.print(love.timer.getFPS(), 10, 10)
endfunction love.update(dt)
scene:update_nodes(root_node, environment)local q = quat.from_euler_angles(0, math.rad(20), math.rad(10)) * vec3.unit_z * 2.0
local v = vec3(0, 0.5, 0)
camera.center = v
camera.eye = q + v
camera:update_view_matrix()animations:update(dt)
if love.keyboard.isDown('escape') then
love.event.quit()
end
end
```See ```main.lua``` for a more complete example.
# License
MIT