hedgewars/uLandTexture.pas
changeset 10268 1155384a4e31
parent 10267 237b403f92be
child 10269 2193bef70edf
equal deleted inserted replaced
10267:237b403f92be 10268:1155384a4e31
    90                 LandTextures[tx, ty].shouldUpdate:= true;
    90                 LandTextures[tx, ty].shouldUpdate:= true;
    91                 LandTextures[tx, ty].landAdded:= landAdded
    91                 LandTextures[tx, ty].landAdded:= landAdded
    92                 end
    92                 end
    93 end;
    93 end;
    94 
    94 
    95 procedure RealLandTexUpdate;
    95 procedure RealLandTexUpdate(x1, x2, y1, y2: LongInt);
    96 var x, y, ty, tx, lx, ly : LongWord;
    96 var x, y, ty, tx, lx, ly : LongWord;
    97     isEmpty: boolean;
    97     isEmpty: boolean;
    98 begin
    98 begin
    99     if cOnlyStats then exit;
    99     if cOnlyStats then exit;
   100 (*
   100 (*
   107                 glBindTexture(GL_TEXTURE_2D, tex^.id);
   107                 glBindTexture(GL_TEXTURE_2D, tex^.id);
   108                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, tpHigh);
   108                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, tpHigh);
   109                 end
   109                 end
   110 else
   110 else
   111 *)
   111 *)
   112     for x:= 0 to LANDTEXARW -1 do
   112     for x:= x1 to x2 do
   113         for y:= 0 to LANDTEXARH - 1 do
   113         for y:= y1 to y2 do
   114             with LandTextures[x, y] do
   114             with LandTextures[x, y] do
   115                 if shouldUpdate then
   115                 if shouldUpdate then
   116                     begin
   116                     begin
   117                     shouldUpdate:= false;
   117                     shouldUpdate:= false;
   118                     isEmpty:= not landAdded;
   118                     isEmpty:= not landAdded;
   175 procedure DrawLand(dX, dY: LongInt);
   175 procedure DrawLand(dX, dY: LongInt);
   176 var x, y, tX, ty, tSize, fx, lx, fy, ly: LongInt;
   176 var x, y, tX, ty, tSize, fx, lx, fy, ly: LongInt;
   177     tScale: GLfloat;
   177     tScale: GLfloat;
   178     overlap: boolean;
   178     overlap: boolean;
   179 begin
   179 begin
   180 RealLandTexUpdate;
       
   181 
       
   182 // init values based on quality settings
   180 // init values based on quality settings
   183 if (cReducedQuality and rqBlurryLand) <> 0 then
   181 if (cReducedQuality and rqBlurryLand) <> 0 then
   184     begin
   182     begin
   185     tSize:= TEXSIZE * 2;
   183     tSize:= TEXSIZE * 2;
   186     tScale:= 2.0;
   184     tScale:= 2.0;
   224 
   222 
   225 // all offscreen
   223 // all offscreen
   226 if (fy > ly) then
   224 if (fy > ly) then
   227     exit;
   225     exit;
   228 
   226 
       
   227 RealLandTexUpdate(fx, lx, fy, ly);
       
   228 
   229 tX:= dX + tsize * fx;
   229 tX:= dX + tsize * fx;
   230 
   230 
   231 // loop through columns
   231 // loop through columns
   232 for x:= fx to lx do
   232 for x:= fx to lx do
   233     begin
   233     begin