public Editor(VoxelManager manager) { this.manager = manager; toCreate = new Voxel(manager, position, TextureManager.getTexture(texture), TextureManager.containsAlpha(texture), TextureManager.isCube(texture)); light = new Light(position, 10); manager.lights.Add(light); }
public Voxel(VoxelManager manager, Vector3 position, Texture2D texture, bool alpha = false, bool cube = true, bool light = false) { this.manager = manager; this.position = position; this.texture = texture; this.alpha = alpha; this.cube = cube; if (light) { this.light = new Light(position + Vector3.UnitY, 10); manager.lights.Add(this.light); } SetUpVertices(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); device = graphics.GraphicsDevice; TextureManager.Init(Content); effect = Content.Load<Effect>("effects"); effect.Parameters["xEnableLighting"].SetValue(LIGHTING); effect.Parameters["xAmbient"].SetValue(lightAmbientStrength); defFont = Content.Load<SpriteFont>("default"); voxelManager = new VoxelManager(); PresentationParameters pp = device.PresentationParameters; renderTarget = new RenderTarget2D(device, pp.BackBufferWidth, pp.BackBufferHeight, true, device.DisplayMode.Format, DepthFormat.Depth24); camera = new Camera(75, MathHelper.ToRadians(30), new Vector3(VoxelManager.MAX_X / 2, 0, VoxelManager.MAX_Z / 2 + 3), device.Viewport.AspectRatio); }