Beispiel #1
0
World::World()
{
	instance = this;


	this->spaceship = new Spaceship();
	this->spaceship->SetScaling(vec3(1.0f, 1.0f, 1.0f));
	mModel.push_back(this->spaceship);

	//setup enemy spaceship 1
	this->enemySpaceship1 = new Spaceship();
	this->enemySpaceship1->SetPosition(vec3(7.0f, 7.0f, 7.0f));
	this->enemySpaceship1->SetVelocity(vec3(-3.0f, 0.0f, 0.0f));
	this->enemySpaceship1->SetMaxCapacity(10);
	mModel.push_back(this->enemySpaceship1);

	//setup sphere model 1
#if defined(PLATFORM_OSX)
	this->sphere1 = new SphereModel(TextureLoader::LoadTexture("Textures\\asteroidTexture.jpg"));
#else
	this->sphere1 = new SphereModel(TextureLoader::LoadTexture("..\\Assets\\Textures\\asteroidTexture.jpg"));
#endif
	this->sphere1->SetPosition(vec3(5.0f, 5.0f, -20.0f));
	this->sphere1->SetVelocity(vec3(1.0f, 0.0f, 0.0f));

	this->emitter = new ParticleEmitter(vec3(0.0f, 0.0f, 0.0f), this->sphere1);
	this->desc = new ParticleDescriptor();

	desc->SetFireDescriptor();

	this->particleSystem = new ParticleSystem(emitter, desc);
	AddParticleSystem(this->particleSystem);

	mModel.push_back(this->sphere1);

	//setup sphere model 2
#if defined(PLATFORM_OSX)
	this->sphere2 = new SphereModel(TextureLoader::LoadTexture("Textures\\asteroidTexture.jpg"));
#else
	this->sphere2 = new SphereModel(TextureLoader::LoadTexture("..\\Assets\\Textures\\asteroidTexture.jpg"));
#endif
	this->sphere2->SetPosition(vec3(5.0f, 5.0f, -20.0f));
	this->sphere2->SetVelocity(vec3(0.0f, 0.0f, 1.0f));

	this->emitter = new ParticleEmitter(vec3(0.0f, 0.0f, 0.0f), this->sphere2);
	this->desc = new ParticleDescriptor();

	desc->SetFireDescriptor();

	this->particleSystem = new ParticleSystem(emitter, desc);
	AddParticleSystem(this->particleSystem);

	mModel.push_back(this->sphere2);



#if defined(PLATFORM_OSX)
	this->skybox = new Skybox(vec3(100.0f, 100.0f, 100.0f), "Textures\\skyboxPositiveX.png", "Textures\\skyboxNegativeX.png", "Textures\\skyboxPositiveY.png", "Textures\\skyboxNegativeY.png", "Textures\\skyboxPositiveZ.png", "Textures\\skyboxNegativeZ.png");
#else
	this->skybox = new Skybox(vec3(100.0f, 100.0f, 100.0f), "..\\Assets\\Textures\\skyboxPositiveX.png", "..\\Assets\\Textures\\skyboxNegativeX.png", "..\\Assets\\Textures\\skyboxPositiveY.png", "..\\Assets\\Textures\\skyboxNegativeY.png", "..\\Assets\\Textures\\skyboxPositiveZ.png", "..\\Assets\\Textures\\skyboxNegativeZ.png");
#endif

	// Setup Camera
	mCamera.push_back(new ThirdPersonCamera(vec3(3.0f, 1.0f, 5.0f), this->spaceship, 5.0f));

	thirdCam = new ThirdPersonCamera(vec3(3.0f, 1.0f, 5.0f), spaceship);
	thirdCam->SetCinematic(true);
	thirdCam->SetCinematicRadius(6.0f);
	mCamera.push_back(thirdCam);

	mCamera.push_back(new FirstPersonCamera(vec3(3.0f, 1.0f, 5.0f)));
	mCamera.push_back(new StaticCamera(vec3(3.0f, 30.0f, 5.0f), vec3(0.0f, 0.0f, 0.0f), vec3(0.0f, 1.0f, 0.0f)));
	mCamera.push_back(new StaticCamera(vec3(0.5f, 0.5f, 5.0f), vec3(0.0f, 0.5f, 0.0f), vec3(0.0f, 1.0f, 0.0f)));
	mCamera.push_back(new StaticCamera(vec3(0.0f, 50.0f, 0.0f), vec3(0.0f, 0.5f, 0.0f), vec3(0.0f, 1.0f, 0.0f)));
	mCurrentCamera = 0;

#if defined(PLATFORM_OSX)
	int billboardTextureID = TextureLoader::LoadTexture("Textures/Particle.png");
#else
	int billboardTextureID = TextureLoader::LoadTexture("../Assets/Textures/Particle.png");
#endif
	assert(billboardTextureID != 0);

	mpBillboardList = new BillboardList(2048, billboardTextureID);

	ParticleDescriptor* asteroidDescriptor = new ParticleDescriptor();
	asteroidDescriptor->SetAsteroidDescriptor();

	ParticleEmitter* emitter = new ParticleEmitter(vec3(0.0f, 0.0f, 0.0f));

	mAsteroidSystem = new AsteroidSystem(emitter, asteroidDescriptor);
	mSolarSystem = new SolarSystem();
}