using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;
using System.Drawing;

namespace DirectXEksempel07
{
    class Building : ModelComponent
    {
        private Mesh mesh;
        private Color theColor;
        private Device theDevice;

        public Building(Device aDevice, Vector3 aPosition, Color aColor, 
            float aWidth, float aHeight, float aDepth) : base(aPosition)
        {
            theDevice = aDevice;
            mesh = Mesh.Box(theDevice, aWidth, aHeight, aDepth);
            theColor = aColor;
        }

        public void Render()
        {
            Material meshMaterial = new Material();
            meshMaterial.AmbientColor = new ColorValue(theColor.R, theColor.G, theColor.B);
            meshMaterial.DiffuseColor = new ColorValue(theColor.R, theColor.G, theColor.B);
            theDevice.Transform.World = Matrix.Translation(Position);
            theDevice.Material = meshMaterial;
            theDevice.SetTexture(0, null);
            mesh.DrawSubset(0);
        }

    }
}
