added OBJ loader
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
#include "AsteroidsEvents.h"
|
||||
#include "RocketEntity.h"
|
||||
|
||||
#include "OBJModel.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
@@ -77,6 +79,8 @@ int View::OnInit (int argc, char* argv[]) {
|
||||
mShipPartsSprite.LoadFromPNG (Engine::GetResourceFullPath("/data/textures/ship_parts.png"));
|
||||
mShipPartsSprite.SetSubSpriteCount (10);
|
||||
|
||||
mAsteroidModel = LoadOBJModel (Engine::GetResourceFullPath("/data/models/asteroid/asteroid_model.obj"));
|
||||
|
||||
Engine::RegisterListener (this, EventAccelerateStart);
|
||||
Engine::RegisterListener (this, EventAccelerateStop);
|
||||
Engine::RegisterListener (this, EventShipExplode);
|
||||
@@ -265,6 +269,20 @@ 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
|
||||
|
||||
+3
-1
@@ -139,7 +139,9 @@ class View : public Engine::ViewBase {
|
||||
Engine::Sprite mShipSprite;
|
||||
Engine::Sprite mShipThrustSprite;
|
||||
Engine::Sprite mShipPartsSprite;
|
||||
|
||||
|
||||
Engine::OBJModelPtr mAsteroidModel;
|
||||
|
||||
float screen_left;
|
||||
float screen_right;
|
||||
float screen_top;
|
||||
|
||||
Reference in New Issue
Block a user