public static void DrawAllSlots(int uModelLocation, int shaderID, List <Marble> marbles, bool highlightMarbles, Camera camera, float defaultSpecularPower) { List <int> emptySlots = new List <int>(); for (int i = 0; i < STARTING_COUNT; i++) { emptySlots.Add(i); } foreach (Marble m in marbles) { m.Draw(uModelLocation, shaderID, highlightMarbles, camera, defaultSpecularPower); if (m.Alive) { emptySlots.Remove(m.PositionSlot); } } var transparentObjects = new List <TransparentObject>(); foreach (int i in emptySlots) { transparentObjects.Add(new TransparentObject(TransparentObjectType.EmptySlot, i)); } Game.SetLightingEnabled(shaderID, true); Vector3 oldAmbient = MaterialProperties.CurrentAmbient; Vector3 oldDiffuse = MaterialProperties.CurrentDiffuse; //MaterialProperties.SetAmbient(shaderID, new Vector3(1.375f)); //MaterialProperties.SetDiffuse(shaderID, Vector3.Zero); MaterialProperties.Set(shaderID, new Vector3(1f), Vector3.Zero, Vector3.Zero, 1f); //Game.SetDrawColour(shaderID, new Color4(1f, 1f, 1f, 0.3f)); foreach (Marble m in marbles) { if ((m.Alive || m.AnimateFromSlot >= 0) && CelestialBodies[m.Type].RingTexture != null) { transparentObjects.Add(new TransparentObject(TransparentObjectType.Ring, m.PositionSlot, m)); } } if (transparentObjects.Any()) { transparentObjects = transparentObjects.OrderByDescending(o => { Vector3 position; switch (o.Type) { case TransparentObjectType.EmptySlot: position = Position(o.Slot); break; case TransparentObjectType.Ring: position = o.MarbleObject.Position(); break; default: throw new Exception(); } return(Utils.Distance(camera.Position, position)); }).ToList(); foreach (TransparentObject o in transparentObjects) { switch (o.Type) { case TransparentObjectType.EmptySlot: GL.Enable(EnableCap.CullFace); Game.SetLightingEnabled(shaderID, false); Game.SetTexturesEnabled(shaderID, false); Color4 colour; if (SlotIsValid(o.Slot, marbles)) { if (HighlightedSlot == o.Slot) { colour = new Color4(1f, 0.75f, 0f, 0.75f); // Yellow/orange } else { colour = new Color4(1f, 0f, 0f, 0.625f); // Red } } else { colour = new Color4(1f, 1f, 1f, 0.375f); // Light grey } Game.SetDrawColour(shaderID, colour); Vector3 position = Position(o.Slot); if (Utils.Distance(camera.Position, position) > 0.375f + CLIPPING_DISTANCE) { DrawStatic(uModelLocation, shaderID, o.Slot, Matrix4.CreateScale(0.375f) * Matrix4.CreateTranslation(position), true, highlightMarbles); } break; case TransparentObjectType.Ring: GL.Disable(EnableCap.CullFace); Game.SetDrawColour(shaderID, Color4.White); Game.SetLightingEnabled(shaderID, true); Game.SetTexturesEnabled(shaderID, true); o.MarbleObject.DrawRing(uModelLocation, shaderID); break; default: throw new Exception(); } } Game.SetDrawColour(shaderID, Color4.White); Game.SetLightingEnabled(shaderID, true); Game.SetTexturesEnabled(shaderID, true); GL.Enable(EnableCap.CullFace); } //Game.SetDrawColour(shaderID, Color4.White); MaterialProperties.SetAmbient(shaderID, oldAmbient); MaterialProperties.SetDiffuse(shaderID, oldDiffuse); //Model.Bind(shaderID); }