Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/old.john/src/3dUnit.cc @ 3412

Last change on this file since 3412 was 2035, checked in by john, 21 years ago

Diese Dateien werden für das Importieren von 3ds Modellen gebraucht.
3ds importiert die Daten.
3dUnit enthält die Daten.
3dsStructs definiert einige 3d Variablen

File size: 1.6 KB
Line 
1#include "3dUnit.h"
2/* Provides function for loading a 3ds file */
3#include "3ds.h"
4/* Model structures that are needed to load in a .3DS file. */
5#include "3dStructs.h"
6
7/*########################### Showroom.cpp ###########################
8# This class generates a unit, and provides functions to load and display
9# the corresponding 3ds file.
10# $Author: Johannes Bader
11# $Revision: 1.0
12# $Date: 5.5.04
13###################################################################### */
14
15C3dUnit::C3dUnit( char* name )
16{
17    /* Creates a new 3d Object of type "name"
18       "name" must have at most 8 characters */
19   
20    if( strlen( name ) <= 8 ) {
21        strcpy( sName, name );       
22    }
23    else {
24        printf( "Name to long, >= 8 characters: %s!", name );
25        strcpy( sName, "noname" );
26    }
27    Init();
28}
29
30C3dUnit::C3dUnit( void )
31{
32    /* No name specified */
33    strcpy( sName, "test.3ds" );
34    Init();
35}
36
37void C3dUnit::Init( void )
38{
39   b3dModelLoaded = false;
40}
41
42void C3dUnit::Import3ds( void )
43{
44   /* Class to load the *.3ds file */
45   CLoad3ds g_Load3ds;
46   /* Loads the file "name" and stores the data in CModel */
47   b3dModelLoaded = g_Load3ds.Import3DS( &CModel, sName );
48}
49
50void C3dUnit::Draw( int mode )
51{
52   /* Draws the Model. If none has been loaded, print an error */
53   if( b3dModelLoaded ) CModel.Draw( mode );
54   else printf( "No Model for Unit %s loaded!", sName );   
55}
56
57void C3dUnit::PrintProperties( void )
58{
59   /* This function displays the Properties of the Model */
60   if( b3dModelLoaded )
61      CModel.PrintProperties();
62   else printf( "No Model for Unit %s loaded!", sName );
63}
64
Note: See TracBrowser for help on using the repository browser.