public void Draw() { fire.Seed(); fire.Burn(); fire.Draw(imageSurface); imageSurface.Flush(); }
private void Update() { image.SetNativeSize(); scaler.matchWidthOrHeight = landscape ? 1 : 0; scaler.referenceResolution = image.rectTransform.sizeDelta; while (receiver.toEventLoop.TryDequeue(out var dataAndFrame)) { (Data data, byte[] frame) = dataAndFrame; if (!_initialized) { var frameWidth = data.frameWidth; var frameHeight = data.frameHeight; frustumHeight = Camera.main.orthographicSize * 2; frustumWidth = frustumHeight * frameWidth / frameHeight; leftHand = new Hand(handParams, xMult: -1); rightHand = new Hand(handParams, xMult: 1); leftFire = new Fire(leftHand, fireL); renderTexture = new RenderTexture(frameWidth, frameHeight, depth: 24); receiveTexture = new Texture2D(frameWidth, frameHeight, TextureFormat.RGB24, mipChain: false); sendTexture = new Texture2D(frameWidth, frameHeight, TextureFormat.RGB24, mipChain: false); image.texture = receiveTexture; _initialized = true; } receiveTexture.LoadRawTextureData(frame); receiveTexture.Apply(updateMipmaps: false); // image.texture = receiveTexture; leftHand.Process(data.dataL); rightHand.Process(data.dataR); leftFire.Draw(); } }