hedgewars/uLandTexture.pas
changeset 6580 6155187bf599
parent 6383 c34a8b98d78c
child 6700 e04da46ee43c
equal deleted inserted replaced
6579:fc52f7c22c9b 6580:6155187bf599
    63 end;
    63 end;
    64 
    64 
    65 procedure UpdateLandTexture(X, Width, Y, Height: LongInt);
    65 procedure UpdateLandTexture(X, Width, Y, Height: LongInt);
    66 var tx, ty: Longword;
    66 var tx, ty: Longword;
    67 begin
    67 begin
    68     if (Width <= 0) or (Height <= 0) then exit;
    68     if (Width <= 0) or (Height <= 0) then
       
    69         exit;
    69     TryDo((X >= 0) and (X < LAND_WIDTH), 'UpdateLandTexture: wrong X parameter', true);
    70     TryDo((X >= 0) and (X < LAND_WIDTH), 'UpdateLandTexture: wrong X parameter', true);
    70     TryDo(X + Width <= LAND_WIDTH, 'UpdateLandTexture: wrong Width parameter', true);
    71     TryDo(X + Width <= LAND_WIDTH, 'UpdateLandTexture: wrong Width parameter', true);
    71     TryDo((Y >= 0) and (Y < LAND_HEIGHT), 'UpdateLandTexture: wrong Y parameter', true);
    72     TryDo((Y >= 0) and (Y < LAND_HEIGHT), 'UpdateLandTexture: wrong Y parameter', true);
    72     TryDo(Y + Height <= LAND_HEIGHT, 'UpdateLandTexture: wrong Height parameter', true);
    73     TryDo(Y + Height <= LAND_HEIGHT, 'UpdateLandTexture: wrong Height parameter', true);
    73 
    74 
    87 if LandTextures[0, 0].tex = nil then
    88 if LandTextures[0, 0].tex = nil then
    88     for x:= 0 to LANDTEXARW -1 do
    89     for x:= 0 to LANDTEXARW -1 do
    89         for y:= 0 to LANDTEXARH - 1 do
    90         for y:= 0 to LANDTEXARH - 1 do
    90             with LandTextures[x, y] do
    91             with LandTextures[x, y] do
    91                 begin
    92                 begin
    92                     tex:= NewTexture(TEXSIZE, TEXSIZE, Pixels(x, y));
    93                 tex:= NewTexture(TEXSIZE, TEXSIZE, Pixels(x, y));
    93                     glBindTexture(GL_TEXTURE_2D, tex^.id);
    94                 glBindTexture(GL_TEXTURE_2D, tex^.id);
    94                     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, tpHigh);
    95                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, tpHigh);
    95                 end
    96                 end
    96 else
    97 else
    97     for x:= 0 to LANDTEXARW -1 do
    98     for x:= 0 to LANDTEXARW -1 do
    98         for y:= 0 to LANDTEXARH - 1 do
    99         for y:= 0 to LANDTEXARH - 1 do
    99             with LandTextures[x, y] do
   100             with LandTextures[x, y] do