示例#1
0
        /// <summary>
        /// Find leaf closest to point
        /// </summary>
        /// <param name="point">Point</param>
        public BSPTree FindNext(Point3D point)
        {
            switch (partition.Classify(point))
            {
            case Halfspace.Negative: return(back);

            case Halfspace.Positive: return(front);
            }

            return(null);
        }
示例#2
0
        /// <summary>
        /// Add mesh to model
        /// </summary>
        public void Render(MeshGeometry3D target, Point3D cameraPos, double alpha)
        {
            for (int posIndex = 0; posIndex < geometry.Positions.Count; posIndex += 4)
            {
                // Just get first vertex normal (assume all the same)
                Plane plane = new Plane(positions[posIndex], geometry.Normals[posIndex]);

                if (plane.Classify(cameraPos) == Halfspace.Positive)
                {
                    AddRectangleIndices(target);

                    for (int i = 0; i < 4; ++i)
                    {
                        // Add vertex positions
                        target.Positions.Add(positions[posIndex + i]);
                        target.TextureCoordinates.Add(new System.Windows.Point(((materialOffset - 0.5) * alpha) + 0.5, 0));
                    }
                }
            }
        }
示例#3
0
		/// <summary>
		/// Add mesh to model
		/// </summary>
		public void Render( MeshGeometry3D target, Point3D cameraPos, double alpha )
		{
			for ( int posIndex = 0; posIndex < geometry.Positions.Count; posIndex += 4 )
			{
				// Just get first vertex normal (assume all the same)
				Plane plane = new Plane( positions[ posIndex ], geometry.Normals[ posIndex ] );

				if ( plane.Classify( cameraPos ) == Halfspace.Positive )
				{
					AddRectangleIndices( target );

					for ( int i = 0; i < 4; ++ i )
					{
						// Add vertex positions
						target.Positions.Add( positions[ posIndex + i ] );
						target.TextureCoordinates.Add( new System.Windows.Point( ( ( materialOffset - 0.5 ) * alpha ) + 0.5, 0 ) );
					}
				}
			}
		}