hedgewars/uRender.pas
changeset 10040 4ac87acbaed9
parent 10015 4feced261c68
parent 10020 67e127027af6
child 10108 c68cf030eded
equal deleted inserted replaced
10019:c00db97a668f 10040:4ac87acbaed9
    32 procedure DrawSpriteRotated     (Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
    32 procedure DrawSpriteRotated     (Sprite: TSprite; X, Y, Dir: LongInt; Angle: real);
    33 procedure DrawSpriteRotatedF    (Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
    33 procedure DrawSpriteRotatedF    (Sprite: TSprite; X, Y, Frame, Dir: LongInt; Angle: real);
    34 
    34 
    35 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture); inline;
    35 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture); inline;
    36 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture; Scale: GLfloat);
    36 procedure DrawTexture           (X, Y: LongInt; Texture: PTexture; Scale: GLfloat);
       
    37 procedure DrawTexture2          (X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat);
    37 procedure DrawTextureFromRect   (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
    38 procedure DrawTextureFromRect   (X, Y: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
    38 procedure DrawTextureFromRect   (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
    39 procedure DrawTextureFromRect   (X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture); inline;
    39 procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture; Dir: LongInt);
    40 procedure DrawTextureFromRectDir(X, Y, W, H: LongInt; r: PSDL_Rect; SourceTexture: PTexture; Dir: LongInt);
    40 procedure DrawTextureCentered   (X, Top: LongInt; Source: PTexture);
    41 procedure DrawTextureCentered   (X, Top: LongInt; Source: PTexture);
    41 procedure DrawTextureF          (Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
    42 procedure DrawTextureF          (Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
   179 glPopMatrix;
   180 glPopMatrix;
   180 {$ENDIF}
   181 {$ENDIF}
   181 
   182 
   182 end;
   183 end;
   183 
   184 
       
   185 { this contains tweaks in order to avoid land tile borders in blurry land mode }
       
   186 procedure DrawTexture2(X, Y: LongInt; Texture: PTexture; Scale, Overlap: GLfloat);
       
   187 var
       
   188     TextureBuffer: array [0..3] of TVertex2f;
       
   189 begin
       
   190 glPushMatrix();
       
   191 glTranslatef(X, Y, 0);
       
   192 glScalef(Scale, Scale, 1);
       
   193 
       
   194 glBindTexture(GL_TEXTURE_2D, Texture^.id);
       
   195 
       
   196 TextureBuffer[0].X:= Texture^.tb[0].X + Overlap;
       
   197 TextureBuffer[0].Y:= Texture^.tb[0].Y + Overlap;
       
   198 TextureBuffer[1].X:= Texture^.tb[1].X - Overlap;
       
   199 TextureBuffer[1].Y:= Texture^.tb[1].Y + Overlap;
       
   200 TextureBuffer[2].X:= Texture^.tb[2].X - Overlap;
       
   201 TextureBuffer[2].Y:= Texture^.tb[2].Y - Overlap;
       
   202 TextureBuffer[3].X:= Texture^.tb[3].X + Overlap;
       
   203 TextureBuffer[3].Y:= Texture^.tb[3].Y - Overlap;
       
   204 
       
   205 glVertexPointer(2, GL_FLOAT, 0, @Texture^.vb);
       
   206 glTexCoordPointer(2, GL_FLOAT, 0, @TextureBuffer);
       
   207 glDrawArrays(GL_TRIANGLE_FAN, 0, Length(Texture^.vb));
       
   208 
       
   209 glPopMatrix();
       
   210 end;
       
   211 
   184 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
   212 procedure DrawTextureF(Texture: PTexture; Scale: GLfloat; X, Y, Frame, Dir, w, h: LongInt);
   185 begin
   213 begin
   186     DrawTextureRotatedF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0)
   214     DrawTextureRotatedF(Texture, Scale, 0, 0, X, Y, Frame, Dir, w, h, 0)
   187 end;
   215 end;
   188 
   216