Example #1
0
    protected override void OnOSCMessage(OSCMessage message)
    {
        // DebugClient("recienig mes addr " + message.Address + " type " + message.typeTag);
        if (message.Address == "/depth")
        {
            dimensions = new Vector2Int(message.GetInt(0), message.GetInt(1));
            byte[] data = message.GetBytes(2);

            CreateParticles(data);
            if (points == null || points.Length != dimensions.x * dimensions.y)
            {
                points = new ParticleSystem.Particle[dimensions.x * dimensions.y];
                ClearParticles();
            }
            //	Debug.Log("dimensionsa re " + dimensions + " len = " + data.Length + " should be " + dimensions.x * dimensions.y * 2);
        }
        else
        {
            DebugClient("unknown address " + message.Address);
        }
    }
    protected override void OnOSCMessage(OSCMessage message)
    {
        // DebugClient("recienig mes addr " + message.Address + " type " + message.typeTag);
        if (message.Address == WSCameraService.oscFrameAddress)
        {
            byte[] data = message.GetBytes();

            if (texture == null)
            {
                texture = new Texture2D(1, 1);
            }
            if (texture.LoadImage(data))
            {
                targetImage.texture = texture;
            }
        }
        else
        {
            DebugClient("unknown address " + message.Address);
        }
    }