Import materials from files

This commit is contained in:
Dane Johnson
2021-01-22 18:44:43 -06:00
parent 1ee5ed3e88
commit 1d97f6d855
22 changed files with 4427 additions and 44 deletions

Binary file not shown.

12
demo/ball.mtl Normal file
View File

@@ -0,0 +1,12 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material.001
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2

4105
demo/ball.obj Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

10
demo/cube.mtl Normal file
View File

@@ -0,0 +1,10 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl None
Ns 500
Ka 0.8 0.8 0.8
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2

40
demo/cube.obj Normal file
View File

@@ -0,0 +1,40 @@
# Blender v2.91.0 OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube_Cube.001
v -1.000000 -1.000000 1.000000
v -1.000000 1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v -1.000000 1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v 1.000000 1.000000 1.000000
v 1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -1.000000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.625000 0.500000
vt 0.375000 0.500000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.125000 0.500000
vt 0.125000 0.750000
vt 0.875000 0.500000
vt 0.875000 0.750000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
usemtl None
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/6/3 8/5/3 6/7/3 5/8/3
f 5/8/4 6/7/4 2/9/4 1/10/4
f 3/11/5 7/6/5 5/8/5 1/12/5
f 8/5/6 4/13/6 2/14/6 6/7/6

View File

@@ -14,6 +14,7 @@ local cam_rot_y = 0.0
local SPEED = 30
local WHITE = couch.Color(1.0, 1.0, 1.0)
local RED = couch.Color(1.0, 0.0, 0.0)
local BLUE = couch.Color(0.0, 0.0, 1.0)
@@ -34,15 +35,15 @@ function init()
light.specular = 0.01
couch.Node.GetRoot().children:Append(light)
ball = couch.Mesh.FromFile("cube.glb")
material = couch.Material()
material.color = RED
material.usesColor = true
ball = couch.Mesh.FromFile("cube.obj")
material = ball:GetMaterial(0)
material.ambient = WHITE
ball:SetMaterial(0, material)
couch.Node.GetRoot().children:Append(ball)
ball1 = couch.Mesh.FromFile("ball.glb")
material = couch.Material()
ball1 = couch.Mesh.FromFile("ball.obj")
print(material.diffuse.b)
material = ball1:GetMaterial(0)
material.tex = couch.Texture.FromFile("container.png")
material.usesTex = true
ball1:SetMaterial(0, material)
@@ -50,12 +51,12 @@ function init()
ball1.transform:Translate(0.0, 3.0, 0.0)
trough = couch.TexturedMesh("trough.glb", "wood_lowres.png")
trough = couch.TexturedMesh("trough.obj", "wood_lowres.png")
couch.Node.GetRoot().children:Append(trough)
trough.transform:Translate(10.0, 0.0, 0.0)
trough.transform.scale = trough.transform.scale * 3.0
scaffold = couch.TexturedMesh("scaffold.glb", "grate_floor_lowres.png", "railing.png")
scaffold = couch.TexturedMesh("scaffold.obj", "grate_floor_lowres.png", "railing.png")
material = scaffold:GetMaterial(0)
material.alphaScissor = 0.9

Binary file not shown.

22
demo/scaffold.mtl Normal file
View File

@@ -0,0 +1,22 @@
# Blender MTL File: 'scaffold.blend'
# Material Count: 2
newmtl grate
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
newmtl railing
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

52
demo/scaffold.obj Normal file
View File

@@ -0,0 +1,52 @@
# Blender v2.91.0 OBJ File: 'scaffold.blend'
# www.blender.org
mtllib scaffold.mtl
o Cube
v 1.934654 0.106465 -3.000000
v 1.934654 0.010658 -3.000000
v 1.934654 0.106465 3.000000
v 1.934654 0.010658 3.000000
v -1.956436 0.106465 -3.000000
v -1.956436 0.010658 -3.000000
v -1.956436 0.106465 3.000000
v -1.956436 0.010658 3.000000
v 1.934654 2.092319 -3.000000
v 1.934654 2.092319 3.000000
vt 0.003780 1.006212
vt 0.003780 0.005796
vt 0.994847 0.005796
vt 0.994847 1.006212
vt 0.426341 0.196745
vt 0.393727 0.196745
vt 0.393727 0.000079
vt 0.426341 0.000079
vt 0.426341 0.999921
vt 0.393727 0.999921
vt 0.393727 0.696666
vt 0.426341 0.696666
vt 1.986373 0.005796
vt 1.986373 1.006211
vt 0.995306 1.006212
vt 0.995306 0.005796
vt 0.426341 0.500001
vt 0.393727 0.500001
vt 0.000072 0.000073
vt 0.999928 0.000072
vt 0.999928 0.998269
vt 0.000072 0.998269
vn 0.0000 1.0000 0.0000
vn 0.0000 0.0000 1.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 -1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
usemtl grate
s off
f 1/1/1 5/2/1 7/3/1 3/4/1
f 4/5/2 3/6/2 7/7/2 8/8/2
f 8/9/3 7/10/3 5/11/3 6/12/3
f 6/13/4 2/14/4 4/15/4 8/16/4
f 2/17/5 1/18/5 3/6/5 4/5/5
f 6/12/6 5/11/6 1/18/6 2/17/6
usemtl railing
f 3/19/5 1/20/5 9/21/5 10/22/5

Binary file not shown.

12
demo/trough.mtl Normal file
View File

@@ -0,0 +1,12 @@
# Blender MTL File: 'trough.blend'
# Material Count: 1
newmtl Material
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

80
demo/trough.obj Normal file
View File

@@ -0,0 +1,80 @@
# Blender v2.91.0 OBJ File: 'trough.blend'
# www.blender.org
mtllib trough.mtl
o Cube
v 0.559649 0.176655 1.457162
v 0.559649 0.176655 -1.457162
v -0.559649 0.176655 1.457162
v -0.559649 0.176655 -1.457162
v 0.768938 1.259425 2.002092
v 0.615018 0.029390 1.601327
v 0.768938 1.259425 -2.002092
v 0.615018 0.029390 -1.601327
v -0.768938 1.259425 2.002092
v -0.615018 0.029390 1.601327
v -0.768938 1.259425 -2.002092
v -0.615018 0.029390 -1.601327
v 0.695141 1.259425 -1.809946
v 0.695141 1.259425 1.809946
v -0.695141 1.259425 -1.809946
v -0.695141 1.259425 1.809946
vt 0.686031 0.303372
vt 0.701491 0.673315
vt 0.962419 0.711595
vt 0.971650 0.340317
vt -0.300445 0.304089
vt -0.298284 0.709022
vt 0.099821 0.696156
vt 0.134610 0.334567
vt 0.599830 0.530280
vt 0.599830 0.643491
vt 0.894598 0.643491
vt 0.894598 0.530280
vt 0.272975 0.302381
vt 0.272886 0.674376
vt 0.599830 0.000171
vt 0.607295 0.019606
vt 0.747924 0.019606
vt 0.747925 0.385756
vt 0.755388 0.405188
vt 0.755388 0.000170
vt -0.066641 0.235731
vt -0.225881 0.232306
vt -0.204799 0.717963
vt -0.061225 0.757944
vt 1.229174 0.237805
vt 0.663827 0.254265
vt 0.728179 0.721933
vt 1.245199 0.723908
vt 0.923761 0.405529
vt 0.599830 0.405529
vt 0.599830 0.529940
vt 0.923761 0.529940
vt 0.471728 0.284766
vt 0.491305 0.770590
vt 0.599832 0.405188
vt 0.607295 0.385755
vn 0.0000 0.3098 0.9508
vn 0.9923 0.1242 0.0000
vn 0.0000 1.0000 0.0000
vn -0.9923 0.1242 0.0000
vn 0.0000 0.3098 -0.9508
vn 0.0000 -0.3098 -0.9508
vn -0.9923 -0.1242 0.0000
vn 0.0000 -1.0000 0.0000
vn 0.9923 -0.1242 0.0000
vn 0.0000 -0.3098 0.9508
usemtl Material
s off
f 2/1/1 13/2/1 15/3/1 4/4/1
f 4/5/2 15/6/2 16/7/2 3/8/2
f 3/9/3 1/10/3 2/11/3 4/12/3
f 1/13/4 14/14/4 13/2/4 2/1/4
f 3/8/5 16/7/5 14/14/5 1/13/5
f 5/15/3 14/16/3 16/17/3 15/18/3 11/19/3 9/20/3
f 8/21/6 12/22/6 11/23/6 7/24/6
f 12/25/7 10/26/7 9/27/7 11/28/7
f 10/29/8 12/30/8 8/31/8 6/32/8
f 6/33/9 8/21/9 7/24/9 5/34/9
f 10/26/10 6/33/10 5/34/10 9/27/10
f 14/16/3 5/15/3 7/35/3 11/19/3 15/18/3 13/36/3