EXT-2023 Camera floater: arrows became shifted when pressed

Cause:
The different between default texture size and size of the image has influenced on displacement of arrows at rotation.
Solution:
Transformation matrix has been changed to handle that different

--HG--
branch : product-engine
meow-7.2.2
Denis Serdjuk 2009-11-05 14:19:43 +02:00
parent 9ec38e7ef6
commit a0348b7e27
2 changed files with 19 additions and 10 deletions

View File

@ -517,43 +517,52 @@ void LLJoystickCameraRotate::draw()
LLGLSUIDefault gls_ui;
getImageUnselected()->draw( 0, 0 );
LLPointer<LLUIImage> image = getImageSelected();
if( mInTop )
{
drawRotatedImage( getImageSelected()->getImage(), 0 );
drawRotatedImage( getImageSelected(), 0 );
}
if( mInRight )
{
drawRotatedImage( getImageSelected()->getImage(), 1 );
drawRotatedImage( getImageSelected(), 1 );
}
if( mInBottom )
{
drawRotatedImage( getImageSelected()->getImage(), 2 );
drawRotatedImage( getImageSelected(), 2 );
}
if( mInLeft )
{
drawRotatedImage( getImageSelected()->getImage(), 3 );
drawRotatedImage( getImageSelected(), 3 );
}
}
// Draws image rotated by multiples of 90 degrees
void LLJoystickCameraRotate::drawRotatedImage( LLTexture* image, S32 rotations )
void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations )
{
S32 width = image->getWidth();
S32 height = image->getHeight();
LLTexture* texture = image->getImage();
/*
* Scale texture coordinate system
* to handle the different between image size and size of texture.
* If we will use default matrix,
* it may break texture mapping after rotation.
* see EXT-2023 Camera floater: arrows became shifted when pressed.
*/
F32 uv[][2] =
{
{ 1.f, 1.f },
{ 0.f, 1.f },
{ (F32)width/texture->getWidth(), (F32)height/texture->getHeight() },
{ 0.f, (F32)height/texture->getHeight() },
{ 0.f, 0.f },
{ 1.f, 0.f }
{ (F32)width/texture->getWidth(), 0.f }
};
gGL.getTexUnit(0)->bind(image);
gGL.getTexUnit(0)->bind(texture);
gGL.color4fv(UI_VERTEX_COLOR.mV);

View File

@ -150,7 +150,7 @@ public:
protected:
F32 getOrbitRate();
virtual void updateSlop();
void drawRotatedImage( LLTexture* image, S32 rotations );
void drawRotatedImage( LLPointer<LLUIImage> image, S32 rotations );
protected:
BOOL mInLeft;