public void CalculateBox() { Matrix Transforms = Matrix.CreateRotationX(modelRotation.X) * Matrix.CreateRotationY(modelRotation.Y) * Matrix.CreateRotationZ(modelRotation.Z) * Matrix.CreateTranslation(Position); /*if (Length + Width + Height > 1000) span = Length + Width + Height/5;*/ if (Length + Width + Height > 500) span = 100; else if (Length + Width + Height > 300) span = 50; else if (Length + Width + Height > 100) span = 15; else span = 3; //span = (Length + Width + Height) / 30; float endX = (this.Length > span) ? this.Length / 2 - (this.Length % span) : -this.Length / 2; float endY = (this.Height > span) ? this.Height / 2 - (this.Height % span) : -this.Height / 2; float endZ = (this.Width > span) ? this.Width / 2 - (this.Width % span) : -this.Width / 2; List<VertexPositionNormalColor> Positions = new List<VertexPositionNormalColor>(0); // Front Surface for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); } for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); } for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); } Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); // Back Surface for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, y, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, y + span, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, y, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, y, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, y + span, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, y + span, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); } for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, endY, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, endY, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, endY, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); } for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, y, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, y, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, y + span, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); } Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, endY, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, endY, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, -this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); // Left Surface for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y, z), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y + span, z), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y + span, z), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y + span, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); } for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, endY, z), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, endY, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, endY, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); } for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y + span, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y + span, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); } Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, endY, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); // Right Surface for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, z), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, z), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, z), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); } for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, z), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, z), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); } for (float y = -this.Height / 2; y + span <= this.Height / 2; y += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, y + span, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); } Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, endY, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); // Top Surface for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); } for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); } for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); } Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); // Bottom Surface for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, -this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, -this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, -this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, -this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, -this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, -this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); } for (float z = -this.Width / 2; z + span <= this.Width / 2; z += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, -this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, -this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -this.Height / 2, z), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, -this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -this.Height / 2, z + span), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); } for (float x = -this.Length / 2; x + span <= this.Length / 2; x += span) { Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, -this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, -this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, -this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, -this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x, -this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(x + span, -this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); } Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, -this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, -this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -this.Height / 2, endZ), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(endX, -this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); // Front Surface /* new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, 1), Transforms)), new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, 1), Transforms)), new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, 1), Transforms)), new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, 1), Transforms)), new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, 1), Transforms)), new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, 1), Transforms)), // Back Surface Positions.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, -1), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 0, -1), Transforms))); // Left Surface Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(-1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(-1, 0, 0), Transforms))); // Right Surface Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(1, 0, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(1, 0, 0), Transforms))); // Top Surface Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, 1, 0), Transforms))); // Bottom Surface Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, -1*this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(-1*this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, -1, 0), Transforms))); Positions.Add(new VertexPositionNormalColor(Vector3.Transform( new Vector3(this.Length/2, -1*this.Height/2, this.Width/2), Transforms),wallColor, Vector3.Transform( new Vector3(0, -1, 0), Transforms))); */ this.vertices = Positions; ScreenModel.BoundingBoxBuffers[] buffers = new ScreenModel.BoundingBoxBuffers[MovingBoxes.Count]; List<VertexPositionNormalColor> PositionsLowRes = new List<VertexPositionNormalColor>(0); // Front Surface PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, 1), Transforms))); // Back Surface PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 0, -1), Transforms))); // Left Surface PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(-1, 0, 0), Transforms))); // Right Surface PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(1, 0, 0), Transforms))); // Top Surface PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, 1, 0), Transforms))); // Bottom Surface PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, -1 * this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(-1 * this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); PositionsLowRes.Add(new VertexPositionNormalColor(Vector3.Transform(new Vector3(this.Length / 2, -1 * this.Height / 2, this.Width / 2), Transforms), wallColor, Vector3.Transform(new Vector3(0, -1, 0), Transforms))); verticesLowRes = PositionsLowRes; }
public void ShowBB() { //buffers = new BoundingBoxBuffers(MovingBox, device); int totalBuffers = 0; foreach (List<OrientedBoundingBox> MovingBoxes in BoundingBoxModels) totalBuffers += MovingBoxes.Count; ScreenModel.BoundingBoxBuffers[] buffers = new ScreenModel.BoundingBoxBuffers[totalBuffers]; int bufferCntr=0; for(int cntr=0; cntr<BoundingBoxModels.Count; cntr++) for (int cntr2 = 0; cntr2 < BoundingBoxModels[cntr].Count; cntr2++) buffers[bufferCntr++] = new ScreenModel.BoundingBoxBuffers(BoundingBoxModels[cntr][cntr2], GraphicsDevice); List<VertexPositionColor> verticesList = new List<VertexPositionColor>(); for (int x = 0; x < buffers.Length; x++) for (int y = 0; y < buffers[x].verticesList.Count; y++) verticesList.Add(buffers[x].verticesList[y]); VertexBuffer Vertices = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), verticesList.Count, BufferUsage.WriteOnly); Vertices.SetData(verticesList.ToArray()); IndexBuffer Indices = new IndexBuffer(GraphicsDevice, IndexElementSize.SixteenBits, verticesList.Count, BufferUsage.WriteOnly); Indices.SetData(Enumerable.Range(0, verticesList.Count).Select(i => (short)i).ToArray()); GraphicsDevice.SetVertexBuffer(Vertices); GraphicsDevice.Indices = Indices; /*BasicEffect lineEffect = new BasicEffect(GraphicsDevice); lineEffect.LightingEnabled = false; lineEffect.TextureEnabled = false; lineEffect.VertexColorEnabled = true;*/ effects.World = Matrix.Identity; effects.View = Matrix.CreateLookAt(MyPerson.CameraPosition, new Vector3(MyPerson.CameraPosition.X + MyPerson.CameraAngle3.X, MyPerson.CameraPosition.Y + MyPerson.CameraAngle3.Y, MyPerson.CameraPosition.Z + MyPerson.CameraAngle3.Z), Vector3.Up); effects.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), this.aspectRatio, DataValues.NearPlane, DataValues.FarPlane); foreach (EffectPass pass in effects.CurrentTechnique.Passes) { pass.Apply(); /*for (int x = 0; x < buffers.Length; x++) { GraphicsDevice.SetVertexBuffer(buffers[x].Vertices); GraphicsDevice.Indices = buffers[x].Indices;*/ GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, verticesList.Count, 0, verticesList.Count / 2); //} } }