Starting an irrlicht .3dt import node

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Lprd2007
Posts: 15
Joined: Sun Aug 24, 2008 3:03 pm

Starting an irrlicht .3dt import node

Post by Lprd2007 »

Hi, in a previous post (http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=30267) I wrote that I'm developing a level editor with the source of the Genesis 3D editor, GEDIT, keeping the interface, but change the GEDIT engine to irrlicht and add a BSP exporter. Some users said me that is better importing 3DT files to irrlicht than adding a BSP exporter. I think that's right, so now I'm searching a source code to open 3DT files. I've searched in google and I found this 3DT unofficial spec:

Code: Select all

Genesis3D 3DT File Format, version 1.32:
This spec was produced by examining the code of GEdit and Genesis3D engine,
  and a sample 3DT file output by GEdit.
Each line is of format: KeyName Values
  Example: Vec3d -1296.000000 -415.999756 967.999756
But some have multiple KeyNames in a single line
  Example: TexInfo Rotate 0 Shift 0 0 Scale 1.000000 1.000000 Name "bkrock"
Lines tend to have various whitespace at the beginning.
All parentheses here are annotation, not in the actual format.
Brackets indicate substitutions.
Tokens are separated by whitespace.
N = decimal integer
F = float
S = string
X = hex integer
B = boolean (zero or nonzero)

[Header]
[Brushlist]
[Entities]
[Models]
[Groups]
[Sky]
[Settings]

///////////////////////////////////////////////////////////
Header:
 3dtVersion N.N (major.minor)
 TextureLib S (filename)
 NumEntities N
 NumModels N
 NumGroups N
 
///////////////////////////////////////////////////////////
Brushlist:
 Brushlist N (number of brushes)
 [N Brush entries]
 
Brush:
 Brush S (texture name or brush name)
 Flags N (bitflags integer, in decimal form)
 ModelId N
 GroupId N
 HullSize F
 Type N (enum for brush type, 1 = multi, 2 = leaf, 4 = csg)
 [either [Brushlist] if Type was multi, or [Facelist] if Type was leaf]

Facelist:
 BrushFaces N (number of faces)
 [N Face entries]
 
Face:
 NumPoints N
 Flags N (another bitfield in decimal form)
 Light N
 MipMapBias F
 Translucency F
 Reflectivity F
 [N (from NumPoints) Vec3d entries]
 TexInfo Rotate N Shift N N Scale F F Name S
      (rotation in degrees, value pairs are X,Y or U,V)
 LightScale F F (X,Y)
 [Transform]
 Pos F F F (X,Y,Z)
 
Vec3d:
 Vec3d F F F (X,Y,Z)
 
Transform:
 Transform F F F F F F F F F F F F
      (that's 12 F's, making AX AY AZ BX BY BZ CX CY CZ TX TY TZ)

///////////////////////////////////////////////////////////
Entities:
 Class CEntList
 EntCount N
 CurEnt N
 [N (from EntCount) Entity entries]
 
Entity:
 CEntity
 eStyle N (0 = point entity, 1 = brush entity)
 eOrigin F F F N (X,Y,Z,trash)
 eFlags N
 eGroup N
 ePairCount N
 [N Key entries]
 End CEntity
 
Key:
 Key S Value S (first S is key name, second S is full value in text form)
      (example: Key Origin Value "128 -1272 804")

///////////////////////////////////////////////////////////
Models:
 [N (from header NumModels) Model entries]
 
Model:
 Model S (name of model)
 ModelId N
 CurrentKeyTime F
 [Transform]
 Motion B
 [Motion]
 
Motion:
 MOTN X.X (should be 0.F0)
 NameID
 MaintainNames B
 PathCount N
 NameChecksum N
 Events B
 [if N != 0, Events entry]
 NameArray B
 [if N != 0, StrBlock entry]
 PathArray B
 [N Path entries]
 
Events: (this wasn't in the sample file, so it might be wrong)
 TKEV X.X (0.F0 again)
 DataSize N
 TimeKeys N
 [N copies of the next 2 lines]
 F N  (Time, ?)
 S  (some event string)

StrBlock:
 SBLK X.X (0.F0 again)
 Strings N
 [N lines of string data]
 
Path:
 PATH X.X (0.F2, earlier versions are different)
 Rotation N N (flag, interpolation type)
 [if flag != 0, QKFrame entry]
 Translation N N (flag, interpolation type)
 [if flag != 0, VKFrame entry]
 
QKFrame:
 Keys N N N B (NumElements, InterpolationType, Compression, Looping)
      (enum QK_InterpolationType: LINEAR = 0, SLERP = 1, SQUAD = 2)
 [if Compression != 0, compression info here]
 [N (NumElements) QKFrameElement entries]
 
QKFrameElement: (this is different if Compression != 0)
 F F F F F  (time, W, X, Y, Z)
 
VKFrame:
 Keys N N N B (just like QKFrame)
      (enum VK_InterpolationType: LINEAR = 0, HERMITE = 1, HERMITE_ZERO_DERIV = 2)
 [if Compression != 0, compression info here]
 [N (NumElements) VKFrameElement entries]
 
VKFrameElement: (this is different if Compression != 0)
 F F F F  (time, X, Y, Z)
 
///////////////////////////////////////////////////////////
Groups:
 [N (from header NumGroups) Group entries]

Group:
 Group S (name)
 GroupId N
 Visible B
 Locked B
 Color F F F (R, G, B)

///////////////////////////////////////////////////////////
Sky:
 Sky
 [6 times of the following 1 line]
 B S (Apply, texname)
 Axis F F F (normalized rotation axis)
 Speed F (rotation speed)
 Scale F (texture scale)

///////////////////////////////////////////////////////////
Settings: (this is mostly useless outside of GEdit)
 [CompileInfo]
 ShowGroups B
 [ViewSettings]
 [GridInfo]
 BspRebuild N
 [ViewInfo]
 [BrushTemplates]
 TemplatePos F F F (X,Y,Z)
 DrawScale F
 LightmapScale F
Also I found the source of the MilkShape3D 3DT exporter: http://www.genesis3d.com/~wog/tools/ms3 ... terSrc.rar
And some .3dt files: http://www.comunidad-e3d.com/descargas/ ... jetsWK.zip
Thanks for your answers!
Last edited by Lprd2007 on Wed Sep 10, 2008 11:11 pm, edited 1 time in total.
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Could you please also upload an example file? A first basic version (i.e. the basic geometry and some material properties) can be set up with a few hours work. Animations are usually harder, and of course the pecularities of the various formats :wink:
Lprd2007
Posts: 15
Joined: Sun Aug 24, 2008 3:03 pm

Post by Lprd2007 »

Here is a zip file that contains some little .3dt files in the folder '3dt':
http://www.comunidad-e3d.com/descargas/ ... jetsWK.zip
hybrid
Admin
Posts: 14144
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Sorry, but the format lacks most of the important things you'd use to create proper geometry for a 3d rendering. There are no normals, texcoords, colors, ... stored in the format. You'd either need some really good knowledge about the original tool which creates the files (and mimic its algorithms) or try to use a better format.
Post Reply