Exemplo n.º 1
0
 private void DrawBillboard(Billboard entity)
 {
     inverseView = device.CameraInvertedViewMatrix;
     look        = inverseView.Translation - entity.Position;
     AlignBillboard(entity);
     DrawGeometry(entity);
 }
Exemplo n.º 2
0
		private void DrawBillboard(Billboard entity)
		{
			inverseView = device.CameraInvertedViewMatrix;
			look = inverseView.Translation - entity.Position;
			AlignBillboard(entity);
			DrawGeometry(entity);
		}
Exemplo n.º 3
0
		private void DrawGeometry(Billboard entity)
		{
			look.Normalize();
			Vector3D right = Vector3D.Cross(cameraUp, look);
			Vector3D up = Vector3D.Cross(look, right);
			Matrix transform = Matrix.Identity;
			transform.Right = right;
			transform.Up = look;
			transform.Forward = up;
			transform.Translation = entity.Position;
			drawing.AddGeometry(entity.planeQuad.Geometry, entity.planeQuad.Material, transform);
		}
Exemplo n.º 4
0
        private void DrawGeometry(Billboard entity)
        {
            look.Normalize();
            Vector3D right     = Vector3D.Cross(cameraUp, look);
            Vector3D up        = Vector3D.Cross(look, right);
            Matrix   transform = Matrix.Identity;

            transform.Right       = right;
            transform.Up          = look;
            transform.Forward     = up;
            transform.Translation = entity.Position;
            drawing.AddGeometry(entity.planeQuad.Geometry, entity.planeQuad.Material, transform);
        }
Exemplo n.º 5
0
		private void AlignBillboard(Billboard entity)
		{
			if ((entity.mode & BillboardMode.FrontAxis) != 0)
				AlignBillboardFrontAxis();
			else if ((entity.mode & BillboardMode.UpAxis) != 0)
				AlignBillboardUpAxis();
			else if ((entity.mode & BillboardMode.RightAxis) != 0)
				AlignBillboardRightAxis();
			else if ((entity.mode & BillboardMode.Ground) != 0)
				AlignBillboardGroundAxis();
			else
				DrawBillboardUnaligned();
		}
Exemplo n.º 6
0
		protected override void Preview(string contentName)
		{
			var material = ContentLoader.Load<Material>(contentName);
			var shaderWithFormat = material.Shader as ShaderWithFormat;
			if (!shaderWithFormat.Format.Is3D)
			{
				var imageSize = material.DiffuseMap.PixelSize;
				var aspectRatio = imageSize.Height / imageSize.Width;
				currentDisplayEntity = new Sprite(material,
					Rectangle.FromCenter(new Vector2D(0.5f, 0.5f), new Size(0.5f, 0.5f * aspectRatio)));
			}
			else if (shaderWithFormat.Format.HasUV)
				currentDisplayEntity = new Billboard(Vector3D.Zero, Size.One, material);
		}
Exemplo n.º 7
0
 private void AlignBillboard(Billboard entity)
 {
     if ((entity.mode & BillboardMode.FrontAxis) != 0)
     {
         AlignBillboardFrontAxis();
     }
     else if ((entity.mode & BillboardMode.UpAxis) != 0)
     {
         AlignBillboardUpAxis();
     }
     else if ((entity.mode & BillboardMode.RightAxis) != 0)
     {
         AlignBillboardRightAxis();
     }
     else if ((entity.mode & BillboardMode.Ground) != 0)
     {
         AlignBillboardGroundAxis();
     }
     else
     {
         DrawBillboardUnaligned();
     }
 }