aboutsummaryrefslogtreecommitdiff
path: root/hge/graphics.cpp
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-17 02:43:16 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-17 02:43:16 +0000
commitfd7ea15571b43dcacc7a88cf720fb7e103f19042 (patch)
tree7f28250bc328f5ac4c8d6e0358b19d9b05941508 /hge/graphics.cpp
parent856c345feca062fdfc0b177e0de25489fb1b0c06 (diff)
downloadbullet-lab-remix-fd7ea15571b43dcacc7a88cf720fb7e103f19042.tar.xz
Partly revert r50, removing HGE::Gfx_SetTDRotate and fixing HGE::Gfx_SetTransform.
3D Rotate is blinking and not really working. However another method HGE::Gfx_SetTransform3D is planned. Switching between orthographic and perspective is also required.
Diffstat (limited to 'hge/graphics.cpp')
-rw-r--r--hge/graphics.cpp43
1 files changed, 13 insertions, 30 deletions
diff --git a/hge/graphics.cpp b/hge/graphics.cpp
index 9688024..6ee9578 100644
--- a/hge/graphics.cpp
+++ b/hge/graphics.cpp
@@ -230,43 +230,26 @@ void CALL HGE_Impl::Gfx_SetClipping(int x, int y, int w, int h)
void CALL HGE_Impl::Gfx_SetTransform(float x, float y, float dx, float dy, float rot, float hscale, float vscale)
{
- if (!bTransforming)
+ if ((x == 0.0f) && (y == 0.0f) && (dx == 0.0f) && (dy == 0.0f) && (rot == 0.0f) && (hscale == 0.0f) && (vscale == 0.0f))
{
- if ((x == 0.0f) && (y == 0.0f) && (dx == 0.0f) && (dy == 0.0f) && (rot == 0.0f) && (hscale == 1.0f) && (vscale == 1.0f))
- return; // nothing to do here, don't call into the GL.
- }
-
- _render_batch();
-
- bTransforming = true;
-
- // !!! FIXME: this math is probably wrong. Re-sync with the Direct3D code.
-
- pOpenGLDevice->glMatrixMode(GL_MODELVIEW);
- if(vscale==0.0f) pOpenGLDevice->glLoadIdentity();
- else
- {
- pOpenGLDevice->glTranslatef(-x, -y, 0.0f);
- //pOpenGLDevice->glScalef(1.0f, -1.0f, 1.0f);
- pOpenGLDevice->glRotatef(-rot, 0.0f, 0.0f, -1.0f);
- pOpenGLDevice->glTranslatef(x+dx, y+dy, 0.0f);
- }
-}
-
-void CALL HGE_Impl::Gfx_SetTDRotate(float ang, float x, float y, float z)
-{
- if (!bTransforming)
- {
- if ((x == 0.0f) && (y == 0.0f) && (z == 0.0f) && (ang == 0.0f))
- return; // nothing to do here, don't call into the GL.
+ //reset everything
+ pOpenGLDevice->glMatrixMode(GL_MODELVIEW);
+ pOpenGLDevice->glLoadIdentity();
+ bTransforming=false;
+ return;
}
_render_batch();
-
bTransforming = true;
pOpenGLDevice->glMatrixMode(GL_MODELVIEW);
- pOpenGLDevice->glRotatef(ang, x, y, z);
+ //we have to reset the matrix in all cases.
+ //or this would cause insane transforming...
+ pOpenGLDevice->glLoadIdentity();
+ pOpenGLDevice->glTranslatef(-x, -y, 0.0f);
+ pOpenGLDevice->glScalef(hscale, vscale, 1.0f);
+ pOpenGLDevice->glRotatef(rot, 0.0f, 0.0f, 1.0f);
+ pOpenGLDevice->glTranslatef(x+dx, y+dy, 0.0f);
}
bool CALL HGE_Impl::Gfx_BeginScene(HTARGET targ)