public ModellManager(Device renderDevice) { this.renderDevice = renderDevice; antMaterial = new Dictionary <int, Material>(); markerMaterials = new Dictionary <int, Material>(); colorFinder = new ColorFinder(); playgroundMaterial = new Material(); playgroundMaterial.Ambient = Color.FromArgb(114, 114, 73); playgroundMaterial.Emissive = Color.FromArgb(90, 90, 58); playgroundMaterial.Specular = Color.FromArgb(114, 114, 73); colorFinder.BelegeFarbe(new Farbe(114, 114, 73)); sugarMaterial = new Material(); sugarMaterial.Emissive = Color.FromArgb(200, 200, 200); sugarMaterial.Specular = Color.FromArgb(255, 255, 255); colorFinder.BelegeFarbe(new Farbe(200, 200, 200)); bugMaterial = new Material(); bugMaterial.Emissive = Color.DarkBlue; bugMaterial.Specular = Color.FromArgb(0, 0, 150); colorFinder.BelegeFarbe(new Farbe(Color.DarkBlue.R, Color.DarkBlue.G, Color.DarkBlue.B)); fruitMaterial = new Material(); fruitMaterial.Emissive = Color.Green; fruitMaterial.Specular = Color.FromArgb(0, 255, 0); colorFinder.BelegeFarbe(new Farbe(Color.Green.R, Color.Green.G, Color.Green.B)); selectionMaterial = new Material(); selectionMaterial.Emissive = Color.FromArgb(120, 0, 0); selectionMaterial.Specular = Color.Red; fontNormal = new Font(renderDevice, new System.Drawing.Font(FONTFAMILY, FONTSIZE, FontStyle.Regular)); fontBold = new Font(renderDevice, new System.Drawing.Font(FONTFAMILY, FONTSIZE, FontStyle.Bold)); line = new Line(renderDevice); createResources(); }
/// <summary> /// Prepares all needed Colony-Materials /// </summary> /// <param name="colony">Colony-ID</param> public void PrepareColony(int colony) { if (!antMaterial.ContainsKey(colony)) { // choose another color Farbe color; switch (colony) { case 0: color = new Farbe(0, 0, 0); break; case 1: color = new Farbe(255, 0, 0); break; case 2: color = new Farbe(0, 0, 255); break; case 3: color = new Farbe(255, 255, 0); break; default: color = colorFinder.ErzeugeFarbe(); break; } colorFinder.BelegeFarbe(color); // Material for ants and flag Material material = new Material(); material.Emissive = Color.FromArgb(color.Rot, color.Grün, color.Blau); material.Specular = Color.FromArgb(200, 200, 200); antMaterial.Add(colony, material); // Material for markers material = new Material(); material.Ambient = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau); material.Diffuse = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau); material.Emissive = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau); material.Specular = Color.FromArgb(MARKERTRANSPARENCY, color.Rot, color.Grün, color.Blau); markerMaterials.Add(colony, material); } }