summaryrefslogtreecommitdiffhomepage
path: root/pose-widget/glwidget.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-08-31 07:34:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-08-31 07:34:52 +0200
commitade85a7c5cd9ece75e0f1dbadf6417b71198fb38 (patch)
tree563aa181b3ebb9ef1dc6a569e88bd158ea24edba /pose-widget/glwidget.cpp
parenta96479b20513716114cffbd414c7868118304a71 (diff)
pose-widget: simplify
Diffstat (limited to 'pose-widget/glwidget.cpp')
-rw-r--r--pose-widget/glwidget.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp
index 61b88b80..2cb858d7 100644
--- a/pose-widget/glwidget.cpp
+++ b/pose-widget/glwidget.cpp
@@ -105,11 +105,8 @@ void GLWidget::project_quad_texture() {
vec3(sx-1, sy-1, 0.)
};
- for (int i = 0; i < 4; i++) {
- pt[i] = project(vec3(corners[i].x() - sx/2, corners[i].y() - sy/2, 0));
- pt[i].x() += sx/2.;
- pt[i].y() += sy/2.;
- }
+ for (int i = 0; i < 4; i++)
+ pt[i] = project(vec3(corners[i].x() - sx/2, corners[i].y() - sy/2, 0)) + vec2(sx/2, sy/2);
vec3 normal1(0, 0, 1);
vec3 normal2;
@@ -126,15 +123,11 @@ void GLWidget::project_quad_texture() {
int ow = tex.width(), oh = tex.height();
- vec2 p2[4];
-
- for (int i = 0; i < 4; i++)
- p2[i] = vec2(pt[i].x(), pt[i].y());
QImage texture(QSize(sx, sy), QImage::Format_RGB888);
QColor bgColor = palette().color(QPalette::Current, QPalette::Window);
texture.fill(bgColor);
- const vec2 projected[2][3] = { { p2[0], p2[1], p2[2] }, { p2[3], p2[1], p2[2] } };
+ const vec2 projected[2][3] = { { pt[0], pt[1], pt[2] }, { pt[3], pt[1], pt[2] } };
const vec2 origs[2][3] = {
{ vec2(0, 0), vec2(ow-1, 0), vec2(0, oh-1) },
{ vec2(ow-1, oh-1), vec2(ow-1, 0), vec2(0, oh-1) }