to initialize in main() requires ISceneManager and IVideoDriver objects:
Code: Select all
skyBox SB(smgr, driver, "/pathtoSkyboxes/", "desert3");
function call:
Code: Select all
SB.start();
Code: Select all
class skyBox{
private:
ISceneManager* sc; //scene
IVideoDriver* dr; //driver
char* name; //skybox name
char path[50];
public:
//constructor
skyBox( ISceneManager* s, IVideoDriver* d, char p[50], char* n )
{
sc=s;
dr=d;
name=n;
strcpy(path,p); //path to all skyBox textures
/* skyboxes should all be named in the format *up.bmp, *dn.bmp,
*rt.bmp, *lt.bmp, *ft.bmp, *bk.bmp where * is all the same name
ie blue2
*/
}
void start(){ //create skybox
dr->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
char fileup[50]="";
strcat ( fileup, path );
strcat ( fileup, name );
strcat ( fileup, "up.bmp" );
char filedn[50]="";
strcat ( filedn, path );
strcat ( filedn, name );
strcat ( filedn, "dn.bmp" );
char filert[50]="";
strcat ( filert, path );
strcat ( filert, name );
strcat ( filert, "rt.bmp" );
char filelt[50]="";
strcat ( filelt, path );
strcat ( filelt, name );
strcat ( filelt, "lt.bmp" );
char fileft[50]="";
strcat ( fileft, path );
strcat ( fileft, name );
strcat ( fileft, "ft.bmp" );
char filebk[50]="";
strcat ( filebk, path );
strcat ( filebk, name );
strcat ( filebk, "bk.bmp" );
sc->addSkyBoxSceneNode(
dr->getTexture(fileup),
dr->getTexture(filedn),
dr->getTexture(filert),
dr->getTexture(filelt),
dr->getTexture(fileft),
dr->getTexture(filebk));
dr->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
}
};