added Eri's painting!

This commit is contained in:
UndeadMaelys 2021-04-19 17:03:38 +02:00
parent f52803aaea
commit 38e8c5a4db
5 changed files with 136 additions and 28 deletions

View File

@ -27,7 +27,7 @@ function love.load()
obj_list = {} obj_list = {}
-- obj_flower_pot = g3d.newModel("objects/flower_pot.obj","objects/flower_pot/texture.png",{0,0,0},{0,0,0},{1,-1,1}), -- obj_flower_pot = g3d.newModel("objects/flower_pot.obj","objects/flower_pot/texture.png",{0,0,0},{0,0,0},{1,-1,1}),
-- --
generate_museum(0,0,0) generate_museum(0,0,0)
end end
@ -42,9 +42,9 @@ function love.update(dt)
g3d.camera.firstPersonMovement(dt,5) g3d.camera.firstPersonMovement(dt,5)
end end
-- count frames per seconds -- count frames per seconds
if fps_second >= 1 then if fps_second >= 1 then
fps_second = fps_second - 1 fps_second = fps_second - 1
fps_draw = fps_count fps_draw = fps_count
fps_count = 0 fps_count = 0
end end
fps_second = fps_second + dt fps_second = fps_second + dt
@ -53,14 +53,14 @@ function love.update(dt)
end end
function love.keypressed(key) function love.keypressed(key)
if key == "z" then if key == "z" then
obj_list = {} obj_list = {}
notsorandomseed = os.time() notsorandomseed = os.time()
math.randomseed(notsorandomseed) math.randomseed(notsorandomseed)
notsorandomseed = love.data.encode("string", "hex", love.data.hash("sha256", notsorandomseed)) notsorandomseed = love.data.encode("string", "hex", love.data.hash("sha256", notsorandomseed))
generate_museum(0,0,0) generate_museum(0,0,0)
end end
if key == "escape" then if key == "escape" then
if pause then if pause then
pause = false pause = false
love.mouse.setRelativeMode(true) love.mouse.setRelativeMode(true)
@ -70,7 +70,7 @@ function love.keypressed(key)
end end
end end
end end
function love.draw() function love.draw()
-- draw everything -- draw everything
for _, obj in pairs(obj_list) do for _, obj in pairs(obj_list) do
@ -108,23 +108,23 @@ function generate_museum(x,y,z)
-- make the ground -- make the ground
for w = 0, width, 1 do for d = 0, depth, 1 do for w = 0, width, 1 do for d = 0, depth, 1 do
table.insert(obj_list,g3d.newModel("objects/ground.obj","objects/ground/texture.png",{x+w,y,z+d},{0,0,0},{-1,1,-1})) table.insert(obj_list,g3d.newModel("objects/ground.obj","objects/ground/texture.png",{x+w,y,z+d},{0,0,0},{-1,1,-1}))
end end end end
-- make the walls -- make the walls
for w = 0, width, 1 do for h = 0, height, 1 do for w = 0, width, 1 do for h = 0, height, 1 do
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+w,y-h-1,z},{0,math.pi/2,0},{-1,1,-1})) table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+w,y-h-1,z},{0,math.pi/2,0},{-1,1,-1}))
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+w,y-h-1,z+depth},{0,math.pi/2,0},{-1,1,-1})) table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+w,y-h-1,z+depth},{0,math.pi/2,0},{-1,1,-1}))
end end end end
for d = 0, depth, 1 do for h = 0, height, 1 do for d = 0, depth, 1 do for h = 0, height, 1 do
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x,y-h-1,z+d},{0,0,0},{-1,1,-1})) table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x,y-h-1,z+d},{0,0,0},{-1,1,-1}))
table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+width,y-h-1,z+d},{0,0,0},{-1,1,-1})) table.insert(obj_list,g3d.newModel("objects/wall.obj","objects/wall/texture.png",{x+width,y-h-1,z+d},{0,0,0},{-1,1,-1}))
end end end end
-- decorate with paintings -- decorate with paintings
local art_height = 2.5 local art_height = 2.5
for w = 2, width-2, 4 do for w = 2, width-2, 4 do
random_art(x+w,y-art_height,z+1/16,0,-math.pi/2,0) random_art(x+w,y-art_height,z+1/16,0,-math.pi/2,0)
random_art(x+w,y-art_height,z-1/16+depth,0,math.pi/2,0) random_art(x+w,y-art_height,z-1/16+depth,0,math.pi/2,0)
@ -140,14 +140,14 @@ function generate_museum(x,y,z)
if pillars == 0 then if pillars == 0 then
-- no pillars -- no pillars
elseif pillars == 1 then elseif pillars == 1 then
table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width/4, y-5*(76/80), z+depth/4},{0,0,0},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width/4, y-5*(76/80), z+depth/4},{0,0,0},{1,1,1}))
table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width*3/4, y-5*(76/80), z+depth*3/4},{0,0,0},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width*3/4, y-5*(76/80), z+depth*3/4},{0,0,0},{1,1,1}))
table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width*3/4, y-5*(76/80), z+depth/4},{0,0,0},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width*3/4, y-5*(76/80), z+depth/4},{0,0,0},{1,1,1}))
table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width/4, y-5*(76/80), z+depth*3/4},{0,0,0},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/pillar.obj","objects/pillar/texture.png",{x+width/4, y-5*(76/80), z+depth*3/4},{0,0,0},{1,1,1}))
end end
-- place carpet in the middle of the room -- place carpet in the middle of the room
table.insert(obj_list,g3d.newModel("objects/carpet.obj","objects/carpet/texture.png",{x+width/2, y-(1/16) , z+depth/2},{0,math.random(),0},{1,-1,1})) table.insert(obj_list,g3d.newModel("objects/carpet.obj","objects/carpet/texture.png",{x+width/2, y-(1/16) , z+depth/2},{0,math.random(),0},{1,-1,1}))
-- place camera in the middle of the room -- place camera in the middle of the room
g3d.camera.position = {x+width/2, y-2, z+depth/2} g3d.camera.position = {x+width/2, y-2, z+depth/2}
@ -155,26 +155,28 @@ end
function random_art(x,y,z,rotx,roty,rotz) function random_art(x,y,z,rotx,roty,rotz)
local art = math.random(0,9) local art = math.random(0,10)
if art == 0 then if art == 0 then
-- no art :S -- no art :S
elseif art == 1 then elseif art == 1 then
table.insert(obj_list,g3d.newModel("objects/art_9_12.obj","objects/art_9_12/eri_sueños.png",{x,y-(12/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_9_12.obj","objects/art_9_12/eri_sueños.png",{x,y-(12/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 2 then elseif art == 2 then
table.insert(obj_list,g3d.newModel("objects/art_1_1.obj","objects/art_1_1/yari_walk.png",{x,y-(10/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_1_1.obj","objects/art_1_1/yari_walk.png",{x,y-(10/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 3 then elseif art == 3 then
table.insert(obj_list,g3d.newModel("objects/art_16_9.obj","objects/art_16_9/clareta_tira.png",{x,y-(9/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_16_9.obj","objects/art_16_9/clareta_tira.png",{x,y-(9/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 4 then elseif art == 4 then
table.insert(obj_list,g3d.newModel("objects/art_16_12.obj","objects/art_16_12/clareta_garden_throne.png",{x,y-(12/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_16_12.obj","objects/art_16_12/clareta_garden_throne.png",{x,y-(12/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 5 then elseif art == 5 then
table.insert(obj_list,g3d.newModel("objects/art_24_16.obj","objects/art_24_16/eri_dungeon.png",{x,y-(16/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_24_16.obj","objects/art_24_16/eri_dungeon.png",{x,y-(16/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 6 then elseif art == 6 then
table.insert(obj_list,g3d.newModel("objects/art_12_9.obj","objects/art_12_9/noe_nerielle.png",{x,y-(9/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_12_9.obj","objects/art_12_9/noe_nerielle.png",{x,y-(9/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 7 then elseif art == 7 then
table.insert(obj_list,g3d.newModel("objects/art_1_1.obj","objects/art_1_1/yari_pumpum.png",{x,y-(10/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_1_1.obj","objects/art_1_1/yari_pumpum.png",{x,y-(10/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 8 then elseif art == 8 then
table.insert(obj_list,g3d.newModel("objects/art_12_6.obj","objects/art_12_6/eri_sigils.png",{x,y-(6/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_12_6.obj","objects/art_12_6/eri_sigils.png",{x,y-(6/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 9 then elseif art == 9 then
table.insert(obj_list,g3d.newModel("objects/art_16_24.obj","objects/art_16_24/eri_ariel_with_overalls.png",{x,y-(24/16),z},{rotx,roty,rotz},{1,1,1})) table.insert(obj_list,g3d.newModel("objects/art_16_24.obj","objects/art_16_24/eri_ariel_with_overalls.png",{x,y-(24/16),z},{rotx,roty,rotz},{1,1,1}))
elseif art == 10 then
table.insert(obj_list,g3d.newModel("objects/art_4_3.obj","objects/art_4_3/eri_window.png",{x,y-(16/16),z},{rotx,roty,rotz},{1,1,1}))
end end
end end

4
objects/art_4_3.mtl Normal file
View File

@ -0,0 +1,4 @@
# Made in Blockbench 3.7.4
newmtl m_0
map_Kd IMG_20210417_125854-01.png
newmtl none

101
objects/art_4_3.obj Normal file
View File

@ -0,0 +1,101 @@
# Made in Blockbench 3.7.4
mtllib art_4_3.mtl
o cube
v 0.0625 1.9375 1.25
v 0.0625 1.9375 -1.25
v 0.0625 0.0625 1.25
v 0.0625 0.0625 -1.25
v 0 1.9375 -1.25
v 0 1.9375 1.25
v 0 0.0625 -1.25
v 0 0.0625 1.25
vt 0 1
vt 0 0
vt 1 1
vt 0 0
vt 1 0
vt 1 1
vt 0.16176470588235295 0
vt 0.16176470588235295 0.039166666666666794
vt 0.8230392156862745 0
vt 0.16176470588235295 0.039166666666666794
vt 0.8230392156862745 0.039166666666666794
vt 0.8230392156862745 0
vt 0.1877450980392157 1
vt 0.1877450980392157 1
vt 0.75 1
vt 0.1877450980392157 1
vt 0.75 1
vt 0.75 1
vt 0.1875 0
vt 0.1875 0.015625
vt 0.75 0
vt 0.1875 0.015625
vt 0.75 0.015625
vt 0.75 0
vt 0 1
vt 0 0
vt 0 1
vt 0 0
vt 0 0
vt 0 1
vt 0.996078431372549 0.8300000000000001
vt 0.996078431372549 0.08000000000000007
vt 0.9965686274509805 0.8300000000000001
vt 0.996078431372549 0.08000000000000007
vt 0.9965686274509805 0.08000000000000007
vt 0.9965686274509805 0.8300000000000001
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
usemtl m_0
f 1/1/1 3/2/2 2/3/3
f 3/4/4 4/5/5 2/6/6
usemtl m_0
f 5/7/7 7/8/8 6/9/9
f 7/10/10 8/11/11 6/12/12
usemtl m_0
f 5/13/13 6/14/14 2/15/15
f 6/16/16 1/17/17 2/18/18
usemtl m_0
f 8/19/19 7/20/20 3/21/21
f 7/22/22 4/23/23 3/24/24
usemtl m_0
f 6/25/25 8/26/26 1/27/27
f 8/28/28 3/29/29 1/30/30
usemtl m_0
f 2/31/31 4/32/32 5/33/33
f 4/34/34 7/35/35 5/36/36

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 MiB

File diff suppressed because one or more lines are too long