コード例 #1
0
ファイル: Game1.cs プロジェクト: wbobeirne/Voxel-Editor
        private void PlaceVoxel()
        {
            Voxel placementVoxel = CheckForVoxel();
            Voxel voxelToAdd;

            if (placementVoxel == null) {
                voxelToAdd = new Voxel(voxelModel, voxelCursor.world, voxelTex, color);
                voxelList.Add(voxelToAdd);
                Console.WriteLine(voxelToAdd);
            }
            else {
                placementVoxel.color = color;
            }
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: wbobeirne/Voxel-Editor
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            voxelModel = Content.Load<Model>("Models\\highPolyCube");
            voxelTex = Content.Load<Texture2D>("Textures\\whiteTexture");

            backdropModel = Content.Load<Model>("Models\\flatePlane");
            backdropTex = Content.Load<Texture2D>("Textures\\grid");

            aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

            //Backdrop stuffs
            backdrop = new Backdrop(backdropModel, voxelTex, Matrix.Identity);
            floor = new Floor(new Vector3(10f, 10f, 10f), Vector3.Zero, voxelTex);

            //Cursor stuffs
            voxelCursor = new Voxel(voxelModel, placementWorld,
                voxelTex, new Vector3(1.0f, 1.0f, 1.0f));
            voxelCursor.alpha = 0.7f;
            voxelCursor.scale = 1.001f;

            //HUD stuffs
            hud = new HUD(this, spriteBatch);
            hud.LoadContent(Content, GraphicsDevice);
        }