diff options
Diffstat (limited to 'main.lua')
-rw-r--r-- | main.lua | 67 |
1 files changed, 47 insertions, 20 deletions
@@ -31,37 +31,64 @@ systems:addSystem(honey.ecs.collision.system, {space=space}) systems:addSystem(honey.ecs.physics.system, {space=space, world=world}) function setupEntities() - - local plane = entities:createEntity() - entities:addComponents(plane, { - node = { - matrix = Mat4() - :identity() - :rotateZ(math.rad(5)) - }, - collision = { - class = "plane", - }, - }) - - local planeMesh = entities:createEntityWithComponents{ + local terrain = entities:createEntityWithComponents{ node = { - parent = plane, - matrix = Mat4():identity():rotateX(0.5*math.pi):scale(Vec3{20,20,20}), + matrix = Mat4():identity():translate(Vec3{4,0,0}), }, renderMesh = { - textures = { ourTexture={ filename="assets/green+grass-1024x1024.jpg" } }, - shader = { vertex="vertex.glsl", fragment="fragment.glsl" }, - mesh = { filename="builtin.quad", index=1 }, + textures = { + ourTexture = { + filename = "assets/green+grass-1024x1024.jpg", + }, + }, + shader = { + vertex = "vertex.glsl", + fragment = "fragment.glsl", + }, + mesh = { filename = "assets/terrain.obj", index=1 }, + }, + collision = { + class = "trimesh", + filename = "assets/terrain.obj", }, } + +-- local plane = entities:createEntity() +-- entities:addComponents(plane, { +-- node = { +-- matrix = Mat4() +-- :identity() +-- :rotateZ(math.rad(5)) +-- }, +-- collision = { +-- class = "plane", +-- }, +-- }) +-- +-- local planeMesh = entities:createEntityWithComponents{ +-- node = { +-- parent = plane, +-- matrix = Mat4():identity():rotateX(0.5*math.pi):scale(Vec3{20,20,20}), +-- }, +-- renderMesh = { +-- textures = { +-- ourTexture={ +-- filename="assets/green+grass-1024x1024.jpg" +-- } +-- }, +-- shader = { vertex="vertex.glsl", fragment="fragment.glsl" }, +-- mesh = { filename="builtin.quad", index=1 }, +-- }, +-- } local id = entities:createEntity() entities:addComponents(id, { renderMesh = { - textures = { ourTexture={ filename="77155.png" } }, + textures = { + ourTexture={ filename="77155.png" } + }, shader = { vertex="vertex.glsl", fragment="fragment.glsl" }, mesh = { filename="assets/icosahedron.obj", index=1 }, }, |