示例#1
0
        /// <summary>
        /// Creates a new <see cref="TerrainQuad"/>
        /// </summary>
        /// <param name="owner">The <see cref="TerrainNode"/> to which the terrain quadtree belongs.</param>
        /// <param name="parent">The <see cref="TerrainQuad"/> parent of this quad.</param>
        /// <param name="tx">The logical x coordinate of this quad.</param>
        /// <param name="ty">The logical y coordinate of this quad.</param>
        /// <param name="ox">The physical x coordinate of the lower left corner of this quad.</param>
        /// <param name="oy">The physical y coordinate of the lower left corner of this quad.</param>
        /// <param name="length">The physical size of this quad.</param>
        /// <param name="zmin">The minimum terrain elevation inside this quad.</param>
        /// <param name="zmax">The maximum terrain elevation inside this quad.</param>
        public TerrainQuad(TerrainNode owner, TerrainQuad parent, int tx, int ty, double ox, double oy, double length, float zmin, float zmax)
        {
            GUID = Guid.NewGuid();

            Owner          = owner;
            Parent         = parent;
            Level          = (Parent == null) ? 0 : Parent.Level + 1;
            Tx             = tx;
            Ty             = ty;
            Ox             = ox;
            Oy             = oy;
            ZMax           = zmax;
            ZMin           = zmin;
            Length         = length;
            LengthHalf     = length / 2.0;
            LocalBox       = new Box3d(Ox, Ox + Length, Oy, Oy + Length, ZMin, ZMax);
            DeformedOffset = new Vector4((float)Ox, (float)Oy, (float)Length, Level);

            DeformedBox    = new Vector3d[4];
            DeformedBox[0] = Owner.Deformation.LocalToDeformed(LocalBox.Min.x, LocalBox.Min.y, LocalBox.Min.z);
            DeformedBox[1] = Owner.Deformation.LocalToDeformed(LocalBox.Max.x, LocalBox.Min.y, LocalBox.Min.z);
            DeformedBox[2] = Owner.Deformation.LocalToDeformed(LocalBox.Max.x, LocalBox.Max.y, LocalBox.Min.z);
            DeformedBox[3] = Owner.Deformation.LocalToDeformed(LocalBox.Min.x, LocalBox.Max.y, LocalBox.Min.z);

            Order    = new byte[4];
            Order[0] = 0;
            Order[1] = 1;
            Order[2] = 2;
            Order[3] = 3;

            CalculateMatrices(ox, oy, length, owner.ParentBody.Size);
        }
示例#2
0
 /// <summary>
 /// Creates a new <see cref="TerrainQuad"/>
 /// </summary>
 /// <param name="owner">The <see cref="TerrainNode"/> to which the terrain quadtree belongs.</param>
 /// <param name="parent">The <see cref="TerrainQuad"/> parent of this quad.</param>
 /// <param name="tx">The logical x coordinate of this quad.</param>
 /// <param name="ty">The logical y coordinate of this quad.</param>
 /// <param name="ox">The physical x coordinate of the lower left corner of this quad.</param>
 /// <param name="oy">The physical y coordinate of the lower left corner of this quad.</param>
 /// <param name="length">The physical size of this quad.</param>
 /// <param name="zmin">The minimum terrain elevation inside this quad.</param>
 /// <param name="zmax">The maximum terrain elevation inside this quad.</param>
 public TerrainQuad(TerrainNode owner, TerrainQuad parent, int tx, int ty, double ox, double oy, double length, float zmin, float zmax)
 {
     Owner    = owner;
     Parent   = parent;
     Level    = (Parent == null) ? 0 : Parent.Level + 1;
     Tx       = tx;
     Ty       = ty;
     Ox       = ox;
     Oy       = oy;
     ZMax     = zmax;
     ZMin     = zmin;
     Length   = length;
     LocalBox = new Box3d(Ox, Ox + Length, Oy, Oy + Length, ZMin, ZMax);
 }
示例#3
0
        /// <summary>
        /// Creates a new <see cref="TerrainQuad"/>
        /// </summary>
        /// <param name="owner">The <see cref="TerrainNode"/> to which the terrain quadtree belongs.</param>
        /// <param name="parent">The <see cref="TerrainQuad"/> parent of this quad.</param>
        /// <param name="tx">The logical x coordinate of this quad.</param>
        /// <param name="ty">The logical y coordinate of this quad.</param>
        /// <param name="ox">The physical x coordinate of the lower left corner of this quad.</param>
        /// <param name="oy">The physical y coordinate of the lower left corner of this quad.</param>
        /// <param name="length">The physical size of this quad.</param>
        /// <param name="zmin">The minimum terrain elevation inside this quad.</param>
        /// <param name="zmax">The maximum terrain elevation inside this quad.</param>
        public TerrainQuad(TerrainNode owner, TerrainQuad parent, int tx, int ty, double ox, double oy, double length, float zmin, float zmax)
        {
            Owner      = owner;
            Parent     = parent;
            Level      = (Parent == null) ? 0 : Parent.Level + 1;
            Tx         = tx;
            Ty         = ty;
            Ox         = ox;
            Oy         = oy;
            ZMax       = zmax;
            ZMin       = zmin;
            Length     = length;
            LengthHalf = length / 2.0;
            LocalBox   = new Box3d(Ox, Ox + Length, Oy, Oy + Length, ZMin, ZMax);

            // TODO : Hm. Maybe too heavy for a ctor? Threading? Hueading?
            CalculateMatrices(ox, oy, length, owner.ParentBody.Size);
        }