Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » importing 3d

This thread is locked; no one can reply to it. rss feed Print
importing 3d
flosy1234
Member #8,862
July 2007

I understand that allefro.cc has thae abilety to suport 3d games but does aneone know if you can inport 3d object files sutch as .3ds files and so on I couldent find any info on it sorry if this is a stupid question.

Albin Engström
Member #8,110
December 2006
avatar

It's not really a stupid question, but it's horribly written(since you want to program maybe you should try to write properly or at least try(like I'm doing ^^)).

And loading "3d objects" is all about knowing or be able to handle the file format. and i know i shouldn't answer this question since i don't really have much of a clue but no, there is no function within allegro that allows you to import 3ds files. Find out how to make such an function or use an already written one.

One more thing, if you're into 3d, pure allegro is not what you want.
Try out AllegroGL. :)

Paul whoknows
Member #5,081
September 2004
avatar

Quote:

I understand that allefro.cc has thablablablablabla

Allefro, the perfect name for the allegro mascot!

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

gnolam
Member #2,030
March 2002
avatar

Quote:

Allefro, the perfect name for the allegro mascot!


allefro.png ?

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

kronoman
Member #2,911
November 2002
avatar

to load a 3D model you will need to
a) find already done code to load it (i.e a engine such as Ogre provides this)
b) code yourself the loader, I have found that .obj files are the easier to load (for me)

Allegro does not provide model loading functionality.

Elverion
Member #6,239
September 2005
avatar

But obj provides no animation, correct? Which means you'd need a separate obj file for each frame of the animation, which would waste a lot of space and resources.

--
SolarStrike Software - MicroMacro home - Automation software.

Paul whoknows
Member #5,081
September 2004
avatar

Quote:

But obj provides no animation, correct? Which means you'd need a separate obj file for each frame of the animation, which would waste a lot of space and resources.

I think things don't work like that. I know nothing about 3d game programming, but I can imagine that the animation is done moving the object's vertices/vertexes using keyframes to interpolate them. I could be mistaken of course.

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

GullRaDriel
Member #3,861
September 2003
avatar

Way off-topic, but gnolam's post have just made my day ! :D

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

monkeyCode
Member #7,140
April 2006

MD2 is nice and simple, no bones :D

LennyLen
Member #5,313
December 2004
avatar

Quote:

since you want to program maybe you should try to write properly or at least try(like I'm doing ^^)

Maybe if you try a little harder, you'll hit the shift key every time you press the "I" key. :P

GameCreator
Member #2,541
July 2002
avatar

Quote:

find already done code to load it (i.e a engine such as Ogre provides this)

I would highly suggest Irrlicht

Matt Smith
Member #783
November 2000

The reason that there are no Allegro-specific importers is because Allegro does not have internal data representations for meshes. It is too low-level for that. Any importer needs to be customised to the in-memory format.

I have my own internal format, and code to render this to both Allegro software 3d and OpenGL, but it isn't flexible enough (yet) to be considered a universal solution. For example, at the moment I use arrays of V3D_f to store vertices, which were designed for Allegro's old (and nearly deprecated) 3d routines, and contain c,u&v values for each vertex. This is not ideal for most models, which have the u,v values stored for each vertex in a face, not once for each vertex in the mesh.

My plan is to expand my current MESH types from the following

typedef struct MESH_TYPE {
   int flags;
   int n_verts;  VERTEX_TYPE * verts;
   int n_edges;  EDGE_TYPE * edges;
   int n_tris;  FACE_TYPE * tris;
  
} MESH_TYPE;

and replace them with a universal type

typedef struct MESH_TYPE {
   int flags;
   MESH_VTABLE * vtable;   
   int n_verts;  void * verts;
   int n_edges;  void * edges;
   int n_faces;  void * faces;
  
} MESH_TYPE;

which can be used as the in-memory format for nearly all uses. If this catches on, it could make it possible to develop universal importers, that do not tie you to external engines like Ogre, irrlicht, etc.

Jonny Cook
Member #4,055
November 2003

Quote:

Maybe if you try a little harder, you'll hit the shift key every time you press the "I" key. :P

That doesn't seem rIght...

The face of a child can say it all, especially the mouth part of the face.

Albin Engström
Member #8,110
December 2006
avatar

LennyLen said:

Maybe if you try a little harder, you'll hit the shift key every time you press the "I" key. :P

I don't get it... ??? :P

gnolam
Member #2,030
March 2002
avatar

Quote:

And loading "3d objects" is all about knowing or be able to handle the file format. and i know i shouldn't answer this question since i don't really have much of a clue but no, there is no function within allegro that allows you to import 3ds files.

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Albin Engström
Member #8,110
December 2006
avatar

ah...

Archon
Member #4,195
January 2004
avatar

Quote:

I understand that allefro.cc has thae abilety to suport 3d games

Allegro itself? Don't use its current 3D routines. Use AllegroGL instead.

Quote:

does aneone know if you can inport 3d object files sutch as .3ds files and so on

You can inport simply by loading a file with the stdio library, then read the metadata, then read the vertex/normal/texture information and store it in memory for OpenGL to use.

Go to: