/// <summary> /// Generates the one to one white texture /// </summary> public override void GenerateOneToOne() { if (Height != 1 || Width != 1) { return; } texture.SetData <Color>(XenkoRenderer.GraphicsContext.CommandList, new Color[] { Color.White }); }
// Complete the graphic pipeline, initialize texture data public override void Start() { // create the sprite batch used in our custom rendering function spriteBatch = new SpriteBatch(GraphicsDevice); // insert the custom renderer in between the 2 camera renderer. var scene = SceneSystem.SceneInstance.Scene; var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor); compositor.Master.Renderers.Insert(2, new SceneDelegateRenderer(RenderTexture)); // Create and initialize the dynamic texture renderTexture = Texture.New2D(GraphicsDevice, RenderTextureSize, RenderTextureSize, 1, PixelFormat.R8G8B8A8_UNorm_SRgb, usage: GraphicsResourceUsage.Dynamic); // Setup initial data in "SymmetricDefaultShape" to the texture for (var i = 0; i < SymmetricDefaultShape.Length; i += 2) { TogglePixel(SymmetricDefaultShape[i], SymmetricDefaultShape[i + 1]); if (SymmetricDefaultShape[i] != (RenderTextureSize - 1) - SymmetricDefaultShape[i]) TogglePixel((RenderTextureSize - 1) - SymmetricDefaultShape[i], SymmetricDefaultShape[i + 1]); } renderTexture.SetData(Game.GraphicsContext.CommandList, textureData); }