Mesh duplication

This commit is contained in:
Dane Johnson
2021-01-23 13:00:08 -06:00
parent 5e8e7b3ce0
commit 59da3c088f
7 changed files with 51 additions and 1 deletions

BIN
demo/grass_lowres.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

13
demo/ground.mtl Normal file
View File

@@ -0,0 +1,13 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.001
Ns 20.935559
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.000000 0.000000 0.000000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 1
map_Kd /home/dane/dev/games/trough/godot/environment/raw/grass_lowres.png

16
demo/ground.obj Normal file
View File

@@ -0,0 +1,16 @@
# Blender v2.91.0 OBJ File: ''
# www.blender.org
mtllib ground.mtl
o Plane
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vn 0.0000 1.0000 0.0000
usemtl Material.001
s off
f 1/1/1 2/2/1 4/3/1 3/4/1

View File

@@ -45,6 +45,8 @@ function init()
"skybox/nz.png"
)
couch.Node.GetRoot().children:Append(skybox)
make_ground()
ball = couch.Mesh.FromFile("cube.obj")
material = ball:GetMaterial(0)
@@ -147,3 +149,17 @@ function onmousemotion(_, _, relx, rely)
cam_rot_x = relx
cam_rot_y = rely
end
function make_ground()
local ground = couch.TexturedMesh("ground.obj", "grass_lowres.png")
ground.transform.position = couch.Vector3(0.0, -2.0, 0.0)
ground.transform.scale = couch.Vector3(3.0, 1.0, 3.0)
for x = -20, 20, 1 do
for z = -20, 20, 1 do
local piece = ground:Duplicate()
piece.transform.position = couch.Vector3(3.0 * x, -2.0, 3.0 * z)
couch.Node.GetRoot().children:Append(piece)
end
end
end