Exemplo n.º 1
0
    private void Init()
    {
        this.context = new Context(OpenNIXMLFilename);
        if (null == context)
        {
            return;
        }

        this.Depth  = new DepthGenerator(this.context);
        this.mirror = this.Depth.MirrorCapability;

        MonoBehaviour.print("OpenNI inited");

        validContext = true;

        Start();
    }
    public void Awake()
    {
        if (LoadFromRecording)
        {
            context.OpenFileRecording(RecordingFilename);
            Player player = openNode(NodeType.Player) as Player;
            player.PlaybackSpeed = 0.0;
            StartCoroutine(ReadNextFrameFromRecording(player));
        }

        this.Depth     = openNode(NodeType.Depth) as DepthGenerator;
        this.mirrorCap = this.Depth.MirrorCapability;
        if (!LoadFromRecording)
        {
            this.mirrorCap.SetMirror(initialMirror);
        }
    }
Exemplo n.º 3
0
    public void Awake()
    {
        Debug.Log("Initing OpenNI" + (LoadFromXML ? "(" + XMLFilename + ")" : ""));
        try {
            this.context = LoadFromXML ? new Context(XMLFilename) : new Context();
        }
        catch (Exception ex) {
            Debug.LogError("Error opening OpenNI context: " + ex.Message);
            return;
        }

        // add license manually if not loading from XML
        if (!LoadFromXML)
        {
            License ll = new License();
            ll.Key    = LicenseKey;
            ll.Vendor = LicenseVendor;
            context.AddLicense(ll);
        }

        if (LoadFromRecording)
        {
            context.OpenFileRecordingEx(RecordingFilename);
            Player player = openNode(NodeType.Player) as Player;
            player.PlaybackSpeed = 0.0;
            StartCoroutine(ReadNextFrameFromRecording(player));
        }

        this.Depth     = openNode(NodeType.Depth) as DepthGenerator;
        this.mirrorCap = this.Depth.MirrorCapability;
        if (!LoadFromRecording)
        {
            this.mirrorCap.SetMirror(Mirror);
            mirrorState = Mirror;
        }
    }