Replaced Quads by Meshes

This commit is contained in:
Tats
2013-12-10 22:37:45 -05:00
parent f66f67c654
commit 6595d9911a
5 changed files with 36 additions and 7 deletions
+28
View File
@@ -0,0 +1,28 @@
/*
* Defs.h
*
* (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEFS_H_
#define DEFS_H_
#define DEFAULT_WINDOW_WIDTH 640
#define DEFAULT_WINDOW_HEIGHT 480
#endif
+5 -4
View File
@@ -191,7 +191,7 @@ void MainWindow::import()
}
}
void MainWindow::addQuad()
void MainWindow::addMesh()
{
// Create default quad.
@@ -203,8 +203,9 @@ void MainWindow::addQuad()
Q_CHECK_PTR(texture);
// Create input and output quads.
Shape::ptr outputQuad = Shape::ptr(Util::createQuadForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
Shape::ptr inputQuad = Shape::ptr(Util::createQuadForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
qDebug() << "adding mesh" << endl;
Shape::ptr outputQuad = Shape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
Shape::ptr inputQuad = Shape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
// Create texture mapping.
Mapping::ptr mapping(new TextureMapping(paint, outputQuad, inputQuad));
@@ -423,7 +424,7 @@ void MainWindow::createActions()
addQuadAction = new QAction(tr("&Add quad"), this);
addQuadAction->setIcon(QIcon(":/images/draw-rectangle-2.png"));
addQuadAction->setStatusTip(tr("Add quad"));
connect(addQuadAction, SIGNAL(triggered()), this, SLOT(addQuad()));
connect(addQuadAction, SIGNAL(triggered()), this, SLOT(addMesh()));
addTriangleAction = new QAction(tr("&Add triangle"), this);
addTriangleAction->setIcon(QIcon(":/images/draw-triangle.png"));
+1 -1
View File
@@ -62,7 +62,7 @@ private slots:
void handleLayerItemSelectionChanged();
void handleLayerItemChanged(QListWidgetItem* item);
void handleLayerIndexesMoved();
void addQuad();
void addMesh();
void addTriangle();
void windowModified();
+1 -1
View File
@@ -56,7 +56,7 @@ int map_int(int value, int istart, int istop, int ostart, int ostop)
return std::max(std::min(int(ret), ostop), ostart);
}
Mesh* createQuadForTexture(Texture* texture, int frameWidth, int frameHeight)
Mesh* createMeshForTexture(Texture* texture, int frameWidth, int frameHeight)
{
return new Mesh(
Point(texture->getX(), texture->getY()),
+1 -1
View File
@@ -39,7 +39,7 @@ float map_float(float value, float istart, float istop, float ostart, float osto
int map_int(int value, int istart, int istop, int ostart, int ostop);
Mesh* createQuadForTexture(Texture* texture, int frameWidth, int frameHeight);
Mesh* createMeshForTexture(Texture* texture, int frameWidth, int frameHeight);
Triangle* createTriangleForTexture(Texture* texture, int frameWidth, int frameHeight);
} // end of namespace