public TrippyRenderer(GraphicsDevice graphicsDevice) { if (graphicsDevice == null) { throw new ArgumentNullException(nameof(graphicsDevice)); } _device = graphicsDevice; _shaderProgram = SimpleShaderProgram.Create <VertexColorTexture>(graphicsDevice, 0, 0, true); UpdateProjection(); _batch = new TextureBatcher(_device); _batch.SetShaderProgram(_shaderProgram); AllWidgetsTest.Instance.SizeChanged += Instance_SizeChanged; }
protected override void OnLoad() { shaderProgram = SimpleShaderProgram.Create <VertexColorTexture>(graphicsDevice, 0, 0, true); particleTexture = Texture2DExtensions.FromFile(graphicsDevice, "particles.png"); particleTexture.SetTextureFilters(TextureMinFilter.Nearest, TextureMagFilter.Nearest); rectangleTexture = Texture2DExtensions.FromFile(graphicsDevice, "rectangle.png"); ballTexture = Texture2DExtensions.FromFile(graphicsDevice, "ball.png"); diamondTexture = Texture2DExtensions.FromFile(graphicsDevice, "diamond.png"); TextureFont[] fonts = TextureFontExtensions.FromFile(graphicsDevice, "font.tglf"); comicSansFont = fonts[0]; arialFont = fonts[1]; textureBatcher = new TextureBatcher(graphicsDevice); textureBatcher.SetShaderProgram(shaderProgram); graphicsDevice.DepthState = DepthState.None; graphicsDevice.BlendState = BlendState.NonPremultiplied; graphicsDevice.ClearColor = new Vector4(0.1f, 0.65f, 0.5f, 1f); MaxX = Window.Size.Width; MaxY = Window.Size.Height; Particle.texture = particleTexture; Diamond.texture = diamondTexture; Ball.texture = ballTexture; particles = new LinkedList <Particle>(); diamonds = new Diamond[40]; for (int i = 0; i < diamonds.Length; i++) { diamonds[i] = new Diamond(); } balls = new Ball[40]; for (int i = 0; i < balls.Length; i++) { balls[i] = new Ball(); } stopwatch = Stopwatch.StartNew(); graphicsDevice.CullFaceMode = CullFaceMode.Back; graphicsDevice.FaceCullingEnabled = true; }
protected override void OnLoad() { graphicsDevice.DepthState = DepthState.None; graphicsDevice.FaceCullingEnabled = false; graphicsDevice.BlendState = BlendState.Opaque; graphicsDevice.ClearColor = new Vector4(0, 0, 0, 1); SimpleShaderProgram shaderProgram = SimpleShaderProgram.Create <VertexColorTexture>(graphicsDevice, 0, 0, true); _batch = new TextureBatcher(graphicsDevice); _batch.SetShaderProgram(shaderProgram); _white = new Texture2D(graphicsDevice, 1, 1); _white.SetTextureFilters(TextureMinFilter.Nearest, TextureMagFilter.Nearest); var colors = new Color4b[1]; colors[0] = Color4b.White; _white.SetData <Color4b>(colors); }