Ejemplo n.º 1
0
		public void Update(Vector2 tLevelMinPosition, IntVector2 tViewerPosGridCoords)
		{
			// update interior trim position based on viewer position
			if (tViewerPosGridCoords.X == Settings.CentralSquareMax.X && tViewerPosGridCoords.Y == Settings.CentralSquareMin.Y)
				m_eActiveInteriorTrim = WhichInteriorTrim.TopLeft;
			else if (tViewerPosGridCoords.X == Settings.CentralSquareMin.X && tViewerPosGridCoords.Y == Settings.CentralSquareMin.Y)
				m_eActiveInteriorTrim = WhichInteriorTrim.TopRight;
			else if (tViewerPosGridCoords.X == Settings.CentralSquareMax.X && tViewerPosGridCoords.Y == Settings.CentralSquareMax.Y)
				m_eActiveInteriorTrim = WhichInteriorTrim.BottomLeft;
			else if (tViewerPosGridCoords.X == Settings.CentralSquareMin.X && tViewerPosGridCoords.Y == Settings.CentralSquareMax.Y)
				m_eActiveInteriorTrim = WhichInteriorTrim.BottomRight;

			Vector2 tWorldPosition = tLevelMinPosition;

			m_tScaleFactor = new Vector4(
				m_nGridSpacing,
				m_nGridSpacing,
				tWorldPosition.X,
				tWorldPosition.Y);
		}
Ejemplo n.º 2
0
		private void CreateSharedVertexBuffer(GraphicsDevice pGraphicsDevice, WhichInteriorTrim eWhichInteriorTrim)
		{
			// create vertices
			TerrainVertex.Shared[] pVertices = new TerrainVertex.Shared[Settings.INTERIOR_TRIM_NUM_VERTICES];

			switch (eWhichInteriorTrim)
			{
				case WhichInteriorTrim.TopLeft:
					PopulateVerticesTopLeft(pVertices);
					break;
				case WhichInteriorTrim.TopRight:
					PopulateVerticesTopRight(pVertices);
					break;
				case WhichInteriorTrim.BottomLeft:
					PopulateVerticesBottomLeft(pVertices);
					break;
				case WhichInteriorTrim.BottomRight:
					PopulateVerticesBottomRight(pVertices);
					break;
			}

			// create shared vertex buffer
			m_pSharedVertexBuffers[(int) eWhichInteriorTrim] = new VertexBuffer(
				pGraphicsDevice,
				TerrainVertex.Shared.VertexDeclaration,
				Settings.INTERIOR_TRIM_NUM_VERTICES,
				BufferUsage.None);

			m_pSharedVertexBuffers[(int) eWhichInteriorTrim].SetData(pVertices);
		}