[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/libs/kgllib
From: Rivo Laks <rivolaks () hot ! ee>
Date: 2008-01-22 21:09:05
Message-ID: 1201036145.306985.23076.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 764924 by rivol:
- Add more missing dtors
- Make some ctors explicit
- Use correct Qt includes
M +9 -0 core/kgllib/texture.cpp
M +5 -3 core/kgllib/texture.h
M +4 -0 extras/kgllib/camera.cpp
M +1 -0 extras/kgllib/camera.h
M +2 -2 extras/kgllib/fpscounter.h
M +4 -4 extras/kgllib/glwidget.h
M +27 -0 extras/kgllib/simpleterrain.cpp
M +4 -3 extras/kgllib/simpleterrain.h
M +4 -0 extras/kgllib/trackball.cpp
M +1 -0 extras/kgllib/trackball.h
--- trunk/playground/libs/kgllib/core/kgllib/texture.cpp #764923:764924
@@ -98,6 +98,10 @@
mValid = init(filename, filter);
}
+Texture::~Texture()
+{
+}
+
bool Texture::init(int width, int height)
{
glGenTextures(1, &mGLId);
@@ -165,6 +169,11 @@
/*** Texture ***/
+
+Texture3D::~Texture3D()
+{
+}
+
void Texture3D::setWrapMode(GLenum mode)
{
TextureBase::setWrapMode(GL_TEXTURE_WRAP_S, mode);
--- trunk/playground/libs/kgllib/core/kgllib/texture.h #764923:764924
@@ -149,10 +149,11 @@
* Creates texture from given image.
* Mipmaps are created automatically unless filter is GL_NEAREST or GL_LINEAR.
**/
- Texture(const QImage& img, GLenum filter = GL_LINEAR_MIPMAP_LINEAR);
- Texture(const QPixmap& pix, GLenum filter = GL_LINEAR_MIPMAP_LINEAR);
- Texture(const QString& filename, GLenum filter = GL_LINEAR_MIPMAP_LINEAR);
+ explicit Texture(const QImage& img, GLenum filter = GL_LINEAR_MIPMAP_LINEAR);
+ explicit Texture(const QPixmap& pix, GLenum filter = GL_LINEAR_MIPMAP_LINEAR);
+ explicit Texture(const QString& filename, GLenum filter = \
GL_LINEAR_MIPMAP_LINEAR); Texture(int width, int height);
+ virtual ~Texture();
int width() const { return mWidth; }
int height() const { return mHeight; }
@@ -181,6 +182,7 @@
{
public:
Texture3D(int width, int height, int depth);
+ virtual ~Texture3D();
virtual void setWrapMode(GLenum mode);
--- trunk/playground/libs/kgllib/extras/kgllib/camera.cpp #764923:764924
@@ -35,6 +35,10 @@
mUp = Vector3f(0, 1, 0);
}
+Camera::~Camera()
+{
+}
+
void Camera::setFoV(float fov)
{
mFoV = fov;
--- trunk/playground/libs/kgllib/extras/kgllib/camera.h #764923:764924
@@ -30,6 +30,7 @@
{
public:
Camera();
+ virtual ~Camera();
virtual void applyPerspective();
virtual void applyView();
--- trunk/playground/libs/kgllib/extras/kgllib/fpscounter.h #764923:764924
@@ -21,8 +21,8 @@
#include "kgllib.h"
-#include <QTime>
-#include <QString>
+#include <QtCore/QTime>
+#include <QtCore/QString>
namespace KGLLib
--- trunk/playground/libs/kgllib/extras/kgllib/glwidget.h #764923:764924
@@ -20,7 +20,7 @@
#include "kgllib.h"
-#include <QGLWidget>
+#include <QtOpenGL/QGLWidget>
#include <eigen/vector.h>
@@ -41,9 +41,9 @@
{
Q_OBJECT
public:
- GLWidget(QWidget* parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags \
f = 0);
- GLWidget(QGLContext* context, QWidget* parent = 0, const QGLWidget* shareWidget \
= 0, Qt::WindowFlags f = 0);
- GLWidget(const QGLFormat& format, QWidget* parent = 0, const QGLWidget* \
shareWidget = 0, Qt::WindowFlags f = 0); + explicit GLWidget(QWidget* parent = 0, \
const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0); + explicit \
GLWidget(QGLContext* context, QWidget* parent = 0, const QGLWidget* shareWidget = 0, \
Qt::WindowFlags f = 0); + explicit GLWidget(const QGLFormat& format, QWidget* \
parent = 0, const QGLWidget* shareWidget = 0, Qt::WindowFlags f = 0);
virtual ~GLWidget();
--- trunk/playground/libs/kgllib/extras/kgllib/simpleterrain.cpp #764923:764924
@@ -64,6 +64,22 @@
setPrimitiveType(GL_TRIANGLE_STRIP);
}
+SimpleTerrain::~SimpleTerrain()
+{
+ if (mHeightmap) {
+ for (int x = 0; x < mWidth; x++) {
+ delete[] mHeightmap[x];
+ }
+ delete[] mHeightmap;
+ }
+ if (mNormalmap) {
+ for (int x = 0; x < mWidth; x++) {
+ delete[] mNormalmap[x];
+ }
+ delete[] mNormalmap;
+ }
+}
+
void SimpleTerrain::setHeightRange(float min, float max)
{
mMinHeight = min;
@@ -102,6 +118,13 @@
void SimpleTerrain::recalcNormalmap()
{
+ if (mNormalmap) {
+ for (int x = 0; x < mWidth; x++) {
+ delete[] mNormalmap[x];
+ }
+ delete[] mNormalmap;
+ }
+
mNormalmap = new Vector3f*[mWidth];
for (int x = 0; x < mWidth; x++) {
mNormalmap[x] = new Vector3f[mHeight];
@@ -141,6 +164,10 @@
mDirty = false;
recalcNormalmap();
+ delete[] mVertices;
+ delete[] mNormals;
+ delete[] mIndices;
+
int vcount = mWidth * mHeight;
int icount = (mWidth-1) * (2 + 2*mHeight);
--- trunk/playground/libs/kgllib/extras/kgllib/simpleterrain.h #764923:764924
@@ -21,12 +21,12 @@
#include "mesh.h"
-#include <QTime>
-#include <QString>
-
#include <eigen/vector.h>
+class QString;
+
+
namespace KGLLib
{
class Batch;
@@ -35,6 +35,7 @@
{
public:
SimpleTerrain(const QString& imgfilename);
+ virtual ~SimpleTerrain();
virtual void render();
--- trunk/playground/libs/kgllib/extras/kgllib/trackball.cpp #764923:764924
@@ -38,6 +38,10 @@
mMatrix.loadIdentity();
}
+TrackBall::~TrackBall()
+{
+}
+
void TrackBall::rotate(float dx, float dy)
{
wy += dx/300;
--- trunk/playground/libs/kgllib/extras/kgllib/trackball.h #764923:764924
@@ -31,6 +31,7 @@
{
public:
TrackBall();
+ virtual ~TrackBall();
virtual void rotate(float dx, float dy);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic