예제 #1
0
        public ChunkModule(TrueCraftGame game)
        {
            Game = game;

            ChunkRenderer = new ChunkRenderer(Game.Client.World, Game, Game.BlockRepository);
            Game.Client.ChunkLoaded += Game_Client_ChunkLoaded;
            Game.Client.ChunkUnloaded += (sender, e) => UnloadChunk(e.Chunk);
            Game.Client.ChunkModified += Game_Client_ChunkModified;
            Game.Client.BlockChanged += Game_Client_BlockChanged;
            ChunkRenderer.MeshCompleted += MeshCompleted;
            ChunkRenderer.Start();
            WorldLighting = new WorldLighting(Game.Client.World.World, Game.BlockRepository);

            OpaqueEffect = new BasicEffect(Game.GraphicsDevice);
            OpaqueEffect.TextureEnabled = true;
            OpaqueEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
            OpaqueEffect.FogEnabled = true;
            OpaqueEffect.FogStart = 0;
            OpaqueEffect.FogEnd = Game.Camera.Frustum.Far.D * 0.8f;
            OpaqueEffect.VertexColorEnabled = true;
            OpaqueEffect.LightingEnabled = true;

            TransparentEffect = new AlphaTestEffect(Game.GraphicsDevice);
            TransparentEffect.AlphaFunction = CompareFunction.Greater;
            TransparentEffect.ReferenceAlpha = 127;
            TransparentEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
            TransparentEffect.VertexColorEnabled = true;
            OpaqueEffect.LightingEnabled = true;

            ChunkMeshes = new List<ChunkMesh>();
            IncomingChunks = new ConcurrentBag<Mesh>();
            ActiveMeshes = new HashSet<Coordinates2D>();
        }
예제 #2
0
        public ChunkModule(TrueCraftGame game)
        {
            Game = game;

            ChunkRenderer = new ChunkRenderer(Game.Client.World, Game, Game.BlockRepository);
            Game.Client.ChunkLoaded += (sender, e) => ChunkRenderer.Enqueue(e.Chunk);
            Game.Client.ChunkUnloaded += (sender, e) => UnloadChunk(e.Chunk);
            Game.Client.ChunkModified += (sender, e) => ChunkRenderer.Enqueue(e.Chunk, true);
            ChunkRenderer.MeshCompleted += MeshCompleted;
            ChunkRenderer.Start();

            OpaqueEffect = new BasicEffect(Game.GraphicsDevice);
            OpaqueEffect.TextureEnabled = true;
            OpaqueEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
            OpaqueEffect.FogEnabled = true;
            OpaqueEffect.FogStart = 512f;
            OpaqueEffect.FogEnd = 1000f;
            OpaqueEffect.FogColor = Color.CornflowerBlue.ToVector3();
            OpaqueEffect.VertexColorEnabled = true;

            TransparentEffect = new AlphaTestEffect(Game.GraphicsDevice);
            TransparentEffect.AlphaFunction = CompareFunction.Greater;
            TransparentEffect.ReferenceAlpha = 127;
            TransparentEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
            TransparentEffect.VertexColorEnabled = true;

            ChunkMeshes = new List<ChunkMesh>();
            IncomingChunks = new ConcurrentBag<Mesh>();
            ActiveMeshes = new HashSet<Coordinates2D>();
        }
예제 #3
0
 public ChunkRenderer(ReadOnlyWorld world, TrueCraftGame game, IBlockRepository blockRepository)
     : base()
 {
     World           = world;
     BlockRepository = blockRepository;
     Game            = game;
 }
예제 #4
0
        public ChunkModule(TrueCraftGame game)
        {
            Game = game;

            ChunkRenderer                = new ChunkRenderer(Game.Client.World, Game, Game.BlockRepository);
            Game.Client.ChunkLoaded     += Game_Client_ChunkLoaded;
            Game.Client.ChunkUnloaded   += (sender, e) => UnloadChunk(e.Chunk);
            Game.Client.ChunkModified   += Game_Client_ChunkModified;
            Game.Client.BlockChanged    += Game_Client_BlockChanged;
            ChunkRenderer.MeshCompleted += MeshCompleted;
            ChunkRenderer.Start();
            WorldLighting = new WorldLighting(Game.Client.World.World, Game.BlockRepository);

            OpaqueEffect = new BasicEffect(Game.GraphicsDevice);
            OpaqueEffect.TextureEnabled     = true;
            OpaqueEffect.Texture            = Game.TextureMapper.GetTexture("terrain.png");
            OpaqueEffect.FogEnabled         = true;
            OpaqueEffect.FogStart           = 0;
            OpaqueEffect.FogEnd             = Game.Camera.Frustum.Far.D * 0.8f;
            OpaqueEffect.VertexColorEnabled = true;
            OpaqueEffect.LightingEnabled    = true;

            TransparentEffect = new AlphaTestEffect(Game.GraphicsDevice);
            TransparentEffect.AlphaFunction      = CompareFunction.Greater;
            TransparentEffect.ReferenceAlpha     = 127;
            TransparentEffect.Texture            = Game.TextureMapper.GetTexture("terrain.png");
            TransparentEffect.VertexColorEnabled = true;
            OpaqueEffect.LightingEnabled         = true;

            ChunkMeshes    = new List <ChunkMesh>();
            IncomingChunks = new ConcurrentBag <Mesh>();
            ActiveMeshes   = new HashSet <Coordinates2D>();
        }
예제 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="chunk"></param>
 /// <param name="device"></param>
 /// <param name="vertices"></param>
 /// <param name="indices"></param>
 public ChunkMesh(ReadOnlyChunk chunk, TrueCraftGame game, VertexPositionNormalColorTexture[] vertices, int[] indices)
     : base(game, 1, true)
 {
     Chunk    = chunk;
     Vertices = vertices;
     SetSubmesh(0, indices);
 }
예제 #6
0
        public ChunkModule(TrueCraftGame game)
        {
            Game = game;

            ChunkRenderer                = new ChunkRenderer(Game.Client.World, Game, Game.BlockRepository);
            Game.Client.ChunkLoaded     += (sender, e) => ChunkRenderer.Enqueue(e.Chunk);
            Game.Client.ChunkUnloaded   += (sender, e) => UnloadChunk(e.Chunk);
            Game.Client.ChunkModified   += (sender, e) => ChunkRenderer.Enqueue(e.Chunk, true);
            ChunkRenderer.MeshCompleted += MeshCompleted;
            ChunkRenderer.Start();

            OpaqueEffect = new BasicEffect(Game.GraphicsDevice);
            OpaqueEffect.TextureEnabled     = true;
            OpaqueEffect.Texture            = Game.TextureMapper.GetTexture("terrain.png");
            OpaqueEffect.FogEnabled         = true;
            OpaqueEffect.FogStart           = 512f;
            OpaqueEffect.FogEnd             = 1000f;
            OpaqueEffect.FogColor           = Color.CornflowerBlue.ToVector3();
            OpaqueEffect.VertexColorEnabled = true;

            TransparentEffect = new AlphaTestEffect(Game.GraphicsDevice);
            TransparentEffect.AlphaFunction      = CompareFunction.Greater;
            TransparentEffect.ReferenceAlpha     = 127;
            TransparentEffect.Texture            = Game.TextureMapper.GetTexture("terrain.png");
            TransparentEffect.VertexColorEnabled = true;

            ChunkMeshes    = new List <ChunkMesh>();
            IncomingChunks = new ConcurrentBag <Mesh>();
            ActiveMeshes   = new HashSet <Coordinates2D>();
        }
예제 #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="chunk"></param>
 /// <param name="device"></param>
 /// <param name="vertices"></param>
 /// <param name="indices"></param>
 public ChunkMesh(ReadOnlyChunk chunk, TrueCraftGame game, VertexPositionNormalColorTexture[] vertices, int[] indices)
     : base(game, 1, true)
 {
     Chunk = chunk;
     Vertices = vertices;
     SetSubmesh(0, indices);
 }
예제 #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="chunk"></param>
 /// <param name="device"></param>
 /// <param name="vertices"></param>
 /// <param name="opaqueIndices"></param>
 /// <param name="transparentIndices"></param>
 public ChunkMesh(ReadOnlyChunk chunk, TrueCraftGame game, VertexPositionNormalColorTexture[] vertices, int[] opaqueIndices, int[] transparentIndices)
     : base(game, 2, true)
 {
     Chunk = chunk;
     Vertices = vertices;
     SetSubmesh(0, opaqueIndices);
     SetSubmesh(1, transparentIndices);
 }
예제 #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="chunk"></param>
 /// <param name="device"></param>
 /// <param name="vertices"></param>
 /// <param name="opaqueIndices"></param>
 /// <param name="transparentIndices"></param>
 public ChunkMesh(ReadOnlyChunk chunk, TrueCraftGame game, VertexPositionNormalColorTexture[] vertices, int[] opaqueIndices, int[] transparentIndices)
     : base(game, 2, true)
 {
     Chunk    = chunk;
     Vertices = vertices;
     SetSubmesh(0, opaqueIndices);
     SetSubmesh(1, transparentIndices);
 }
예제 #10
0
 public HUDModule(TrueCraftGame game, FontRenderer font)
 {
     Game        = game;
     Font        = font;
     SpriteBatch = new SpriteBatch(game.GraphicsDevice);
     GUI         = game.TextureMapper.GetTexture("gui/gui.png");
     Icons       = game.TextureMapper.GetTexture("gui/icons.png");
     Items       = game.TextureMapper.GetTexture("gui/items.png");
 }
예제 #11
0
        public DebugInfoModule(TrueCraftGame game, FontRenderer font)
        {
            Game        = game;
            Font        = font;
            SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
#if DEBUG
            Enabled = true;
#endif
        }
예제 #12
0
        public DebugInfoModule(TrueCraftGame game, FontRenderer font)
        {
            Game = game;
            Font = font;
            SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
#if DEBUG
            Enabled = true;
#endif
        }
예제 #13
0
 public HUDModule(TrueCraftGame game, FontRenderer font)
 {
     Game = game;
     Font = font;
     SpriteBatch = new SpriteBatch(game.GraphicsDevice);
     GUI = game.TextureMapper.GetTexture("gui/gui.png");
     Icons = game.TextureMapper.GetTexture("gui/icons.png");
     Items = game.TextureMapper.GetTexture("gui/items.png");
 }
예제 #14
0
파일: Mesh.cs 프로젝트: Luigifan/TrueCraft
        private bool _recalculateBounds; // Whether this mesh should recalculate its bounding box when changed.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Creates a new mesh.
        /// </summary>
        /// <param name="graphicsDevice">The graphics device to store the mesh on.</param>
        /// <param name="submeshes">The number of submeshes in the mesh.</param>
        /// <param name="recalculateBounds">Whether the mesh should recalculate its bounding box when changed.</param>
        public Mesh(TrueCraftGame game, int submeshes = 1, bool recalculateBounds = true)
        {
            if ((submeshes < 0) || (submeshes >= Mesh.SubmeshLimit))
                throw new ArgumentOutOfRangeException();

            _game = game;
            _graphicsDevice = game.GraphicsDevice;
            _indices = new IndexBuffer[submeshes];
            _recalculateBounds = recalculateBounds;
        }
예제 #15
0
        public HighlightModule(TrueCraftGame game)
        {
            Game = game;
            HighlightEffect = new BasicEffect(Game.GraphicsDevice);
            HighlightEffect.VertexColorEnabled = true;
            DestructionEffect = new AlphaTestEffect(Game.GraphicsDevice);
            DestructionEffect.Texture = game.TextureMapper.GetTexture("terrain.png");
            DestructionEffect.ReferenceAlpha = 1;

            GenerateProgressMesh();
        }
예제 #16
0
 public WindowModule(TrueCraftGame game, FontRenderer font)
 {
     Game         = game;
     Font         = font;
     SpriteBatch  = new SpriteBatch(game.GraphicsDevice);
     Inventory    = game.TextureMapper.GetTexture("gui/inventory.png");
     Crafting     = game.TextureMapper.GetTexture("gui/crafting.png");
     Items        = game.TextureMapper.GetTexture("gui/items.png");
     SelectedSlot = -1;
     HeldItem     = ItemStack.EmptyStack;
 }
예제 #17
0
 public WindowModule(TrueCraftGame game, FontRenderer font)
 {
     Game = game;
     Font = font;
     SpriteBatch = new SpriteBatch(game.GraphicsDevice);
     Inventory = game.TextureMapper.GetTexture("gui/inventory.png");
     Crafting = game.TextureMapper.GetTexture("gui/crafting.png");
     Items = game.TextureMapper.GetTexture("gui/items.png");
     SelectedSlot = -1;
     HeldItem = ItemStack.EmptyStack;
 }
예제 #18
0
 public PlayerControlModule(TrueCraftGame game)
 {
     Game = game;
     Capture = true;
     Digging = false;
     Game.StartDigging = DateTime.MinValue;
     Game.EndDigging = DateTime.MaxValue;
     Game.TargetBlock = -Coordinates3D.One;
     NextAnimation = DateTime.MaxValue;
     GamePadState = GamePad.GetState(PlayerIndex.One);
 }
예제 #19
0
 public PlayerControlModule(TrueCraftGame game)
 {
     Game              = game;
     Capture           = true;
     Digging           = false;
     Game.StartDigging = DateTime.MinValue;
     Game.EndDigging   = DateTime.MaxValue;
     Game.TargetBlock  = -Coordinates3D.One;
     NextAnimation     = DateTime.MaxValue;
     GamePadState      = GamePad.GetState(PlayerIndex.One);
 }
예제 #20
0
        public HighlightModule(TrueCraftGame game)
        {
            Game            = game;
            HighlightEffect = new BasicEffect(Game.GraphicsDevice);
            HighlightEffect.VertexColorEnabled = true;
            DestructionEffect                = new AlphaTestEffect(Game.GraphicsDevice);
            DestructionEffect.Texture        = game.TextureMapper.GetTexture("terrain.png");
            DestructionEffect.ReferenceAlpha = 1;

            GenerateProgressMesh();
        }
예제 #21
0
        /// <summary>
        /// Creates a new mesh.
        /// </summary>
        public Mesh(TrueCraftGame game, int submeshes = 1, bool recalculateBounds = true)
        {
            if ((submeshes < 0) || (submeshes >= Mesh.SubmeshLimit))
            {
                throw new ArgumentOutOfRangeException();
            }

            _game              = game;
            _graphicsDevice    = game.GraphicsDevice;
            _indices           = new IndexBuffer[submeshes];
            _recalculateBounds = recalculateBounds;
        }
예제 #22
0
 public ChatModule(TrueCraftGame game, FontRenderer font)
 {
     Game       = game;
     Font       = font;
     Messages   = new List <Message>();
     Background = new Texture2D(Game.GraphicsDevice, 1, 1);
     Background.SetData <Color>(new[] { new Color(Color.Black, 160) });
     SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
     Watch       = new Stopwatch();
     Watch.Start();
     Text = string.Empty;
     Game.Client.ChatMessage += (sender, e) => AddMessage(e.Message);
 }
예제 #23
0
 public ChatModule(TrueCraftGame game, FontRenderer font)
 {
     Game = game;
     Font = font;
     Messages = new List<Message>();
     Background = new Texture2D(Game.GraphicsDevice, 1, 1);
     Background.SetData<Color>(new[] { new Color(Color.Black, 160) });
     SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
     Watch = new Stopwatch();
     Watch.Start();
     Text = string.Empty;
     Game.Client.ChatMessage += (sender, e) => AddMessage(e.Message);
 }
예제 #24
0
 public static void PrepareEffects(TrueCraftGame game)
 {
     RenderEffect = new BasicEffect(game.GraphicsDevice);
     RenderEffect.Texture = game.TextureMapper.GetTexture("terrain.png");
     RenderEffect.TextureEnabled = true;
     RenderEffect.VertexColorEnabled = true;
     RenderEffect.LightingEnabled = true;
     RenderEffect.DirectionalLight0.Direction = new Vector3(10, -10, -0.8f);
     RenderEffect.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
     RenderEffect.DirectionalLight0.Enabled = true;
     RenderEffect.Projection = Matrix.CreateOrthographicOffCenter(
         0, game.GraphicsDevice.Viewport.Width,
         0, game.GraphicsDevice.Viewport.Height,
         0.1f, 1000.0f);
     RenderEffect.View = Matrix.CreateLookAt(Vector3.UnitZ, Vector3.Zero, Vector3.Up);
 }
예제 #25
0
 public static void RenderBlockIcon(TrueCraftGame game, IBlockProvider provider, byte metadata, Rectangle destination)
 {
     var mesh = BlockMeshes[provider.ID];
     if (mesh != null)
     {
         RenderEffect.World = Matrix.Identity
             * Matrix.CreateScale(0.6f)
             * Matrix.CreateRotationY(-MathHelper.PiOver4)
             * Matrix.CreateRotationX(MathHelper.ToRadians(30))
             * Matrix.CreateScale(new Vector3(destination.Width, destination.Height, 1))
             * Matrix.CreateTranslation(new Vector3(
                 destination.X, -(destination.Y - game.GraphicsDevice.Viewport.Height / 2) + game.GraphicsDevice.Viewport.Height / 2, 0))
             * Matrix.CreateTranslation(new Vector3(destination.Width / 2, -destination.Height / 2, 0));
         mesh.Draw(RenderEffect);
     }
 }
예제 #26
0
 public static void PrepareEffects(TrueCraftGame game)
 {
     RenderEffect                                = new BasicEffect(game.GraphicsDevice);
     RenderEffect.Texture                        = game.TextureMapper.GetTexture("terrain.png");
     RenderEffect.TextureEnabled                 = true;
     RenderEffect.VertexColorEnabled             = true;
     RenderEffect.LightingEnabled                = true;
     RenderEffect.DirectionalLight0.Direction    = new Vector3(10, -10, -0.8f);
     RenderEffect.DirectionalLight0.DiffuseColor = Color.White.ToVector3();
     RenderEffect.DirectionalLight0.Enabled      = true;
     RenderEffect.Projection                     = Microsoft.Xna.Framework.Matrix.CreateOrthographicOffCenter(
         0, game.GraphicsDevice.Viewport.Width,
         0, game.GraphicsDevice.Viewport.Height,
         0.1f, 1000.0f);
     RenderEffect.View = Microsoft.Xna.Framework.Matrix.CreateLookAt(Vector3.UnitZ, Vector3.Zero, Vector3.Up);
 }
예제 #27
0
        public static void RenderBlockIcon(TrueCraftGame game, IBlockProvider provider, byte metadata, Rectangle destination)
        {
            var mesh = BlockMeshes[provider.ID];

            if (mesh != null)
            {
                RenderEffect.World = Matrix.Identity
                                     * Matrix.CreateScale(0.6f)
                                     * Matrix.CreateRotationY(-MathHelper.PiOver4)
                                     * Matrix.CreateRotationX(MathHelper.ToRadians(30))
                                     * Matrix.CreateScale(new Vector3(destination.Width, destination.Height, 1))
                                     * Matrix.CreateTranslation(new Vector3(
                                                                    destination.X, -(destination.Y - game.GraphicsDevice.Viewport.Height / 2) + game.GraphicsDevice.Viewport.Height / 2, 0))
                                     * Matrix.CreateTranslation(new Vector3(destination.Width / 2, -destination.Height / 2, 0));
                mesh.Draw(RenderEffect);
            }
        }
예제 #28
0
        public static void CreateBlocks(TrueCraftGame game, IBlockRepository repository)
        {
            for (int i = 0; i < 0x100; i++)
            {
                var provider = repository.GetBlockProvider((byte)i);
                if (provider == null || provider.GetIconTexture(0) != null)
                    continue;
                int[] indicies;
                var verticies = BlockRenderer.RenderBlock(provider,
                    new BlockDescriptor { ID = provider.ID }, VisibleFaces.All, new Vector3(-0.5f),
                    0, out indicies);
                var mesh = new Mesh(game, verticies, indicies);
                BlockMeshes[provider.ID] = mesh;
            }

            PrepareEffects(game);
        }
예제 #29
0
        public SkyModule(TrueCraftGame game)
        {
            Game = game;
            CelestialPlaneEffect = new BasicEffect(Game.GraphicsDevice);
            CelestialPlaneEffect.TextureEnabled = true;

            SkyPlaneEffect = new BasicEffect(Game.GraphicsDevice);
            SkyPlaneEffect.VertexColorEnabled = false;
            SkyPlaneEffect.FogEnabled         = true;
            SkyPlaneEffect.FogStart           = 0;
            SkyPlaneEffect.FogEnd             = 64 * 0.8f;
            SkyPlaneEffect.LightingEnabled    = true;
            var plane = new[]
            {
                new VertexPositionColor(new Vector3(-64, 0, -64), Color.White),
                new VertexPositionColor(new Vector3(64, 0, -64), Color.White),
                new VertexPositionColor(new Vector3(-64, 0, 64), Color.White),

                new VertexPositionColor(new Vector3(64, 0, -64), Color.White),
                new VertexPositionColor(new Vector3(64, 0, 64), Color.White),
                new VertexPositionColor(new Vector3(-64, 0, 64), Color.White)
            };

            SkyPlane = new VertexBuffer(Game.GraphicsDevice, VertexPositionColor.VertexDeclaration,
                                        plane.Length, BufferUsage.WriteOnly);
            SkyPlane.SetData <VertexPositionColor>(plane);
            var celestialPlane = new[]
            {
                new VertexPositionTexture(new Vector3(-60, 0, -60), new Vector2(0, 0)),
                new VertexPositionTexture(new Vector3(60, 0, -60), new Vector2(1, 0)),
                new VertexPositionTexture(new Vector3(-60, 0, 60), new Vector2(0, 1)),

                new VertexPositionTexture(new Vector3(60, 0, -60), new Vector2(1, 0)),
                new VertexPositionTexture(new Vector3(60, 0, 60), new Vector2(1, 1)),
                new VertexPositionTexture(new Vector3(-60, 0, 60), new Vector2(0, 1))
            };

            CelestialPlane = new VertexBuffer(Game.GraphicsDevice, VertexPositionTexture.VertexDeclaration,
                                              celestialPlane.Length, BufferUsage.WriteOnly);
            CelestialPlane.SetData <VertexPositionTexture>(celestialPlane);
        }
예제 #30
0
        public static void CreateBlocks(TrueCraftGame game, IBlockRepository repository)
        {
            for (var i = 0; i < 0x100; i++)
            {
                var provider = repository.GetBlockProvider((byte)i);
                if (provider == null || provider.GetIconTexture(0) != null)
                {
                    continue;
                }
                int[] indicies;
                var   verticies = BlockRenderer.RenderBlock(provider,
                                                            new BlockDescriptor {
                    Id = provider.Id
                }, VisibleFaces.All, new Vector3(-0.5f),
                                                            0, out indicies);
                var mesh = new Mesh(game, verticies, indicies);
                BlockMeshes[provider.Id] = mesh;
            }

            PrepareEffects(game);
        }
예제 #31
0
        public SkyModule(TrueCraftGame game)
        {
            Game = game;
            CelestialPlaneEffect = new BasicEffect(Game.GraphicsDevice);
            CelestialPlaneEffect.TextureEnabled = true;

            SkyPlaneEffect = new BasicEffect(Game.GraphicsDevice);
            SkyPlaneEffect.VertexColorEnabled = false;
            SkyPlaneEffect.FogEnabled = true;
            SkyPlaneEffect.FogStart = 0;
            SkyPlaneEffect.FogEnd = 64 * 0.8f;
            SkyPlaneEffect.LightingEnabled = true;
            var plane = new[]
            {
                new VertexPositionColor(new Vector3(-64, 0, -64), Color.White),
                new VertexPositionColor(new Vector3(64, 0, -64), Color.White),
                new VertexPositionColor(new Vector3(-64, 0, 64), Color.White),

                new VertexPositionColor(new Vector3(64, 0, -64), Color.White),
                new VertexPositionColor(new Vector3(64, 0, 64), Color.White),
                new VertexPositionColor(new Vector3(-64, 0, 64), Color.White)
            };
            SkyPlane = new VertexBuffer(Game.GraphicsDevice, VertexPositionColor.VertexDeclaration,
                plane.Length, BufferUsage.WriteOnly);
            SkyPlane.SetData<VertexPositionColor>(plane);
            var celestialPlane = new[]
            {
                new VertexPositionTexture(new Vector3(-60, 0, -60), new Vector2(0, 0)),
                new VertexPositionTexture(new Vector3(60, 0, -60), new Vector2(1, 0)),
                new VertexPositionTexture(new Vector3(-60, 0, 60), new Vector2(0, 1)),

                new VertexPositionTexture(new Vector3(60, 0, -60), new Vector2(1, 0)),
                new VertexPositionTexture(new Vector3(60, 0, 60), new Vector2(1, 1)),
                new VertexPositionTexture(new Vector3(-60, 0, 60), new Vector2(0, 1))
            };
            CelestialPlane = new VertexBuffer(Game.GraphicsDevice, VertexPositionTexture.VertexDeclaration,
                celestialPlane.Length, BufferUsage.WriteOnly);
            CelestialPlane.SetData<VertexPositionTexture>(celestialPlane);
        }
예제 #32
0
파일: Mesh.cs 프로젝트: Zoxive/TrueCraft
 /// <summary>
 /// Creates a new mesh.
 /// </summary>
 public Mesh(TrueCraftGame game, VertexPositionNormalColorTexture[] vertices,
         int submeshes = 1, bool recalculateBounds = true) : this(game, submeshes, recalculateBounds)
 {
     Vertices = vertices;
 }
예제 #33
0
 /// <summary>
 /// Creates a new mesh.
 /// </summary>
 public Mesh(TrueCraftGame game, VertexPositionNormalColorTexture[] vertices,
             int[] indices, bool recalculateBounds = true) : this(game, 1, recalculateBounds)
 {
     Vertices = vertices;
     SetSubmesh(0, indices);
 }
예제 #34
0
파일: Mesh.cs 프로젝트: Zoxive/TrueCraft
 /// <summary>
 /// Creates a new mesh.
 /// </summary>
 public Mesh(TrueCraftGame game, VertexPositionNormalColorTexture[] vertices,
         int[] indices, bool recalculateBounds = true) : this(game, 1, recalculateBounds)
 {
     Vertices = vertices;
     SetSubmesh(0, indices);
 }
예제 #35
0
 /// <summary>
 /// Creates a new mesh.
 /// </summary>
 public Mesh(TrueCraftGame game, VertexPositionNormalColorTexture[] vertices,
             int submeshes = 1, bool recalculateBounds = true) : this(game, submeshes, recalculateBounds)
 {
     Vertices = vertices;
 }
예제 #36
0
 public ChunkRenderer(TrueCraftGame game, IBlockRepository blockRepository)
     : base()
 {
     BlockRepository = blockRepository;
     Game            = game;
 }