hedgewars/uWorld.pas
changeset 10321 863663e1b3fd
parent 10320 0f9ad60f738c
child 10322 6f1f8515181c
equal deleted inserted replaced
10320:0f9ad60f738c 10321:863663e1b3fd
   965     end
   965     end
   966 else // weSea: with waterwalls
   966 else // weSea: with waterwalls
   967     begin
   967     begin
   968     topy := cWaterLine + WorldDy;
   968     topy := cWaterLine + WorldDy;
   969 
   969 
   970     // for GL_TRIANGLE_STRIP
   970     // We will draw both bottom water and the water walls with a single call,
       
   971     // by rendering a GL_TRIANGLE_STRIP of eight points.
       
   972     //
       
   973     // GL_TRIANGLE_STRIP works like this: "always create triangle between
       
   974     // newest point and the two points that were specified before it."
       
   975     //
       
   976     // To get the result we want we will order the points like this:
       
   977     //                                                                  ^ -Y
       
   978     //                                                                  |
       
   979     //   0-------1         7-------6  <---------------------- ViewTopY -|
       
   980     //   |      /|         |     _/|                                    |
       
   981     //   |     / |         |    /  |                                    |
       
   982     //   |    /  |         |  _/   |                                    |
       
   983     //   |   /   |         | /     |                                    |
       
   984     //   |  /  _.3---------5{      |  <--- topy = cWaterLine + WorldDy -|
       
   985     //   | / _/   `---.___   `--._ |                                    |
       
   986     //   |/_/             `---.___\|                                    |
       
   987     //   2-------------------------4  <------------ topy + wave height -|
       
   988     //                                                                  |
       
   989     //   ^       ^         ^       ^                                    V +Y
       
   990     //   |       |         |       |
       
   991     //   |       |         |     RightX + WorldDx + wave height
       
   992     //   |       |         |       .
       
   993     //   |       | RightX + WorldDx.
       
   994     //   |       |         .       .
       
   995     //   | LeftX + WorldDx .       .
       
   996     //   |       .         .       .
       
   997     // LeftX - wave height + WorldDx
       
   998     //   |       .         .       .
       
   999     // <-------------------------------->
       
  1000     // -X                              +X
       
  1001     //
       
  1002     // Note: additionally the parameters ox and dy are used to create different
       
  1003     // horizontal and vertical offsets between wave layers
       
  1004 
   971 
  1005 
   972     VertexBuffer[0].X:= LeftX + WorldDx - SpritesData[sprite].Height - ox;
  1006     VertexBuffer[0].X:= LeftX + WorldDx - SpritesData[sprite].Height - ox;
   973     VertexBuffer[0].Y:= ViewTopY;
  1007     VertexBuffer[0].Y:= ViewTopY;
   974     VertexBuffer[1].X:= LeftX + WorldDx - ox;
  1008     VertexBuffer[1].X:= LeftX + WorldDx - ox;
   975     VertexBuffer[1].Y:= ViewTopY;
  1009     VertexBuffer[1].Y:= ViewTopY;