Exemple #1
0
        private void CreateVoxWorld()
        {
            dVox  = new Dictionary <string, VoxData>();
            state = new VoxState();
            state.World.worldMin.X = 0;
            state.World.worldMin.Y = 0;
            CreateVoxTypes();

            voxContent = new ContentManager(game.Services);
            voxContent.RootDirectory = @"Content";
            renderer = new VoxelRenderer(game.Graphics, voxContent);
            renderer.Hook(state);
            renderer.LoadEffect(@"FX\VoxelLE");
            renderer.LoadVMap(@"LevelEditor\VoxMap.png");

            vManager = new WorldManager(state);
            for (int z = 0; z < VoxWorld.DEPTH; z++)
            {
                for (int x = 0; x < VoxWorld.WIDTH; x++)
                {
                    state.AddEvent(new VEWorldMod(state.World.worldMin.X + x, state.World.worldMin.Y + z, VEWMType.RegionAdd));
                }
            }
            state.VWorkPool.Start(2);
            state.World.OnRegionAddition += (w, r) => {
                if (r.loc.X == 0 && r.loc.Y == 0)
                {
                    r.AddVoxel(1, Region.HEIGHT - 2, 1, (ushort)0x06u);
                }
            };
        }
Exemple #2
0
 public void Build(GraphicsDeviceManager gdm, ContentManager cm, VoxMapConfig vc)
 {
     vRenderer = new VoxelRenderer(gdm, cm);
     vRenderer.LoadEffect(vc.FXFile);
     vRenderer.LoadVMap(Path.Combine(vc.RootPath, vc.TexVoxMap));
     vRenderer.Hook(vc.VoxState);
     foreach (var r in vc.VoxState.World.regions)
     {
         if (r != null)
         {
             vc.VoxState.VWorkPool.AddWork(new RegionTesselator(r, vRenderer));
         }
     }
 }