예제 #1
0
        protected override void LoadContent()
        {
            // load assets
            var coreModule = new CoreAssetModule();

            AssetManager.AddModule(coreModule);
            AssetManager.LoadModules();
            AssetManager.CreateVoxelTextureAtlas();

            var voxelIconMaterial = new UI.VoxelIconMaterial();

            voxelIconMaterial.MainTexture      = G.Assets.VoxelTextureAtlas.AtlasTexture;
            voxelIconMaterial.DiffuseIntensity = 0.1f;
            voxelIconMaterial.AmbientIntensity = 0.8f;
            voxelIconMaterial.SunDirection     = -new Vector3(2, 3, 1).Normalized();

            // create ui meshes for voxel types
            foreach (var voxelType in G.Assets.GetAssets <VoxelType>())
            {
                voxelType.CreateVoxelIconMesh(voxelIconMaterial);
            }

            GameState.EnterState(new MainMenuState());
            GameState.ApplyNextState();
        }
예제 #2
0
 public VoxelIconMesh(Voxel voxel, VoxelIconMaterial material)
 {
     Voxel       = voxel;
     Material    = material;
     _vertBuffer = new VertexBuffer(G.Graphics, Vertex.declaration, 24, BufferUsage.None);
     _trisBuffer = new IndexBuffer(G.Graphics, IndexElementSize.ThirtyTwoBits, 36, BufferUsage.None);
     generate();
 }
예제 #3
0
        public void CreateVoxelIconMesh(UI.VoxelIconMaterial material)
        {
            var voxel = new Voxel(this);

            switch (InitialDataMode)
            {
            case VoxelInitialDataMode.None:
                voxel.Data = 0;
                break;

            case VoxelInitialDataMode.NormalOrientation:
                voxel.Data = (ushort)Orientation.Yp;
                break;
            }
            VoxelIconMesh = new UI.VoxelIconMesh(voxel, material);
        }