Skip to content

Commit

Permalink
🎲 Dice I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-uk committed Aug 22, 2023
1 parent a838ae1 commit 8b7ad22
Show file tree
Hide file tree
Showing 15 changed files with 1,584 additions and 177 deletions.
24 changes: 13 additions & 11 deletions dist-bundle/gsots3d.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist-bundle/gsots3d.js.map

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions examples/_objects/dice.mtl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
newmtl texture
Ka 0.0 0.0 0.0
Kd 1 1 1
Ks 0.0 0.0 0.0
Ns 10.0
illum 2
map_Kd dice.png
newmtl diceface
Ka 1 1 1
Kd 0.5 0.2 0.9
Ks 0.7 0.7 0.7
Ns 50
map_Kd dice.png
map_bump dice_normal.png
152 changes: 54 additions & 98 deletions examples/_objects/dice.obj
Original file line number Diff line number Diff line change
@@ -1,98 +1,54 @@
# cube-tex.obj
# Import into Blender with Y-forward, Z-up
#
# Vertices: Faces:
# f-------g +-------+
# /. /| /. 5 /| 3 back
# / . / | / . / |
# e-------h | 2 +-------+ 1|
# | b . .|. c z right | . . .|. +
# | . | / | /y | . 4 | /
# |. |/ |/ |. |/
# a-------d +---- x +-------+
# 6
# bottom

# Material defined in separate file.
mtllib cube.mtl

g cube

# Vertices
v 0.0 0.0 0.0 # 1 a
v 0.0 1.0 0.0 # 2 b
v 1.0 1.0 0.0 # 3 c
v 1.0 0.0 0.0 # 4 d
v 0.0 0.0 1.0 # 5 e
v 0.0 1.0 1.0 # 6 f
v 1.0 1.0 1.0 # 7 g
v 1.0 0.0 1.0 # 8 h

# Normal vectors
# One for each face. Shared by all vertices in that face.
vn 1.0 0.0 0.0 # 1 cghd
vn -1.0 0.0 0.0 # 2 aefb
vn 0.0 1.0 0.0 # 3 gcbf
vn 0.0 -1.0 0.0 # 4 dhea
vn 0.0 0.0 1.0 # 5 hgfe
vn 0.0 0.0 -1.0 # 6 cdab

# Texture
# (u,v) coordinate into texture map image, ranging from 0.0 - 1.0.
# +---f---g---+---+
# | | 5 | | |
# f---e---h---g---+
# | 2 | 4 | 1 | | v
# b---a---d---c---+ |
# | | 6 | | | |
# +---b---c---+---+ +---- u
# | | 3 | | |
# +---f---g---+---+
vt 0.25 1.00 # 1 f(5) = f for face 5
vt 0.50 1.00 # 2 g(5)
vt 0 0.75 # 3 f(2)
vt 0.25 0.75 # 4 e(2,4,5)
vt 0.50 0.75 # 5 h(1,4,5)
vt 0.75 0.75 # 6 g(1)
vt 0 0.50 # 7 b(2)
vt 0.25 0.50 # 8 a(2,4,6)
vt 0.50 0.50 # 9 d(1,4,6)
vt 0.75 0.50 # 10 c(1)
vt 0.25 0.25 # 11 b(3,6)
vt 0.50 0.25 # 12 c(3,6)
vt 0.25 0 # 13 f(3)
vt 0.50 0 # 14 g(3)

# Define material for the following faces
usemtl texture

# Faces v/vt/vn
# 3-------2
# | - |
# | # | Each face = 2 triangles (ccw)
# | - | = 1-2-3 + 1-3-4
# 4-------1

# Face 1: cghd = cgh + chd
f 3/10/1 7/6/1 8/5/1
f 3/10/1 8/5/1 4/9/1

# Face 2: aefb = aef + afb
f 1/8/2 5/4/2 6/3/2
f 1/8/2 6/3/2 2/7/2

# Face 3: gcbf = gcb + gbf
f 7/14/3 3/12/3 2/11/3
f 7/14/3 2/11/3 6/13/3

# Face 4: dhea = dhe + dea
f 4/9/4 8/5/4 5/4/4
f 4/9/4 5/4/4 1/8/4

# Face 5: hgfe = hgf + hfe
f 8/5/5 7/2/5 6/1/5
f 8/5/5 6/1/5 5/4/5

# Face 6: cdab = cda + cab
f 3/12/6 4/9/6 1/8/6
f 3/12/6 1/8/6 2/11/6
# File produced by Open Asset Import Library (http://www.assimp.sf.net)
# (assimp v3.1.161429758)

mtllib dice.mtl

# vertex positions
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

# UV coordinates
vt 0.625000 0.500000
vt 0.875000 0.500000
vt 0.875000 0.750000
vt 0.625000 0.750000
vt 0.375000 0.750000
vt 0.625000 1.000000
vt 0.375000 1.000000
vt 0.375000 0.000000
vt 0.625000 0.000000
vt 0.625000 0.250000
vt 0.375000 0.250000
vt 0.125000 0.500000
vt 0.375000 0.500000
vt 0.125000 0.750000

# vertex normals
vn -0.000000 1.000000 -0.000000
vn -0.000000 -0.000000 1.000000
vn -1.000000 -0.000000 -0.000000
vn -0.000000 -1.000000 -0.000000
vn 1.000000 -0.000000 -0.000000
vn -0.000000 -0.000000 -1.000000

# Mesh
g Cube
usemtl diceface
f 4/4/1 1/1/1 2/2/1
f 2/2/1 3/3/1 4/4/1
f 6/7/2 5/5/2 4/4/2
f 4/4/2 3/6/2 6/7/2
f 7/11/3 6/8/3 3/9/3
f 3/9/3 2/10/3 7/11/3
f 6/14/4 7/12/4 8/13/4
f 8/13/4 5/5/4 6/14/4
f 5/5/5 8/13/5 1/1/5
f 1/1/5 4/4/5 5/5/5
f 8/13/6 7/11/6 2/10/6
f 2/10/6 1/1/6 8/13/6
Binary file modified examples/_objects/dice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/_objects/dice_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8b7ad22

Please sign in to comment.