background preloader

3dfile loader

Facebook Twitter

Tutorials:3d Engine - Spacesimulator.net. Author: Damiano Vitulli First, it's necessary to explain the basic concept... what is a 3d engine?

Tutorials:3d Engine - Spacesimulator.net

The answer is relatively simple: A 3d engine is a whole of structures, functions and algorithms used to visualize, after many calculations and transformations, 3d objects on a 2d screen. The main sections of a 3d engine are: The acquisition of the objects' data in structures.The transformations to position the objects in the world.Rendering the scene on the 2d screen. This is why we are here so... let's go to work! In this lesson, we will study how to define the main structures needed to draw a 3d object. Suppose you have an object and want to show it on a 2d screen.

First, we define some key points: the vertices of the object. To define a vertex in C, we use a structure composed of three variables x, y, z. typedef struct { float x,y,z; } vertex_type; The polygons are the faces of the object and are composed from N vertices. Typedef struct { vertex_type a,b,c; } polygon_type; But... look out! Tutorials:3ds Loader - Spacesimulator.net. Author: Damiano Vitulli It's now time to say goodbye to our dear cube!

Tutorials:3ds Loader - Spacesimulator.net

In this lesson we will develop a routine to load 3ds objects, a very popular file format on the internet and supported by various 3d modelers. A 3d modeler allows you to create any type of object in a more intuitive and human way rather than to define by hand the coordinates of the vertices, which can become an impossible task even for simple objects just slightly more complicated than a cube. Actually, I am very reluctant to throw away the cube, such a simple and perfect figure.

However, until proven otherwise, spaceships, planets, missiles and anything that has to do with a space simulator seems to be completely different from the cube. Before starting to write the code it will be necessary to analyze the 3ds file structure. A 3ds file contains a series of information used to describe every detail of a 3d scene composed of one or more objects. These chunks don't have a linear structure.

We have found the MAIN CHUNK! Assimp: Installation. If you develop at Visual Studio 2005, 2008 or 2010, you can simply use the pre-built linker libraries provided in the distribution.

Assimp: Installation

Extract all files to a place of your choice. A directory called "assimp" will be created there. Add the assimp/include path to your include paths (Menu->Extras->Options->Projects and Solutions->VC++ Directories->Include files) and the assimp/lib/<Compiler> path to your linker paths (Menu->Extras->Options->Projects and Solutions->VC++ Directories->Library files). This is neccessary only once to setup all paths inside you IDE. To use the library in your C++ project you have to include either <assimp/Importer.hpp> or <assimp/cimport.h> plus some others starting with <types.h>.

Please don't forget to also read the Microsoft Compilers and the C++ Standard Library section on MSVC and the STL. In VC8 Microsoft introduced some Standard Library debugging features. If you're linking statically against assimp: Make sure your applications uses the same STl settings! Assimp: assimp - Open Asset Import Library. Assimp is a library to load and process geometric scenes from various data formats.

Assimp: assimp - Open Asset Import Library

It is tailored at typical game scenarios by supporting a node hierarchy, static or skinned meshes, materials, bone animations and potential texture data. The library is not designed for speed, it is primarily useful for importing assets from various sources once and storing it in a engine-specific format for easy and fast every-day-loading. assimp is also able to apply various post processing steps to the imported data such as conversion to indexed meshes, calculation of normals or tangents/bitangents or conversion from right-handed to left-handed coordinate systems. assimp currently supports the following file formats (note that some loaders lack some features of their formats because some file formats contain data not supported by assimp, some stuff would require so much conversion work that it has not been implemented yet and some (most ...) formats lack proper specifications):

Open Asset Import Library : Documentation & FAQ.