hedgewars/uRender.pas
changeset 10331 cb6c33839d2a
parent 10330 3ec09243cb55
child 10333 e1253205eb7e
equal deleted inserted replaced
10330:3ec09243cb55 10331:cb6c33839d2a
  1319 procedure PrepareVbForWater(
  1319 procedure PrepareVbForWater(
  1320     WithWalls: Boolean;
  1320     WithWalls: Boolean;
  1321     InTopY, OutTopY, InLeftX, OutLeftX, InRightX, OutRightX, BottomY: LongInt;
  1321     InTopY, OutTopY, InLeftX, OutLeftX, InRightX, OutRightX, BottomY: LongInt;
  1322     out first, count: LongInt);
  1322     out first, count: LongInt);
  1323 
  1323 
  1324 var firsti, afteri: LongInt;
  1324 var firsti, afteri, lol: LongInt;
  1325 begin
  1325 begin
  1326 
  1326 
  1327     // We will draw both bottom water and the water walls with a single call,
  1327     // We will draw both bottom water and the water walls with a single call,
  1328     // by rendering a GL_TRIANGLE_STRIP of eight points.
  1328     // by rendering a GL_TRIANGLE_STRIP of eight points.
  1329     //
  1329     //
  1358     //
  1358     //
  1359 
  1359 
  1360 firsti:= -1;
  1360 firsti:= -1;
  1361 afteri:=  0;
  1361 afteri:=  0;
  1362 
  1362 
       
  1363 if GameTicks < 2000 then
       
  1364     lol:= 2000 - GameTicks
       
  1365 else
       
  1366     lol:= 0;
       
  1367 
  1363 if InTopY < 0 then
  1368 if InTopY < 0 then
  1364     InTopY:= 0;
  1369     InTopY:= 0;
  1365 
  1370 
  1366 if not WithWalls then
  1371 if not WithWalls then
  1367     begin
  1372     begin
  1371     end
  1376     end
  1372 else
  1377 else
  1373     begin
  1378     begin
  1374     if InLeftX > OutLeftX then
  1379     if InLeftX > OutLeftX then
  1375         begin
  1380         begin
  1376         VertexBuffer[0].X:= OutLeftX;
  1381         VertexBuffer[0].X:= OutLeftX - lol;
  1377         VertexBuffer[0].Y:= OutTopY;
  1382         VertexBuffer[0].Y:= OutTopY;
  1378         VertexBuffer[1].X:= InLeftX;
  1383         VertexBuffer[1].X:= InLeftX - lol;
  1379         VertexBuffer[1].Y:= OutTopY;
  1384         VertexBuffer[1].Y:= OutTopY;
  1380         // shares vertices 2 and 3 with bottom water
  1385         // shares vertices 2 and 3 with bottom water
  1381         firsti:= 0;
  1386         firsti:= 0;
  1382         afteri:= 4;
  1387         afteri:= 4;
  1383         end;
  1388         end;
  1384 
  1389 
  1385     if InRightX < OutRightX then
  1390     if InRightX < OutRightX then
  1386         begin
  1391         begin
  1387         VertexBuffer[6].X:= OutRightX;
  1392         VertexBuffer[6].X:= OutRightX + lol;
  1388         VertexBuffer[6].Y:= OutTopY;
  1393         VertexBuffer[6].Y:= OutTopY;
  1389         VertexBuffer[7].X:= InRightX;
  1394         VertexBuffer[7].X:= InRightX + lol;
  1390         VertexBuffer[7].Y:= OutTopY;
  1395         VertexBuffer[7].Y:= OutTopY;
  1391         // shares vertices 4 and 5 with bottom water
  1396         // shares vertices 4 and 5 with bottom water
  1392         if firsti < 0 then
  1397         if firsti < 0 then
  1393             firsti:= 4;
  1398             firsti:= 4;
  1394         afteri:= 8;
  1399         afteri:= 8;