Пример #1
0
		/// <summary>
		/// Add the 9 vertices for this quad
		/// </summary>
		private void AddVertices()
		{
			switch (NodeType)
			{
				case NodeType.TopLeft:
					VertexTopLeft = _parent.VertexTopLeft;
					VertexTopRight = _parent.VertexTop;
					VertexBottomLeft = _parent.VertexLeft;
					VertexBottomRight = _parent.VertexCenter;
					break;

				case NodeType.TopRight:
					VertexTopLeft = _parent.VertexTop;
					VertexTopRight = _parent.VertexTopRight;
					VertexBottomLeft = _parent.VertexCenter;
					VertexBottomRight = _parent.VertexRight;
					break;

				case NodeType.BottomLeft:
					VertexTopLeft = _parent.VertexLeft;
					VertexTopRight = _parent.VertexCenter;
					VertexBottomLeft = _parent.VertexBottomLeft;
					VertexBottomRight = _parent.VertexBottom;
					break;

				case NodeType.BottomRight:
					VertexTopLeft = _parent.VertexCenter;
					VertexTopRight = _parent.VertexRight;
					VertexBottomLeft = _parent.VertexBottom;
					VertexBottomRight = _parent.VertexBottomRight;
					break;

				default:
					VertexTopLeft = new QuadNodeVertex
					{
						Activated = true, 
						Index = 0
					};

					VertexTopRight = new QuadNodeVertex
					{
					    Activated = true,
					    Index = VertexTopLeft.Index + _nodeSize
					};

					VertexBottomLeft = new QuadNodeVertex
					{
					    Activated = true,
					    Index = (_nodeSize + 1) * _parentTree.TopNodeSize
					};

					VertexBottomRight = new QuadNodeVertex
					{
					    Activated = true,
					    Index = VertexBottomLeft.Index + _nodeSize
					};

					break;
			}

			VertexTop = new QuadNodeVertex
			{
				Activated = false,
				Index = VertexTopLeft.Index + (_nodeSize / 2)
			};

			VertexLeft = new QuadNodeVertex
			{ 
				Activated = false,
				Index = VertexTopLeft.Index + (_parentTree.TopNodeSize + 1) * (_nodeSize / 2) 
			};

			VertexCenter = new QuadNodeVertex
			{
				Activated = false,
				Index = VertexLeft.Index + (_nodeSize / 2)
			};

			VertexRight = new QuadNodeVertex
			{ 
				Activated = false, Index = VertexLeft.Index + _nodeSize
			};

			VertexBottom = new QuadNodeVertex
			{
				Activated = false,
				Index = VertexBottomLeft.Index + (_nodeSize / 2)
			};
		}
Пример #2
0
        /// <summary>
        /// Add the 9 vertices for this quad
        /// </summary>
        private void AddVertices()
        {
            switch (NodeType)
            {
            case NodeType.TopLeft:
                VertexTopLeft     = _parent.VertexTopLeft;
                VertexTopRight    = _parent.VertexTop;
                VertexBottomLeft  = _parent.VertexLeft;
                VertexBottomRight = _parent.VertexCenter;
                break;

            case NodeType.TopRight:
                VertexTopLeft     = _parent.VertexTop;
                VertexTopRight    = _parent.VertexTopRight;
                VertexBottomLeft  = _parent.VertexCenter;
                VertexBottomRight = _parent.VertexRight;
                break;

            case NodeType.BottomLeft:
                VertexTopLeft     = _parent.VertexLeft;
                VertexTopRight    = _parent.VertexCenter;
                VertexBottomLeft  = _parent.VertexBottomLeft;
                VertexBottomRight = _parent.VertexBottom;
                break;

            case NodeType.BottomRight:
                VertexTopLeft     = _parent.VertexCenter;
                VertexTopRight    = _parent.VertexRight;
                VertexBottomLeft  = _parent.VertexBottom;
                VertexBottomRight = _parent.VertexBottomRight;
                break;

            default:
                VertexTopLeft = new QuadNodeVertex
                {
                    Activated = true,
                    Index     = 0
                };

                VertexTopRight = new QuadNodeVertex
                {
                    Activated = true,
                    Index     = VertexTopLeft.Index + _nodeSize
                };

                VertexBottomLeft = new QuadNodeVertex
                {
                    Activated = true,
                    Index     = (_nodeSize + 1) * _parentTree.TopNodeSize
                };

                VertexBottomRight = new QuadNodeVertex
                {
                    Activated = true,
                    Index     = VertexBottomLeft.Index + _nodeSize
                };

                break;
            }

            VertexTop = new QuadNodeVertex
            {
                Activated = false,
                Index     = VertexTopLeft.Index + (_nodeSize / 2)
            };

            VertexLeft = new QuadNodeVertex
            {
                Activated = false,
                Index     = VertexTopLeft.Index + (_parentTree.TopNodeSize + 1) * (_nodeSize / 2)
            };

            VertexCenter = new QuadNodeVertex
            {
                Activated = false,
                Index     = VertexLeft.Index + (_nodeSize / 2)
            };

            VertexRight = new QuadNodeVertex
            {
                Activated = false, Index = VertexLeft.Index + _nodeSize
            };

            VertexBottom = new QuadNodeVertex
            {
                Activated = false,
                Index     = VertexBottomLeft.Index + (_nodeSize / 2)
            };
        }