using now 3d asteroids

This commit is contained in:
martin
2011-06-13 19:21:39 +02:00
parent 5c58595f35
commit 419ebc8783
2 changed files with 27 additions and 28 deletions
+22 -16
View File
@@ -269,20 +269,6 @@ void View::Draw() {
DrawWorld ();
}
glPushMatrix();
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT0);
glRotatef (90, 1., 0., 0.);
// glScalef (10., 10., 10.);
DrawOBJModel (mAsteroidModel);
glDisable (GL_LIGHT0);
glDisable (GL_LIGHTING);
glPopMatrix();
DrawUi ();
// Perform post-Draw actions
@@ -677,6 +663,8 @@ void View::DrawUiLevelIntro() {
GetModel()->SetPlayerLives(100);
}
glEnable(GL_BLEND);
stringstream level_info_stream;
level_info_stream << "Level " << GetModel()->GetCurrentLevelIndex() + 1;
@@ -760,6 +748,8 @@ void View::DrawUiLevelIntro() {
level_author_dest_y - Engine::GetTimer("LevelIntroLevelAuthor") * level_author_delta_y
);
glDisable(GL_BLEND);
if (Engine::CheckTimer("LevelIntroLevelStart")) {
if(Engine::GUI::Button (1, "Start", (screen_right - button_width) * 0.5, screen_bottom * 0.5 + 180, button_width, button_height)) {
PopViewState();
@@ -1661,8 +1651,24 @@ void View::DrawShip (ShipEntity *ship) {
}
void View::DrawAsteroid (AsteroidEntity *asteroid) {
mAsteroidSprite.SetScale (2. * asteroid->mPhysicState->mRadius / mAsteroidSprite.GetWidth());
mAsteroidSprite.DrawAt(0., 0., 0.);
// mAsteroidSprite.SetScale (2. * asteroid->mPhysicState->mRadius / mAsteroidSprite.GetWidth());
// mAsteroidSprite.DrawAt(0., 0., 0.);
glPushMatrix();
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT0);
// glRotatef (90, 1., 0., 0.);
float scale = 1.8 * asteroid->mPhysicState->mRadius;
glScalef (scale, scale, scale);
DrawOBJModel (mAsteroidModel);
glDisable (GL_LIGHT0);
glDisable (GL_LIGHTING);
glPopMatrix();
#ifdef DRAW_BOUNDARIES
glColor3f (1., 1., 1.);