hedgewars/uRender.pas
changeset 10431 d8830bd7cb24
parent 10429 e3cdbba07732
child 10494 0eb97cf4c78e
equal deleted inserted replaced
10429:e3cdbba07732 10431:d8830bd7cb24
   847 
   847 
   848 procedure DrawTextureRotatedF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real);
   848 procedure DrawTextureRotatedF(Texture: PTexture; Scale, OffsetX, OffsetY: GLfloat; X, Y, Frame, Dir, w, h: LongInt; Angle: real);
   849 var ft, fb, fl, fr: GLfloat;
   849 var ft, fb, fl, fr: GLfloat;
   850     hw, hh, nx, ny: LongInt;
   850     hw, hh, nx, ny: LongInt;
   851 begin
   851 begin
   852 
   852 // visibility check only under trivial conditions
   853 // note: not taking scale into account
   853 if (Scale <= 1) then
   854 if isAreaOffscreen(X, Y, w, h) then
   854     begin
   855     exit;
   855     if Angle <> 0  then
       
   856         begin
       
   857         if (OffsetX = 0) and (OffsetY = 0) then
       
   858             begin
       
   859             // sized doubled because the sprite might occupy up to 1.4 * of it's
       
   860             // original size in each dimension, because it is rotated
       
   861             if isDxAreaOffscreen(X - w, 2 * w) <> 0 then
       
   862                 exit;
       
   863             if isDYAreaOffscreen(Y - h, 2 * h) <> 0 then
       
   864                 exit;
       
   865             end;
       
   866         end
       
   867     else
       
   868         begin
       
   869         if isDxAreaOffscreen(X + dir * trunc(OffsetX) - w div 2, w) <> 0 then
       
   870             exit;
       
   871         if isDYAreaOffscreen(Y + trunc(OffsetY) - h div 2, h) <> 0 then
       
   872             exit;
       
   873         end;
       
   874     end;
   856 
   875 
   857 {
   876 {
   858 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   877 // do not draw anything outside the visible screen space (first check fixes some sprite drawing, e.g. hedgehogs)
   859 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * 2 > ViewWidth) then
   878 if (abs(X) > W) and ((abs(X + dir * OffsetX) - W / 2) * 2 > ViewWidth) then
   860     exit;
   879     exit;