Homebrew Anyone knows how this header file was created?

YugamiSekai

Mr. Picross
OP
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
21
XP
2,275
Country
United States
In the 3DS homebrew example "loop_subdivision" there's a file which has the coordinates of a OBJ file:

Code:
static const vertex vertex_list[] =
{
    /*0*/ FACE(0.500000, 0.000000, -0.500000, 1.000000, 0.000000, 7),
    /*1*/ FACE(0.500000, 1.000000, 0.500000, 0.000000, 1.000000, 6),
    /*2*/ FACE(0.500000, 0.000000, 0.500000, 0.000000, 0.000000, 3),
    /*3*/ FACE(0.500000, 1.000000, 0.000000, 0.500000, 1.000000, 7),
    /*4*/ FACE(0.500000, 1.000000, -0.500000, 1.000000, 1.000000, 4),
    /*5*/ FACE(0.500000, 0.000000, -0.500000, 0.000000, 0.000000, 7),
    /*6*/ FACE(-0.500000, 1.000000, -0.500000, 1.000000, 1.000000, 5),
    /*7*/ FACE(0.500000, 1.000000, -0.500000, 0.000000, 1.000000, 4),
    /*8*/ FACE(-0.500000, 0.000000, -0.500000, 1.000000, 0.000000, 4),
    /*9*/ FACE(0.500000, 0.000000, -0.500000, 0.000000, 0.000000, 7),
    /*10*/ FACE(-0.500000, 0.000000, 0.500000, 1.000000, 1.000000, 6),
    /*11*/ FACE(-0.500000, 0.000000, -0.500000, 0.000000, 1.000000, 4),
    /*12*/ FACE(0.500000, 0.000000, 0.500000, 1.000000, 0.000000, 3),
    /*13*/ FACE(0.500000, 1.000000, 0.500000, 1.000000, 1.000000, 6),
    /*14*/ FACE(-0.500000, 0.000000, 0.500000, 0.000000, 0.000000, 6),
    /*15*/ FACE(0.500000, 0.000000, 0.500000, 1.000000, 0.000000, 3),
    /*16*/ FACE(-0.500000, 1.000000, 0.500000, 0.000000, 1.000000, 4),
    /*17*/ FACE(0.000000, 1.000000, 0.500000, 0.500000, 1.000000, 5),
    /*18*/ FACE(0.500000, 1.000000, 0.000000, -0.500000, -1.000000, 7),
    /*19*/ FACE(0.000000, 1.000000, 0.500000, -1.000000, -0.500000, 5),
    /*20*/ FACE(0.500000, 1.000000, 0.500000, -1.000000, -1.000000, 6),
    /*21*/ FACE(0.500000, 1.000000, 0.000000, -0.292893, 1.000000, 7),
    /*22*/ FACE(0.250000, 2.000000, 0.250000, -0.646447, 2.000000, 6),
    /*23*/ FACE(0.000000, 1.000000, 0.500000, -1.000000, 1.000000, 5),
    /*24*/ FACE(0.500000, 2.000000, -0.500000, 1.168140, 2.007650, 5),
    /*25*/ FACE(0.250000, 2.000000, 0.250000, 0.377571, 2.007650, 6),
    /*26*/ FACE(0.500000, 1.000000, 0.000000, 0.693799, 0.995223, 7),
    /*27*/ FACE(0.500000, 3.000000, -0.500000, 0.790569, 3.000000, 3),
    /*28*/ FACE(0.250000, 2.000000, 0.250000, 0.000000, 2.000000, 6),
    /*29*/ FACE(0.500000, 2.000000, -0.500000, 0.790569, 2.000000, 5),
    /*30*/ FACE(0.500000, 3.000000, -0.500000, -0.646447, 2.224740, 3),
    /*31*/ FACE(-0.250000, 2.000000, -0.250000, -1.000000, 1.000000, 5),
    /*32*/ FACE(0.250000, 2.000000, 0.250000, -0.292893, 1.000000, 6),
    /*33*/ FACE(0.500000, 3.000000, -0.500000, -1.790570, 3.000000, 3),
    /*34*/ FACE(0.500000, 2.000000, -0.500000, -1.790570, 2.000000, 5),
    /*35*/ FACE(-0.250000, 2.000000, -0.250000, -1.000000, 2.000000, 5),
    /*36*/ FACE(0.500000, 2.000000, -0.500000, -0.746753, 2.015790, 5),
    /*37*/ FACE(0.000000, 1.000000, -0.500000, -0.272411, 1.003370, 6),
    /*38*/ FACE(-0.250000, 2.000000, -0.250000, 0.043816, 2.015790, 5),
    /*39*/ FACE(0.000000, 1.000000, -0.500000, 0.707107, 1.000000, 6),
    /*40*/ FACE(0.500000, 2.000000, -0.500000, 0.353553, 2.060660, 5),
    /*41*/ FACE(0.500000, 1.000000, 0.000000, 0.000000, 1.000000, 7),
    /*42*/ FACE(0.500000, 1.000000, 0.000000, 0.500000, -1.000000, 7),
    /*43*/ FACE(0.500000, 1.000000, -0.500000, 1.000000, -1.000000, 4),
    /*44*/ FACE(0.000000, 1.000000, -0.500000, 1.000000, -0.500000, 6),
    /*45*/ FACE(0.000000, 1.000000, -0.500000, 0.500000, 1.000000, 6),
    /*46*/ FACE(0.000000, 1.000000, -0.500000, 1.000000, 0.500000, 6),
    /*47*/ FACE(-0.500000, 1.000000, 0.000000, 0.500000, 1.000000, 8),
    /*48*/ FACE(-0.500000, 0.000000, -0.500000, 0.000000, 0.000000, 4),
    /*49*/ FACE(-0.500000, 1.000000, -0.500000, 0.000000, 1.000000, 5),
    /*50*/ FACE(-0.500000, 0.000000, 0.500000, 1.000000, 0.000000, 6),
    /*51*/ FACE(-0.500000, 1.000000, 0.500000, 1.000000, 1.000000, 4),
    /*52*/ FACE(0.000000, 1.000000, 0.500000, -1.000000, 0.500000, 5),
    /*53*/ FACE(-0.500000, 1.000000, 0.000000, -0.500000, 1.000000, 8),
    /*54*/ FACE(-0.500000, 1.000000, 0.500000, -1.000000, 1.000000, 4),
    /*55*/ FACE(0.250000, 2.000000, 0.250000, 0.353553, 1.885620, 6),
    /*56*/ FACE(-0.500000, 1.000000, 0.000000, -0.353553, 0.824958, 8),
    /*57*/ FACE(0.000000, 1.000000, 0.500000, 0.353553, 0.824958, 5),
    /*58*/ FACE(-0.250000, 2.000000, -0.250000, -0.353553, 1.885620, 5),
    /*59*/ FACE(0.000000, 1.000000, -0.500000, -1.707110, 1.000000, 6),
    /*60*/ FACE(-0.500000, 1.000000, 0.000000, -1.000000, 1.000000, 8),
    /*61*/ FACE(-0.250000, 2.000000, -0.250000, -1.353550, 2.000000, 5),
};

static const s16 index_list[] =
{
    22, /**/ 0, 1, 2, /**/ 17,3,4,1,2,6,8,10, /**/ 0,10,16,0,2,3,17, /**/ 8,10,1,0,
    26, /**/ 1, 0, 3, /**/ 10,2,10,0,3,16,17, /**/ 37,4,6,1,2,3,8,10, /**/ 16,17,22,0,1,4,24,37,
    24, /**/ 3, 0, 4, /**/ 2,1,17,0,4,22,24,37, /**/ 37,6,8,1,2,3,4,10, /**/ 24,37,6,0,3,
    22, /**/ 5, 6, 7, /**/ 47,8,10,1,2,3,4,6, /**/ 3,37,47,0,4,8, /**/ 1,3,37,0,6,
    22, /**/ 6, 5, 8, /**/ 3,4,37,0,8,47, /**/ 47,10,2,1,3,4,6,8, /**/ 37,47,10,0,6,
    23, /**/ 9, 10, 11, /**/ 1,2,1,3,4,6,8,10, /**/ 6,47,16,0,1,2,8, /**/ 4,6,47,0,10,
    22, /**/ 10, 9, 12, /**/ 6,8,47,0,1,2,16, /**/ 10,1,3,2,4,6,8,10, /**/ 16,1,0,10,
    21, /**/ 13, 14, 15, /**/ 47,16,17,0,2,3,10, /**/ 1,0,8,1,2,16,47, /**/ 3,0,10,1,
    22, /**/ 14, 13, 16, /**/ 0,2,0,1,8,16,47, /**/ 47,17,3,0,2,10,16, /**/ 8,47,17,1,10,
    21, /**/ 16, 13, 17, /**/ 2,10,47,1,17, /**/ 22,3,0,2,10,16,17, /**/ 10,47,22,1,3,16,
    24, /**/ 18, 19, 20, /**/ 47,22,24,0,1,4,17,37, /**/ 10,16,47,1,3,22, /**/ 4,0,2,3,10,16,17,
    24, /**/ 21, 22, 23, /**/ 27,24,37,0,1,4,17,22, /**/ 16,47,31,3,17,24,27, /**/ 0,1,16,3,22,47,
    24, /**/ 24, 25, 26, /**/ 31,27,31,3,22,37, /**/ 1,17,47,3,24,27,31, /**/ 31,37,4,0,1,17,22,24,
    20, /**/ 27, 28, 29, /**/ 47,31,24,22, /**/ 37,3,17,24,27,31,47, /**/ 22,31,37,3,22,27,
    20, /**/ 30, 31, 32, /**/ 37,24,22,31, /**/ 17,47,37,22,24,27, /**/ 31,24,3,17,27,31,47,
    19, /**/ 33, 34, 35, /**/ 3,22,31,24, /**/ 47,37,3,22,27,31, /**/ 24,22,47,24,27,37,
    22, /**/ 36, 37, 38, /**/ 4,3,22,27,31,37, /**/ 22,47,6,3,4,24,31, /**/ 22,27,22,24,37,47,
    24, /**/ 39, 40, 41, /**/ 27,31,47,3,4,6,24, /**/ 17,22,27,3,31,37, /**/ 6,4,0,1,17,22,24,37,
    23, /**/ 42, 43, 44, /**/ 6,0,1,4,17,22,24,37, /**/ 47,6,0,3,37, /**/ 22,24,31,3,4,6,47,
    21, /**/ 7, 6, 45, /**/ 8,0,3,6,37, /**/ 31,47,8,0,4,37, /**/ 0,3,24,4,6,31,47,
    25, /**/ 46, 6, 47, /**/ 0,4,3,6,24,31,47, /**/ 10,8,0,4,37,47, /**/ 24,31,22,6,8,10,16,17,37,
    23, /**/ 48, 47, 49, /**/ 16,10,0,6,47, /**/ 4,37,31,6,8,10,16,17,22, /**/ 10,0,4,8,37,47,
    24, /**/ 50, 47, 48, /**/ 17,16,1,0,2,8,47, /**/ 0,6,37,8,10,16,17,22,31, /**/ 2,0,6,10,47,
    24, /**/ 47, 50, 51, /**/ 0,8,6,10,16,17,22,31,37, /**/ 17,1,2,0,8,16,47, /**/ 22,17,1,10,47,
    23, /**/ 52, 53, 54, /**/ 31,22,3,1,16,47, /**/ 1,10,8,6,16,17,22,31,37, /**/ 3,1,10,17,47,
    25, /**/ 55, 56, 57, /**/ 37,31,27,3,17,24,47, /**/ 1,16,10,6,8,17,22,31,37, /**/ 24,3,1,16,22,47,
    25, /**/ 56, 55, 58, /**/ 3,17,16,6,8,10,22,31,37, /**/ 24,27,24,3,17,31,47, /**/ 6,37,24,22,27,47,
    25, /**/ 59, 60, 61, /**/ 8,6,4,3,24,31,47, /**/ 27,22,17,6,8,10,16,31,37, /**/ 3,24,27,22,37,47,
};

Does anyone know how I can use this on another model?
 

YugamiSekai

Mr. Picross
OP
Member
Joined
Dec 24, 2014
Messages
2,015
Trophies
1
Age
21
XP
2,275
Country
United States
Unlikely, at first guess this seems hardcoded to me, or if a tool was used to generate it, it's not publicly available (I could be wrong, maybe smea or the designer of the examples has such a thing lying around somewhere)

If you want to use another model with this kind of format, you'll want to figure out what the FACE( ... ) macro means, and how to parse an OBJ file to match this format (OBJ parsing tutorials are common online) and write a similar parser yourself. Or, what is probably better off for you to do, is figure out how the example utilizes that data, so you could create an entirely different format and parser.
The face macro is defined in the main source file.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    NinStar @ NinStar: It will actually make it worse