Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Loading .asc model problems and general 3D formats

Author
Message
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 21st Feb 2005 05:26 Edited at: 21st Feb 2005 05:27
I'm working on writting a model saver/loader for .asc models natively in DarkBasic, but I can't seem to get my head around this part.

(This is the part that troubles me most, finding out the face values)


I'm currently using DymitryK's DKshop plug-in(freeware). It has the ability to return vertex positions, but I can't figure out how to return the face positions from this face list.


Here's an example working .asc file of a plane.
Quote: "Ambient light color: Red=0.3 Green=0.3 Blue=0.3

Named object: "Plane"
Tri-mesh, Vertices: 4 Faces: 4
Vertex list:
Vertex 0: X:-1.000000 Y:-1.000000 Z:0.000000
Vertex 1: X:-1.000000 Y:1.000000 Z:0.000000
Vertex 2: X:1.000000 Y:-1.000000 Z:0.000000
Vertex 3: X:1.000000 Y:1.000000 Z:0.000000
Face list:
Face 0: A:3 B:1 C:0 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1
Face 1: A:3 B:0 C:2 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1
Face 2: A:1 B:3 C:2 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1
Face 3: A:1 B:2 C:0 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1"


Here's my attempt at generating that same .asc model.
Note: I've highlighted parts that differ or are missing from the top to this one.
Quote: "Ambient light color: Red=0.3 Green=0.3 Blue=0.3

Named object: "Default"
Tri-mesh, Vertices: 4 Faces: 4
Vertex list:
Vertex 0: X:-1.000000 Y:0.000000 Z:1.000000
Vertex 1: X:-1.000000 Y:0.000000 Z:1.000000
Vertex 2: X:1.000000 Y:0.000000 Z:1.000000
Vertex 3: X:1.000000 Y:0.000000 Z:1.000000
Face list:
Face 0: A:0 B:0 C:0 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1
Face 1: A:0 B:0 C:0 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1
Face 2: A:0 B:0 C:0 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1
Face 3: A:0 B:0 C:0 AB:1 BC:1 CA:1
Material:"r255g255b255a0"
Smoothing: 1"


I'm so close, any help would be truly appreciated. Once I get this done, I'll be that much closer to getting a .cob -> .dbo convertor done for us TS fans.

----------------------------------------------
Also, on a sidenote, does anyone know how to write quotes to a string? " "" " <- this doesn't seem to work.
So

write string 1,""Plane"" would appear as "Plane" in the file?
----------------------------------------------
Another sidenote

Can anyone link me to some more tutorials on model loading, or tutorials on finding face normals? What are the simplest 3D formats around?

http://astronomy.swin.edu.au/~pbourke/geomformats/
http://www.wotsit.org/search.asp?s=3d
----------------------------------------------
Again thanks for any help.





A book? I hate book. Book is stupid.
(Formerly known as Yellow)
MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 21st Feb 2005 06:01 Edited at: 21st Feb 2005 06:06
Okay, good news and bad news already.

Until I can figure out how to add quotes("") to a string, you have to manually add them. By luck, a cube was saved as a .asc model, yet then loaded into Truespace invisibly. So .asc files can be saved in DBP, yet not read properly.

I'll keep you updated.



[EDIT] Another problem has just occured in that my opened saved file is appearing in aphabetical(A-Z 1-infite) order. This is causing problems because the vertices need to be read in order, rather than by there position in the alphabet.

What a mess!

A book? I hate book. Book is stupid.
(Formerly known as Yellow)
Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 21st Feb 2005 06:20
A$=A$+chr$(34) will add a quote to a$


MikeS
Retired Moderator
22
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 21st Feb 2005 06:38
Ahh, thanks so much. Completely forgot about that command in all the madness.

Objects can now load into 3D applications every time. Too bad they're still invisible for some odd reason.



A book? I hate book. Book is stupid.
(Formerly known as Yellow)

Login to post a reply

Server time is: 2025-06-08 04:05:00
Your offset time is: 2025-06-08 04:05:00