![]() |
#11 |
Member
Expert member
Join Date: Nov 2010
Posts: 71
|
![]()
If you refer to my original post...
The .mqo format is the CLOSEST format I have seen in terms of the data I need in the layout that I need it. The vertices (and their coordinates) are grouped and listed in exact order. The face data is clear, simple and concise and easy to "navigate" with a VBA script for importing the values with excel... but what I REALLY need is the M value for each face M(0), M(1), M(2), etc, as it is a NUMERIC, ordered reference to which texture bmp is mapped to each face. Last edited by Tomkat; 24th January 2022 at 10:56 PM. |
![]() |
![]() |
![]() |
#12 | |
Member
Expert member
Join Date: Nov 2010
Posts: 71
|
![]()
Here's an .mqo file for a fairly simple 3d item.
It tells me EVERYTHING I need to know to create .3di file format... Quote:
M(0) = CFtop0.bmp M(1) = CFbtm0.bmp etc The "Vertex" section also gives me a nice list of each (which I can easily number in Excel), and its X,Y,Z The "Face" section also gives me a nice, ordered list (which I can number in Excel) and it also tells me... How may vertices make up the face (3) WHICH vertices make up each face (7 6 5) etc The material/bitmap INDEX number M(0), M(1) etc The UV coordinates for each face Last edited by Tomkat; 24th January 2022 at 10:06 PM. |
|
![]() |
![]() |
![]() |
#13 |
Member
Expert member
Join Date: Nov 2010
Posts: 71
|
![]()
I want go into exhaustive detail here but...
The first thing I have to do is convert/transpose vertex values (because 3di doesn't use the exact same coordinate reference - vertical is "Y" in AC3d, mqo, etc, but it's "Z" in 3di file format) ![]() The red block of values at the end is everything converted to hex values that I need to copy/paste/build the file. Luckily, the .mqo Face values are pretty straightforward to import ![]() BUT... I have to do a LOT of excel calculations to calculate OTHER values that I need for each face, such as the values of the normals, among other things. This is just Face 0. I have a separate tab/sheet for EACH face. ![]() Again, I have to convert everything to hex values to use them. So... since you asked and said you were "interested" - there you have it. ![]() What you are looking at, is just a small snippet of YEARS of work to finally create a (clunky) method for converting the values I need. |
![]() |
![]() |
![]() |
#14 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,537
|
![]()
Wow! Most impressive. I think an AC3D plugin that exports the format you want would probably be less complicated.
Here is the main code for a simple exporter.It would be easy to transform coordinates, add texture info, etc. Code:
static void sv_output_triangle(FILE *f, List *vertices, Surface *s) { SVertex *p1, *p2, *p3; int col; int id1, id2, id3; // get SVertexes for this triangle // SVertex contains vertex pointer, texture cordinates and the normal p1 = (SVertex *)(s->vertlist->data); p2 = (SVertex *)(s->vertlist->next->data); p3 = (SVertex *)(s->vertlist->next->next->data); // get int positions of each vertex within the main object list id1 = list_index(vertices, p1->v); id2 = list_index(vertices, p2->v); id3 = list_index(vertices, p3->v); fprintf(f, "%d %d %d ", id1, id2, id3); sv_output_col(f, s->col); } static void sv_output_surfaces(FILE *f, List *vertices, List *triangs) { /** go through the triangle list and output each **/ for (List *p = triangs; p != NULL; p = p->next) { Surface *s = (Surface *)p->data; sv_output_triangle(f, vertices, s); } } static void sv_output_object(FILE *f, ACObject *ob) { int numvert, numsurf, numkids; List *vertices, *surfaces, *kids; List *p; printf("outputing %s\n", ac_object_get_name(ob)); ac_object_get_contents(ob, &numvert, &numsurf, &numkids, &vertices, &surfaces, &kids); // we are only interested in triangles, so we a list of triangulated surfaces List *triangs = ac_object_get_triangle_surfaces(ob); // get list of triangles (ignores lines/polyline surfaces) int numtri = list_count(triangs); if (numtri > 0) { fprintf(f, "%d\n", numvert); // output number of vertices for (p = vertices; p != NULL; p = p->next) // output each vertex { Vertex *v = (Vertex *)p->data; fprintf(f, "%f %f %f\n", v->x, v->y, v->z); } fprintf(f, "%d\n", numtri); /** output the number of triangles **/ sv_output_surfaces(f, vertices, triangs); // output number of surfaces and each surface } ac_surfacelist_free(&triangs); // important - free the surfaces (and list) created from ac_object_get_triangle_surfaces for (p = kids; p != NULL; p = p->next) // output any children objects sv_output_object(f, (ACObject *)p->data); } |
![]() |
![]() |
![]() |
#15 |
Member
Expert member
Join Date: Nov 2010
Posts: 71
|
![]()
Thank you very much! I will play around with that code when I get home!
Last edited by Tomkat; 25th January 2022 at 09:37 AM. |
![]() |
![]() |
![]() |
#16 |
Member
Expert member
Join Date: Nov 2010
Posts: 71
|
![]()
Forgive me but... can you point me in the right direction?
Do I save this as a .pcl file, and put it in the plugins directory? Or, is this a different type of code? |
![]() |
![]() |
![]() |
#17 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,537
|
![]()
Sorry, it's a bit more complicated. It's C code and not a complete plugin. You need to know how to compile it.
I can send you the full plugin code and the SDK if you send me an email. |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|