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(); }
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(); }
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); }