Major reconfiguration of the GL canvases and the Mapper interface to allow for the use of a QPainter and for integrating ColorPaint mappings

This commit is contained in:
Tats
2014-01-22 15:01:00 -05:00
parent 3692565d94
commit 0ff52de66a
8 changed files with 328 additions and 164 deletions
+3 -3
View File
@@ -34,7 +34,7 @@ Shape* DestinationGLCanvas::getShapeFromMappingId(uid mappingId)
return MainWindow::getInstance().getMappingManager().getMappingById(mappingId)->getShape().get();
}
void DestinationGLCanvas::doDraw()
void DestinationGLCanvas::doDraw(QPainter* painter)
{
// // No sources = nothing to do.
// if (Common::nImages() == 0)
@@ -79,14 +79,14 @@ void DestinationGLCanvas::doDraw()
texture->loadTexture();
// Draw the mappings.
MainWindow::getInstance().getMapperByMappingId(mapping->getId())->draw();
MainWindow::getInstance().getMapperByMappingId(mapping->getId())->draw(painter);
}
// Draw the controls of current mapping.
if (MainWindow::getInstance().hasCurrentMapping() &&
getCurrentShape() != NULL)
{
MainWindow::getInstance().getMapperByMappingId(MainWindow::getInstance().getCurrentMappingId())->drawControls();
MainWindow::getInstance().getMapperByMappingId(MainWindow::getInstance().getCurrentMappingId())->drawControls(painter);
}
glPopMatrix();
+1 -1
View File
@@ -39,7 +39,7 @@ public:
// virtual Quad& getQuad();
private:
virtual void doDraw();
virtual void doDraw(QPainter* painter);
};
#endif /* DESTINATIONGLCANVAS_H_ */
+177 -91
View File
@@ -20,22 +20,12 @@
#include "Mapper.h"
TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
: Mapper(mapping)
Mapper::Mapper(Mapping::ptr mapping)
: _mapping(mapping)
{
// Assign members pointers.
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
Q_CHECK_PTR(textureMapping);
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
Q_CHECK_PTR(texture);
outputShape = std::tr1::static_pointer_cast<Shape>(textureMapping->getShape());
outputShape = mapping->getShape();
Q_CHECK_PTR(outputShape);
inputShape = std::tr1::static_pointer_cast<Shape>(textureMapping->getInputShape());
Q_CHECK_PTR(inputShape);
// Create editor.
_propertyBrowser = new QtTreePropertyBrowser;
_variantManager = new QtVariantPropertyManager;
@@ -47,19 +37,11 @@ TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
_propertyBrowser->setFactoryForManager(_variantManager, _variantFactory);
// Input shape.
_inputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
QObject::tr("Input shape"));
_buildShapeProperty(_inputItem, textureMapping->getInputShape().get());
_topItem->addSubProperty(_inputItem);
// Output shape.
// Input shape.
_outputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
QObject::tr("Output shape"));
_buildShapeProperty(_outputItem, textureMapping->getShape().get());
_buildShapeProperty(_outputItem, mapping->getShape().get());
_topItem->addSubProperty(_outputItem);
connect(_variantManager, SIGNAL(valueChanged(QtProperty*, const QVariant&)),
@@ -70,7 +52,51 @@ TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
qDebug() << "Creating mapper" << endl;
}
void TextureMapper::setValue(QtProperty* property, const QVariant& value)
QWidget* Mapper::getPropertiesEditor()
{
return _propertyBrowser;
}
void Mapper::drawShapeContour(QPainter* painter, const Shape& shape, int lineWidth, const QColor& color)
{
QColor rgbColor = color.toRgb();
glColor4f(rgbColor.redF(), rgbColor.greenF(), rgbColor.blueF(), 1.0f);
glLineWidth(lineWidth);
glBegin (GL_LINE_STRIP);
for (int i = 0; i < shape.nVertices()+1; i++)
{
glVertex2f(
shape.getVertex(i % shape.nVertices())->x(),
shape.getVertex(i % shape.nVertices())->y()
);
}
glEnd();
}
TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
: Mapper(mapping)
{
// Assign members pointers.
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
Q_CHECK_PTR(textureMapping);
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
Q_CHECK_PTR(texture);
inputShape = std::tr1::static_pointer_cast<Shape>(textureMapping->getInputShape());
Q_CHECK_PTR(inputShape);
// Input shape.
_inputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
QObject::tr("Input shape"));
_buildShapeProperty(_inputItem, textureMapping->getInputShape().get());
_topItem->insertSubProperty(_inputItem, 0); // insert before output item
}
void Mapper::setValue(QtProperty* property, const QVariant& value)
{
std::map<QtProperty*, std::pair<Shape*, int> >::iterator it = _propertyToVertex.find(property);
if (it != _propertyToVertex.end())
@@ -86,6 +112,116 @@ void TextureMapper::setValue(QtProperty* property, const QVariant& value)
}
}
void Mapper::_buildShapeProperty(QtProperty* shapeItem, Shape* shape)
{
for (int i=0; i<shape->nVertices(); i++)
{
// Add point.
QtVariantProperty* pointItem = _variantManager->addProperty(QVariant::PointF,
QObject::tr("Point %1").arg(i));
Point *p = shape->getVertex(i);
pointItem->setValue(*p);
shapeItem->addSubProperty(pointItem);
_propertyToVertex[pointItem] = std::make_pair(shape, i);
}
}
void Mapper::_updateShapeProperty(QtProperty* shapeItem, Shape* shape)
{
QList<QtProperty*> pointItems = shapeItem->subProperties();
for (int i=0; i<shape->nVertices(); i++)
{
// XXX mesh control points are not added to properties
if (i < pointItems.size())
{
QtVariantProperty* pointItem = (QtVariantProperty*)pointItems[i];
Point *p = shape->getVertex(i);
pointItem->setValue(*p);
}
}
}
ColorMapper::ColorMapper(Mapping::ptr mapping)
: Mapper(mapping)
{
color = std::tr1::static_pointer_cast<Color>(_mapping->getPaint());
Q_CHECK_PTR(color);
}
#include "MainWindow.h"
void ColorMapper::draw(QPainter* painter)
{
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
painter->setBrush(color->getColor());
// Draw shape as polygon.
painter->drawPolygon(_mapping->getShape()->toPolygon());
}
void ColorMapper::drawControls(QPainter* painter)
{
}
MeshColorMapper::MeshColorMapper(Mapping::ptr mapping)
: ColorMapper(mapping) {
// Add mesh sub property.
Mesh* mesh = (Mesh*)mapping->getShape().get();
_meshItem = _variantManager->addProperty(QVariant::Size, QObject::tr("Dimensions"));
_meshItem->setValue(QSize(mesh->nColumns(), mesh->nRows()));
_topItem->insertSubProperty(_meshItem, 0); // insert at the beginning
}
void MeshColorMapper::draw(QPainter* painter)
{
painter->setRenderHint(QPainter::Antialiasing);
painter->setPen(Qt::NoPen);
painter->setBrush(color->getColor());
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
std::vector<std::vector<Quad> > outputQuads = outputMesh->getQuads2d();
for (int x = 0; x < outputMesh->nHorizontalQuads(); x++)
{
for (int y = 0; y < outputMesh->nVerticalQuads(); y++)
{
Quad& outputQuad = outputQuads[x][y];
painter->drawPolygon(outputQuad.toPolygon());
}
}
}
void MeshColorMapper::drawControls(QPainter* painter)
{
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
std::vector<Quad> outputQuads = outputMesh->getQuads();
for (std::vector<Quad>::const_iterator it = outputQuads.begin(); it != outputQuads.end(); ++it)
{
drawShapeContour(painter, *it, 1, QColor(0, 0, 255));
}
}
void MeshColorMapper::setValue(QtProperty* property, const QVariant& value)
{
if (property == _meshItem)
{
Mesh* outputMesh = static_cast<Mesh*>(_mapping->getShape().get());
QSize size = (static_cast<QtVariantProperty*>(property))->value().toSize();
if (outputMesh->nColumns() != size.width() || outputMesh->nRows() != size.height())
{
outputMesh->resize(size.width(), size.height());
emit valueChanged();
}
}
else
ColorMapper::setValue(property, value);
}
void TextureMapper::updateShape(Shape* shape)
{
std::tr1::shared_ptr<TextureMapping> textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
@@ -107,13 +243,11 @@ void TextureMapper::updateShape(Shape* shape)
}
QWidget* TextureMapper::getPropertiesEditor()
{
return _propertyBrowser;
}
void TextureMapper::draw()
void TextureMapper::draw(QPainter* painter)
{
painter->beginNativePainting();
// Only works for similar shapes.
Q_ASSERT( outputShape->nVertices() == outputShape->nVertices());
@@ -134,75 +268,26 @@ void TextureMapper::draw()
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
// Perform the actual mapping (done by subclasses).
_doDraw();
_doDraw(painter);
glDisable(GL_TEXTURE_2D);
painter->endNativePainting();
}
void TextureMapper::drawInput()
void TextureMapper::drawInput(QPainter* painter)
{
}
void TextureMapper::drawControls()
void TextureMapper::drawControls(QPainter* painter)
{
drawShapeContour(*outputShape, 3, QColor(0, 0, 255));
drawShapeContour(painter, *outputShape, 3, QColor(0, 0, 255));
}
void TextureMapper::drawInputControls()
void TextureMapper::drawInputControls(QPainter* painter)
{
drawShapeContour(*inputShape, 3, QColor(0, 0, 255));
}
void TextureMapper::drawShapeContour(const Shape& shape, int lineWidth, const QColor& color)
{
QColor rgbColor = color.toRgb();
glColor4f(rgbColor.redF(), rgbColor.greenF(), rgbColor.blueF(), 1.0f);
glLineWidth(lineWidth);
glBegin (GL_LINE_STRIP);
for (int i = 0; i < shape.nVertices()+1; i++)
{
glVertex2f(
shape.getVertex(i % shape.nVertices())->x(),
shape.getVertex(i % shape.nVertices())->y()
);
}
glEnd();
}
void TextureMapper::_buildShapeProperty(QtProperty* shapeItem, Shape* shape)
{
for (int i=0; i<shape->nVertices(); i++)
{
// Add point.
QtVariantProperty* pointItem = _variantManager->addProperty(QVariant::PointF,
QObject::tr("Point %1").arg(i));
Point *p = shape->getVertex(i);
pointItem->setValue(*p);
shapeItem->addSubProperty(pointItem);
_propertyToVertex[pointItem] = std::make_pair(shape, i);
}
}
void TextureMapper::_updateShapeProperty(QtProperty* shapeItem, Shape* shape)
{
QList<QtProperty*> pointItems = shapeItem->subProperties();
for (int i=0; i<shape->nVertices(); i++)
{
// XXX mesh control points are not added to properties
if (i < pointItems.size())
{
QtVariantProperty* pointItem = (QtVariantProperty*)pointItems[i];
Point *p = shape->getVertex(i);
pointItem->setValue(*p);
}
}
drawShapeContour(painter, *inputShape, 3, QColor(0, 0, 255));
}
TriangleTextureMapper::TriangleTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
@@ -210,7 +295,7 @@ TriangleTextureMapper::TriangleTextureMapper(std::tr1::shared_ptr<TextureMapping
{
}
void TriangleTextureMapper::_doDraw()
void TriangleTextureMapper::_doDraw(QPainter* painter)
{
glBegin(GL_TRIANGLES);
{
@@ -261,27 +346,27 @@ void MeshTextureMapper::setValue(QtProperty* property, const QVariant& value)
TextureMapper::setValue(property, value);
}
void MeshTextureMapper::drawControls()
void MeshTextureMapper::drawControls(QPainter* painter)
{
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
std::vector<Quad> outputQuads = outputMesh->getQuads();
for (std::vector<Quad>::const_iterator it = outputQuads.begin(); it != outputQuads.end(); ++it)
{
drawShapeContour(*it, 1, QColor(0, 0, 255));
drawShapeContour(painter, *it, 1, QColor(0, 0, 255));
}
}
void MeshTextureMapper::drawInputControls()
void MeshTextureMapper::drawInputControls(QPainter* painter)
{
std::tr1::shared_ptr<Mesh> inputMesh = std::tr1::static_pointer_cast<Mesh>(inputShape);
std::vector<Quad> inputQuads = inputMesh->getQuads();
for (std::vector<Quad>::const_iterator it = inputQuads.begin(); it != inputQuads.end(); ++it)
{
drawShapeContour(*it, 1, QColor(0, 0, 255));
drawShapeContour(painter, *it, 1, QColor(0, 0, 255));
}
}
void MeshTextureMapper::_doDraw()
void MeshTextureMapper::_doDraw(QPainter* painter)
{
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
std::tr1::shared_ptr<Mesh> inputMesh = std::tr1::static_pointer_cast<Mesh>(inputShape);
@@ -308,3 +393,4 @@ void MeshTextureMapper::_doDraw()
}
}
}
+72 -34
View File
@@ -67,18 +67,77 @@ protected:
public:
typedef std::tr1::shared_ptr<Mapper> ptr;
Mapper(Mapping::ptr mapping) : _mapping(mapping) {}
Mapper(Mapping::ptr mapping);
virtual ~Mapper() {}
virtual QWidget* getPropertiesEditor() = 0;
virtual void draw() = 0;
virtual void drawControls() = 0;
virtual QWidget* getPropertiesEditor();
virtual void draw(QPainter* painter) = 0;
virtual void drawControls(QPainter* painter) = 0;
static void drawShapeContour(QPainter* painter, const Shape& shape, int lineWidth, const QColor& color);
public slots:
virtual void setValue(QtProperty* property, const QVariant& value);
virtual void updateShape(Shape* shape)
{
Q_UNUSED(shape);
}
signals:
void valueChanged();
protected:
QtAbstractPropertyBrowser* _propertyBrowser;
QtVariantEditorFactory* _variantFactory;
QtVariantPropertyManager* _variantManager;
QtProperty* _topItem;
QtProperty* _outputItem;
std::map<QtProperty*, std::pair<Shape*, int> > _propertyToVertex;
// FIXME: use typedefs, member of the class for type names that are too long to type:
std::tr1::shared_ptr<Shape> outputShape;
virtual void _buildShapeProperty(QtProperty* shapeItem, Shape* shape);
virtual void _updateShapeProperty(QtProperty* shapeItem, Shape* shape);
};
/**
* Draws a color.
*/
class ColorMapper : public Mapper
{
Q_OBJECT
public:
ColorMapper(Mapping::ptr mapping);
virtual ~ColorMapper() {}
virtual void draw(QPainter* painter);
virtual void drawControls(QPainter* painter);
protected:
std::tr1::shared_ptr<Color> color;
};
class MeshColorMapper : public ColorMapper
{
Q_OBJECT
public:
MeshColorMapper(Mapping::ptr mapping);
virtual ~MeshColorMapper() {}
virtual void draw(QPainter* painter);
virtual void drawControls(QPainter* painter);
public slots:
virtual void setValue(QtProperty* property, const QVariant& value);
private:
QtVariantProperty* _meshItem;
};
/**
@@ -92,46 +151,26 @@ public:
TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
virtual ~TextureMapper() {}
virtual QWidget* getPropertiesEditor();
virtual void draw(QPainter* painter);
virtual void drawInput(QPainter* painter);
virtual void draw();
virtual void drawInput();
virtual void drawControls();
virtual void drawInputControls();
static void drawShapeContour(const Shape& shape, int lineWidth, const QColor& color);
signals:
void valueChanged();
virtual void drawControls(QPainter* painter);
virtual void drawInputControls(QPainter* painter);
public slots:
virtual void setValue(QtProperty* property, const QVariant& value);
virtual void updateShape(Shape* shape);
protected:
virtual void _doDraw() = 0;
virtual void _doDraw(QPainter* painter) = 0;
protected:
QtAbstractPropertyBrowser* _propertyBrowser;
QtVariantEditorFactory* _variantFactory;
QtVariantPropertyManager* _variantManager;
QtProperty* _topItem;
QtProperty* _inputItem;
QtProperty* _outputItem;
QtVariantProperty* _meshItem;
std::map<QtProperty*, std::pair<Shape*, int> > _propertyToVertex;
// FIXME: use typedefs, member of the class for type names that are too long to type:
std::tr1::shared_ptr<TextureMapping> textureMapping;
std::tr1::shared_ptr<Texture> texture;
std::tr1::shared_ptr<Shape> outputShape;
std::tr1::shared_ptr<Shape> inputShape;
virtual void _buildShapeProperty(QtProperty* shapeItem, Shape* shape);
virtual void _updateShapeProperty(QtProperty* shapeItem, Shape* shape);
};
class TriangleTextureMapper : public TextureMapper
@@ -143,10 +182,9 @@ public:
virtual ~TriangleTextureMapper() {}
protected:
virtual void _doDraw();
virtual void _doDraw(QPainter* painter);
};
class MeshTextureMapper : public TextureMapper
{
Q_OBJECT
@@ -155,14 +193,14 @@ public:
MeshTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
virtual ~MeshTextureMapper() {}
virtual void drawControls();
virtual void drawInputControls();
virtual void drawControls(QPainter* painter);
virtual void drawInputControls(QPainter* painter);
public slots:
virtual void setValue(QtProperty* property, const QVariant& value);
protected:
virtual void _doDraw();
virtual void _doDraw(QPainter* painter);
private:
QtVariantProperty* _meshItem;
+33 -22
View File
@@ -38,6 +38,17 @@ void MapperGLCanvas::initializeGL()
void MapperGLCanvas::resizeGL(int /* width */, int /* height */)
{
glViewport(0, 0, width(), height());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (
0.0f, (GLfloat) width(), // left, right
(GLfloat) height(), 0.0f, // bottom, top
-1.0, 1.0f);
glMatrixMode (GL_MODELVIEW);
// glClearColor(0.0, 0.0, 0.0, 0.0);
//
// glViewport(0, 0, width, height);
@@ -54,32 +65,20 @@ void MapperGLCanvas::resizeGL(int /* width */, int /* height */)
void MapperGLCanvas::paintGL()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
draw();
}
void MapperGLCanvas::draw()
void MapperGLCanvas::draw(QPainter* painter)
{
enterDraw();
doDraw();
exitDraw();
enterDraw(painter);
doDraw(painter);
exitDraw(painter);
}
void MapperGLCanvas::enterDraw()
void MapperGLCanvas::enterDraw(QPainter* painter)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, width(), height());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (
0.0f, (GLfloat) width(), // left, right
(GLfloat) height(), 0.0f, // bottom, top
-1.0, 1.0f);
glMatrixMode (GL_MODELVIEW);
Q_UNUSED(painter);
// glClearColor(0.0, 0.0, 0.0, 0.0);
// glClear(GL_COLOR_BUFFER_BIT);
@@ -233,7 +232,18 @@ void MapperGLCanvas::keyPressEvent(QKeyEvent* event)
void MapperGLCanvas::paintEvent(QPaintEvent* /* event */)
{
updateGL();
makeCurrent();
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
draw(&painter);
painter.end();
// updateGL();
}
//void MapperGLCanvas::switchImage(int imageId)
@@ -252,10 +262,11 @@ void MapperGLCanvas::paintEvent(QPaintEvent* /* event */)
// return QSize( 320, 240 );
//}
void MapperGLCanvas::exitDraw()
void MapperGLCanvas::exitDraw(QPainter* painter)
{
glFlush();
swapBuffers();
Q_UNUSED(painter);
// glFlush();
// swapBuffers();
}
void MapperGLCanvas::updateCanvas()
+4 -4
View File
@@ -63,10 +63,10 @@ protected:
void paintEvent(QPaintEvent* event);
private:
void draw();
void enterDraw();
virtual void doDraw() = 0;
void exitDraw();
void draw(QPainter* painter);
void enterDraw(QPainter* painter);
virtual void doDraw(QPainter* painter) = 0;
void exitDraw(QPainter* painter);
bool _mousepressed;
int _active_vertex;
bool _shapegrabbed;
+34 -8
View File
@@ -36,10 +36,17 @@ Shape* SourceGLCanvas::getShapeFromMappingId(uid mappingId)
else
{
Mapping::ptr mapping = MainWindow::getInstance().getMappingManager().getMappingById(mappingId);
std::tr1::shared_ptr<TextureMapping> textureMapping = std::tr1::static_pointer_cast<TextureMapping>(mapping);
Q_CHECK_PTR(textureMapping);
// TODO: this is real shit... : we should at the very least use some dynamic casting or (better) implement a correct
// class architecture to suit our needs
if (mapping->getType().endsWith("_texture"))
{
std::tr1::shared_ptr<TextureMapping> textureMapping = std::tr1::static_pointer_cast<TextureMapping>(mapping);
Q_CHECK_PTR(textureMapping);
return textureMapping->getInputShape().get();
return textureMapping->getInputShape().get();
}
else
return NULL;
}
}
@@ -54,7 +61,7 @@ Shape* SourceGLCanvas::getShapeFromMappingId(uid mappingId)
// return (*inputQuad);
//}
void SourceGLCanvas::doDraw()
void SourceGLCanvas::doDraw(QPainter* painter)
{
if (!MainWindow::getInstance().hasCurrentPaint())
return;
@@ -64,6 +71,28 @@ void SourceGLCanvas::doDraw()
// Retrieve paint (as texture) and draw it.
Paint::ptr paint = MainWindow::getInstance().getMappingManager().getPaintById(paintId);
Q_CHECK_PTR(paint);
// Retrieve all mappings associated to paint.
std::map<uid, Mapping::ptr> mappings = MainWindow::getInstance().getMappingManager().getPaintMappingsById(paintId);
if (paint->getType() == "color")
_drawColor(painter, paint, mappings);
else
_drawTexture(painter, paint, mappings);
}
void SourceGLCanvas::_drawColor(QPainter* painter, Paint::ptr paint, std::map<uid, Mapping::ptr> mappings)
{
// Not doing anything for now.
Q_UNUSED(painter);
Q_UNUSED(paint);
Q_UNUSED(mappings);
}
void SourceGLCanvas::_drawTexture(QPainter* painter, Paint::ptr paint, std::map<uid, Mapping::ptr> mappings)
{
Q_UNUSED(painter);
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
Q_CHECK_PTR(texture);
@@ -124,9 +153,6 @@ void SourceGLCanvas::doDraw()
glDisable(GL_TEXTURE_2D);
// Retrieve all mappings associated to paint.
std::map<uid, Mapping::ptr> mappings = MainWindow::getInstance().getMappingManager().getPaintMappingsById(paintId);
for (std::map<uid, Mapping::ptr>::iterator it = mappings.begin(); it != mappings.end(); ++it)
{
// TODO: Ceci est un hack necessaire car tout est en fonction de la width/height de la texture.
@@ -145,7 +171,7 @@ void SourceGLCanvas::doDraw()
std::tr1::shared_ptr<TextureMapper> textureMapper = std::tr1::static_pointer_cast<TextureMapper>(mapper);
Q_CHECK_PTR(textureMapper);
textureMapper->drawInputControls();
textureMapper->drawInputControls(painter);
}
}
+4 -1
View File
@@ -39,7 +39,10 @@ public:
// virtual Quad& getQuad();
private:
virtual void doDraw();
virtual void doDraw(QPainter* painter);
void _drawColor(QPainter* painter, Paint::ptr paint, std::map<uid, Mapping::ptr> mappings);
void _drawTexture(QPainter* painter, Paint::ptr paint, std::map<uid, Mapping::ptr> mappings);
};