summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-05-12 01:16:46 -0500
committersanine <sanine.not@pm.me>2023-05-12 01:16:46 -0500
commit3275ae4948fd2c1bb8da780214cbb741dc3178be (patch)
tree69dbf1d5b56896e1212454e5f79daaec1d201ec1 /main.lua
parent14195dac1eda9140192ca07003258715b8b0abd3 (diff)
begin refactor
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua67
1 files changed, 47 insertions, 20 deletions
diff --git a/main.lua b/main.lua
index ebd4cd1..10ffebe 100644
--- a/main.lua
+++ b/main.lua
@@ -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 },
},