public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime) { var dTileX = Location.TileX - Viewer.Camera.TileX; var dTileZ = Location.TileZ - Viewer.Camera.TileZ; var mstsLocation = Location.Location + new Vector3(dTileX * 2048, 0, dTileZ * 2048); var xnaMatrix = Matrix.CreateTranslation(mstsLocation.X, mstsLocation.Y, -mstsLocation.Z); frame.AddAutoPrimitive(mstsLocation, Radius, float.MaxValue, Material, Primitive, RenderPrimitiveGroup.World, ref xnaMatrix, Flags); }
public void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime) { if ((Primitive as ForestPrimitive).PrimitiveCount > 0) { var dTileX = Position.TileX - Viewer.Camera.TileX; var dTileZ = Position.TileZ - Viewer.Camera.TileZ; var mstsLocation = Position.Location + new Vector3(dTileX * 2048, 0, dTileZ * 2048); var xnaMatrix = Matrix.CreateTranslation(mstsLocation.X, mstsLocation.Y, -mstsLocation.Z); frame.AddAutoPrimitive(mstsLocation, Primitive.ObjectRadius, float.MaxValue, Material, Primitive, RenderPrimitiveGroup.World, ref xnaMatrix, Viewer.Settings.ShadowAllShapes ? ShapeFlags.ShadowCaster : ShapeFlags.None); } }
public void PrepareFrame(RenderFrame frame) { var dTileX = TileX - Viewer.Camera.TileX; var dTileZ = TileZ - Viewer.Camera.TileZ; var mstsLocation = new Vector3(PatchLocation.X + dTileX * 2048, PatchLocation.Y, PatchLocation.Z + dTileZ * 2048); var xnaPatchMatrix = Matrix.CreateTranslation(mstsLocation.X, mstsLocation.Y, -mstsLocation.Z); mstsLocation.Y += AverageElevation; // Try to keep testing point somewhere useful within the patch's altitude. // Low-resolution terrain (Size > 2) should always be drawn (PositiveInfinity), while high-resolution terrain should only be drawn within the viewing distance (MaxValue). frame.AddAutoPrimitive(mstsLocation, PatchSize * 0.7071F, Size > 2 ? float.PositiveInfinity : float.MaxValue, PatchMaterial, this, RenderPrimitiveGroup.World, ref xnaPatchMatrix, Size <= 2 ? ShapeFlags.ShadowCaster : ShapeFlags.None); }