Skip to content

Instantly share code, notes, and snippets.

@Gauravjeetsingh
Last active July 9, 2016 05:37
Show Gist options
  • Save Gauravjeetsingh/19444ad7059952e7d0058f6fa7f8365d to your computer and use it in GitHub Desktop.
Save Gauravjeetsingh/19444ad7059952e7d0058f6fa7f8365d to your computer and use it in GitHub Desktop.
#filename: first.obj
v -1.0 -1.0 -1.0
v +1.0 -1.0 -1.0
v +1.0 +1.0 -1.0
v -1.0 +1.0 -1.0
v -1.0 -1.0 +1.0
v +1.0 -1.0 +1.0
v +1.0 +1.0 +1.0
v -1.0 +1.0 +1.0
f 1 2 3 4
f 5 6 7 8
f 1 2 6 5
f 2 3 7 6
f 3 4 8 7
f 4 1 5 8
#filename: second.obj
v -1.0 -1.0 +1.0
v +1.0 -1.0 +1.0
v +1.0 +1.0 +1.0
v -1.0 +1.0 +1.0
v -2.0 -2.0 +2.0
v +2.0 -2.0 +2.0
v +2.0 +2.0 +2.0
v -2.0 +2.0 +2.0
f 1 2 3 4
f 5 6 7 8
f 1 2 6 5
f 2 3 7 6
f 3 4 8 7
f 4 1 5 8
#filename: merged.obj
#vertex of first.obj
v -1.0 -1.0 -1.0
v +1.0 -1.0 -1.0
v +1.0 +1.0 -1.0
v -1.0 +1.0 -1.0
v -1.0 -1.0 +1.0
v +1.0 -1.0 +1.0
v +1.0 +1.0 +1.0
v -1.0 +1.0 +1.0
#vertex of second.obj
v -1.0 -1.0 +1.0
v +1.0 -1.0 +1.0
v +1.0 +1.0 +1.0
v -1.0 +1.0 +1.0
v -2.0 -2.0 +2.0
v +2.0 -2.0 +2.0
v +2.0 +2.0 +2.0
v -2.0 +2.0 +2.0
#face elements of first.obj
f 1 2 3 4
f 5 6 7 8
f 1 2 6 5
f 2 3 7 6
f 3 4 8 7
f 4 1 5 8
#face elements of second.obj
#first.obj has 8 vertex, so each vertex of second.obj is increased by 8
# f 1 2 3 4 becomes f 1+8 2+8 3+8 4+8 which is equal to f 9 10 11 12
f 9 10 11 12
f 13 14 15 16
f 9 10 14 13
f 10 11 15 14
f 11 12 16 15
f 12 9 13 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment