reports error at the first line, could someone help with make these macros working?

macros with a testfile
Attachments:
Posted on 2006-08-21 09:24:11 by daydreamer
here is a working solution to include wavefront .obj
could someone explain how I make use of those index numbers to recreate object into vertices for hardware rendering, obviously coordinates are reused somehow
;grid.inc (renamed from grid.obj)
v struct DWORD
        x      FLOAT ?
        y      FLOAT ?
        z      FLOAT ?
        v ENDS
vt struct DWORD
        u FLOAT ?
        v FLOAT ?
        ENDS
f struct DWORD
        i1  DWORD ?
        i2  DWORD ?
        i3  DWORD ?
        i4  DWORD ?
        f ENDS

.data

vgrid v <-5.64316f,13.0555f,0.0f>
v <5.23553,13.0555,0.0>
v <-5.64316,3.76406,0.0>
v <5.23553,3.76406,0.0>
v <-0.203816,13.0555,0.0>
v <-5.64316,8.40977,0.0>
v <5.23553,8.40977,0.0>
v <-0.203816,3.76406,0.0>
v <-0.203816,8.40977,0.0>
v <-2.92349,13.0555,0.0>
v <-5.64316,10.7326,0.0>
v <2.51586,13.0555,0.0>
v <5.23553,10.7326,0.0>
v <-5.64316,6.08692,0.0>
v <-2.92349,3.76406,0.0>
v <5.23553,6.08692,0.0>
v <2.51586,3.76406,0.0>
v <-0.203816,10.7326,0>
v <-2.92349,8.40977,0>
v <2.51586,8.40977,0>
v <-0.203816,6.08692,0.0>
v <-2.92349,6.08692,0.0>
v <2.51586,6.08692,0.0>
v <2.51586,10.7326,0.0>
v <-2.92349,10.7326,0.0>
;usemtl mat-1
vgindex f <8, 21, 22, 15>
f <9, 19, 22, 21>
f <6, 14, 22, 19>
f <3, 15, 22, 14>
f <7, 20, 23, 16>
f <9, 21, 23, 20>
f <8, 17, 23, 21>
f <4, 16, 23, 17>
f <5, 18, 24, 12>
f <9, 20, 24, 18>
f <7, 13, 24, 20>
f <2, 12, 24, 13>
f <6, 19, 25, 11>
f <9, 18, 25, 19>
f <5, 10, 25, 18>
f <1, 11, 25, 10>
Posted on 2006-08-24 11:52:51 by daydreamer
I don't know about coping with D3D/OGL, but you should note that when you have UV coords, you'll be getting interesting "f" declarations:

usemtl Default
vt 0.338028 0.480000
vt 0.000000 0.740000
vt 0.000000 0.480000
f 1/-1 65/-2 63/-3
vt 0.338028 0.480000
vt 0.676056 0.480000
vt 0.338028 0.740000
f 64/-1 2/-2 63/-3

the negative numbers mean  UVcoordIndex =
Posted on 2006-08-24 12:42:12 by Ultrano

I don't know about coping with D3D/OGL, but you should note that when you have UV coords, you'll be getting interesting "f" declarations:

usemtl Default
vt 0.338028 0.480000
vt 0.000000 0.740000
vt 0.000000 0.480000
f 1/-1 65/-2 63/-3
vt 0.338028 0.480000
vt 0.676056 0.480000
vt 0.338028 0.740000
f 64/-1 2/-2 63/-3

the negative numbers mean?  ? UVcoordIndex =


thanks, looks like assumed texture is repeatedly tiled
also need to include info in corresponding .mtl file, which holds all filenames for textures
so if I multiply f-numbers with 12, I get the right indirection to 4 coordinates for each quad?so I should use trianglelist or trianglestrip?

Posted on 2006-08-24 21:49:22 by daydreamer
If D3D handles vertex-indices premultiplied by 12, yes - but I doubt it. You'll have to use "custom FVF".

Trianglelists should be used, and do not merge vertices. 3D designers like taking triangles out of the solid mesh, to set unique UV coords to vertices, because otherwise the skinning is awful/impossible in many cases. For instance, I have made no 3D model, where all vertices with same x:y:z coords have same u:v. But vertex-merging can be done if you compare both x:y:z and u:v for vertices.
Posted on 2006-08-24 22:13:57 by Ultrano
I posted code on this board (twice now) for importing OBJ which optimizes the vertex data to remove duplicate vertices (renumber indices) and so on.
It always pays to search the board first :)
Posted on 2006-08-25 01:18:57 by Homer

I posted code on this board (twice now) for importing OBJ which optimizes the vertex data to remove duplicate vertices (renumber indices) and so on.
It always pays to search the board first :)


thanks, lot easier to search when keyword is "homer" than search on "obj", you end up with all kinds of objasm and linker problems
but dead link to Ultrano.com
also been busy sketching some "trianglefan-art"
Posted on 2006-08-27 17:23:20 by daydreamer