protected void DrawRectangularTank(float length, float width, float height, float thickness, bool showWater = true, bool aeration = false, bool showInfo = false) { float fltX, fltY, fltZ; length *= ScaleFactor; width *= ScaleFactor; height *= ScaleFactor; thickness *= ScaleFactor; fScene.Translatef(0.0f, -height / 2, -width / 2); SetGlassMaterial(); var ld2 = length / 2.0f; var x1s = 0 - ld2; var x2s = 0 + ld2; var x1 = x1s; var x2 = x2s; // bottom var y1 = 0.0f; var y2 = y1 - thickness; var z1 = 0.0f; var z2 = z1 + width; DrawBox(x1, x2, y1, y2, z1, z2); // front y1 = 0.0f + height; y2 = 0.0f; z1 = 0.0f + width; z2 = z1 - thickness; DrawBox(x1, x2, y1, y2, z1, z2); fltX = x1; fltY = y1 + thickness; fltZ = z1; // back y1 = 0.0f + height; y2 = 0.0f; z1 = 0.0f; z2 = z1 + thickness; DrawBox(x1, x2, y1, y2, z1, z2); // sides y1 = 0.0f + height; y2 = 0.0f; z1 = 0.0f + thickness; z2 = z1 + (width - thickness * 2); // left side x1 = x1s; x2 = x1s + thickness; DrawBox(x1, x2, y1, y2, z1, z2); // right side x1 = x2s; x2 = x2s - thickness; DrawBox(x1, x2, y1, y2, z1, z2); // water cube var surfacedBubbles = new List <M3DBubble>(); float watHeight = height - thickness - (StdWaterOffset * ScaleFactor); var x1w = x1s + thickness; var x2w = x2s - thickness; var y1w = 0; var y2w = 0 + watHeight; var z1w = 0 + thickness; var z2w = 0 + width - thickness; if (!fWater.IsInitiated) { // top surface Point3D pt1t = new Point3D(x1w, y2w, z1w); Point3D pt2t = new Point3D(x2w, y2w, z1w); Point3D pt3t = new Point3D(x2w, y2w, z2w); Point3D pt4t = new Point3D(x1w, y2w, z2w); Point3D offset = new Point3D(0.0f, -height / 2, -width / 2); fWater.Initialize(new Point3D[] { pt1t, pt2t, pt3t, pt4t }, offset); } if (showWater) { SetWaterMaterial(); DrawBox(x1w, x2w, y1w, y2w, z1w, z2w, AllSidesWT); // without top (water) surface if (aeration) { var aeraPt = new Point3D(0.0f, 0.0f, width / 2.0f); fAeration.DrawBubbles(fScene, aeraPt, watHeight, surfacedBubbles); // surfacedBubbles: from aeration to water surface } fWater.Draw(fScene); } // required without condition! fWater.Next(surfacedBubbles, !aeration); // front left top point - for temperature if (showInfo) { fScene.DrawText("T: 25 °C", fltX, fltY, fltZ); } }