Skip to content

Instantly share code, notes, and snippets.

@MaikKlein
Created January 10, 2017 12:09
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
# Blender v2.76 (sub 0) OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
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 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
vt 1.000000 0.333333
vt 1.000000 0.666667
vt 0.666667 0.666667
vt 0.666667 0.333333
vt 0.666667 0.000000
vt 0.000000 0.333333
vt 0.000000 0.000000
vt 0.333333 0.000000
vt 0.333333 1.000000
vt 0.000000 1.000000
vt 0.000000 0.666667
vt 0.333333 0.333333
vt 0.333333 0.666667
vt 1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 1.000000 0.000000 0.000000
vn -0.000000 0.000000 1.000000
vn -1.000000 -0.000000 -0.000000
vn 0.000000 0.000000 -1.000000
usemtl Material
s off
f 2/1/1 3/2/1 4/3/1
f 8/1/2 7/4/2 6/5/2
f 5/6/3 6/7/3 2/8/3
f 6/8/4 7/5/4 3/4/4
f 3/9/5 7/10/5 8/11/5
f 1/12/6 4/13/6 8/11/6
f 1/4/1 2/1/1 4/3/1
f 5/14/2 8/1/2 6/5/2
f 1/12/3 5/6/3 2/8/3
f 2/12/4 6/8/4 3/4/4
f 4/13/5 3/9/5 8/11/5
f 5/6/6 1/12/6 8/11/6
@Mohido
Copy link

Mohido commented Feb 12, 2022

A javascript cube. Same as the above .obj but in javascript (If you are doing a webgl proj.)

/** vertices */
const cube_vs = [
1.0 , -1.0, -1.0,
1.0 , -1.0, 1.0,
-1.0 , -1.0, 1.0,
-1.0 , -1.0, -1.0,
1.0 , 1.0, -1.0,
1.0 , 1.0, 1.0,
-1.0 , 1.0, 1.0,
-1.0 , 1.0, -1.0,
];

/** Indices */
const cube_i = [
2,1,1, 3,2,1, 4,3,1,
8,1,2, 7,4,2, 6,5,2,
5,6,3, 6,7,3, 2,8,3,
6,8,4, 7,5,4, 3,4,4,
3,9,5, 7,10,5, 8,11,5,
1,12,6, 4,13,6, 8,11,6,
1,4,1, 2,1,1, 4,3,1,
5,14,2, 8,1,2, 6,5,2,
1,12,3, 5,6,3, 2,8,3,
2,12,4, 6,8,4, 3,4,4,
4,13,5, 3,9,5, 8,11,5,
5,6,6, 1,12,6, 8,11,6,
];

/** Cube normals cords */
const cube_n = [
0.0, -1.0, 0.0,
0.0, 1.0, 0.0,
1.0, 0.0, 0.0,
-0.0, 0.0, 1.0,
-1.0, -0.0, -0.0,
0.0, 0.0, -1.0
];

/** Cube textures cords */
const cube_t = [
1.0, 0.3,
1.0, 0.6,
0.6, 0.6,
0.6, 0.3,
0.6, 0.0,
0.0, 0.3,
0.0, 0.0,
0.3, 0.0,
0.3, 1.0,
0.0, 1.0,
0.0, 0.6,
0.3, 0.3,
0.3, 0.6,
1.0, 0.0
];

@silvertakana
Copy link

for some reason, Assimp doesn't load the last triangle if it doesn't have an enter character at the end of the file. You should add an enter character there. Took me a while to find out.

@softwareantics
Copy link

Thank you so much @silvertakana. I would've spent ages figuring out what was going on if it wasn't for you ❤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment