#include "3dUnit.h" /* Provides function for loading a 3ds file */ #include "3ds.h" /* Model structures that are needed to load in a .3DS file. */ #include "3dStructs.h" /*########################### Showroom.cpp ########################### # This class generates a unit, and provides functions to load and display # the corresponding 3ds file. # $Author: Johannes Bader # $Revision: 1.0 # $Date: 5.5.04 ###################################################################### */ C3dUnit::C3dUnit( char* name ) { /* Creates a new 3d Object of type "name" "name" must have at most 8 characters */ if( strlen( name ) <= 8 ) { strcpy( sName, name ); } else { printf( "Name to long, >= 8 characters: %s!", name ); strcpy( sName, "noname" ); } Init(); } C3dUnit::C3dUnit( void ) { /* No name specified */ strcpy( sName, "test.3ds" ); Init(); } void C3dUnit::Init( void ) { b3dModelLoaded = false; } void C3dUnit::Import3ds( void ) { /* Class to load the *.3ds file */ CLoad3ds g_Load3ds; /* Loads the file "name" and stores the data in CModel */ b3dModelLoaded = g_Load3ds.Import3DS( &CModel, sName ); } void C3dUnit::Draw( int mode ) { /* Draws the Model. If none has been loaded, print an error */ if( b3dModelLoaded ) CModel.Draw( mode ); else printf( "No Model for Unit %s loaded!", sName ); } void C3dUnit::PrintProperties( void ) { /* This function displays the Properties of the Model */ if( b3dModelLoaded ) CModel.PrintProperties(); else printf( "No Model for Unit %s loaded!", sName ); }