[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/games/astrododge
From:       Rivo Laks <rivolaks () hot ! ee>
Date:       2008-08-30 19:37:14
Message-ID: 1220125034.829643.27498.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 854961 by rivol:

Switch to Eigen2, just like KGLLib

 M  +2 -0      CMakeLists.txt  
 M  +0 -2      astrogen/asteroidgen.cpp  
 M  +1 -1      astrogen/asteroidgen.h  
 M  +4 -4      astrogen/modelviewer.cpp  
 M  +1 -2      src/gameobject.h  
 M  +11 -11    src/mainwindow.cpp  
 M  +1 -1      src/mainwindow.h  
 M  +1 -1      src/model.h  
 M  +2 -2      src/ship.cpp  


--- trunk/playground/games/astrododge/CMakeLists.txt #854960:854961
@@ -6,6 +6,7 @@
 find_package(KDE4 REQUIRED)
 find_package(OpenGL REQUIRED)
 find_package(KGLLib REQUIRED)
+find_package(Eigen2 REQUIRED)
 find_package(ODE REQUIRED)
 include(KDE4Defaults)
 
@@ -19,6 +20,7 @@
 include_directories(
         ${KDE4_INCLUDES}
         ${KGLLIB_INCLUDE_DIR}
+        ${EIGEN2_INCLUDE_DIR}
         )
 
 
--- trunk/playground/games/astrododge/astrogen/asteroidgen.cpp #854960:854961
@@ -27,8 +27,6 @@
 #include <KConfig>
 #include <KConfigGroup>
 
-#include <eigen/vector.h>
-
 using namespace Eigen;
 
 #include <stdlib.h>
--- trunk/playground/games/astrododge/astrogen/asteroidgen.h #854960:854961
@@ -23,7 +23,7 @@
 #include <QHash>
 #include <QPair>
 
-#include <eigen/vector.h>
+#include <Eigen/Core>
 
 using namespace Eigen;
 
--- trunk/playground/games/astrododge/astrogen/modelviewer.cpp #854960:854961
@@ -68,7 +68,7 @@
     mProgram->bind();
     mProgram->setUniform("diffuseTexture", 0);
     mProgram->unbind();
-    glLightfv(GL_LIGHT0, GL_POSITION, Vector4f(-100000.0, 60000.0, 20000.0, 1.0).array());
+    glLightfv(GL_LIGHT0, GL_POSITION, Vector4f(-100000.0, 60000.0, 20000.0, 1.0).data());
 
     camera()->setPosition(Vector3f(0, 0, 3));
 }
@@ -100,8 +100,8 @@
 
 void ModelViewer::renderVertex(const Vertex& v)
 {
-    glNormal3fv(v.normal.array());
-    glTexCoord2fv(v.tex.array());
-    glVertex3fv(v.pos.array());
+    glNormal3fv(v.normal.data());
+    glTexCoord2fv(v.tex.data());
+    glVertex3fv(v.pos.data());
 }
 
--- trunk/playground/games/astrododge/src/gameobject.h #854960:854961
@@ -18,8 +18,7 @@
 #ifndef GAMEOBJECT_H
 #define GAMEOBJECT_H
 
-#include <eigen/vector.h>
-#include <eigen/matrix.h>
+#include <Eigen/Core>
 #include <ode/ode.h>
 
 #include <QList>
--- trunk/playground/games/astrododge/src/mainwindow.cpp #854960:854961
@@ -412,7 +412,7 @@
     glMatrixMode(GL_MODELVIEW);
     setupWorldView();
     // Setup light pos
-    glLightfv(GL_LIGHT0, GL_POSITION, Vector4f(-100000.0, 60000.0, 20000.0, 1.0).array());
+    glLightfv(GL_LIGHT0, GL_POSITION, Vector4f(-100000.0, 60000.0, 20000.0, 1.0).data());
     glEnable(GL_DEPTH_TEST);
 
 
@@ -446,19 +446,19 @@
     for (int i = 0; i < bullets->count(); i++) {
         Vector3f prevpos = bullets->at(i)->position() - bullets->at(i)->velocity() * 0.4f;
         bulletcolor.w() = 1.0;
-        glColor4fv(bulletcolor.array());
-        glVertex3fv(bullets->at(i)->position().array());
+        glColor4fv(bulletcolor.data());
+        glVertex3fv(bullets->at(i)->position().data());
         bulletcolor.w() = 0.6;
-        glColor4fv(bulletcolor.array());
-        glVertex3fv(prevpos.array());
+        glColor4fv(bulletcolor.data());
+        glVertex3fv(prevpos.data());
     }
     glEnd();
 
     bulletcolor.w() = 1.0;
-    glColor4fv(bulletcolor.array());
+    glColor4fv(bulletcolor.data());
     glBegin(GL_POINTS);
     for (int i = 0; i < bullets->count(); i++) {
-        glVertex3fv(bullets->at(i)->position().array());
+        glVertex3fv(bullets->at(i)->position().data());
     }
     glEnd();
     glDisable(GL_BLEND);
@@ -482,10 +482,10 @@
     Vector3f c = target + toRight*100 + ship->up()*100;
     Vector3f d = target - toRight*100 + ship->up()*100;
     glBegin(GL_QUADS);
-    glVertex3fv(a.array());
-    glVertex3fv(b.array());
-    glVertex3fv(c.array());
-    glVertex3fv(d.array());
+    glVertex3fv(a.data());
+    glVertex3fv(b.data());
+    glVertex3fv(c.data());
+    glVertex3fv(d.data());
     glEnd();
     glDepthMask(GL_TRUE);
     mSpaceProgram->unbind();
--- trunk/playground/games/astrododge/src/mainwindow.h #854960:854961
@@ -20,7 +20,7 @@
 
 
 #include <kgllib/hdrglwidget.h>
-#include <eigen/vector.h>
+#include <Eigen/Core>
 #include <QTime>
 #include <QHash>
 
--- trunk/playground/games/astrododge/src/model.h #854960:854961
@@ -18,7 +18,7 @@
 #ifndef MODEL_H
 #define MODEL_H
 
-#include <eigen/vector.h>
+#include <Eigen/Core>
 
 #include <QVector>
 #include <QString>
--- trunk/playground/games/astrododge/src/ship.cpp #854960:854961
@@ -35,12 +35,12 @@
 
 Vector3f Ship::dir() const
 {
-    return (rotationMatrix() * Vector3f(0, 0, 1)).normalize();
+    return (rotationMatrix() * Vector3f(0, 0, 1)).normalized();
 }
 
 Vector3f Ship::up() const
 {
-    return (rotationMatrix() * Vector3f(0, 1, 0)).normalize();
+    return (rotationMatrix() * Vector3f(0, 1, 0)).normalized();
 }
 
 void Ship::advance(float elapsed)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic