当前位置: 首页>>代码示例>>C#>>正文


C# Context.OpenFileRecordingEx方法代码示例

本文整理汇总了C#中OpenNI.Context.OpenFileRecordingEx方法的典型用法代码示例。如果您正苦于以下问题:C# Context.OpenFileRecordingEx方法的具体用法?C# Context.OpenFileRecordingEx怎么用?C# Context.OpenFileRecordingEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenNI.Context的用法示例。


在下文中一共展示了Context.OpenFileRecordingEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

    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;
        }
    }
开发者ID:CodeStrumpet,项目名称:Elemental,代码行数:34,代码来源:OpenNIContext.cs

示例2: Init

    // public methods

    /// @brief Initialize the context object
    /// 
    /// This method initializes the context. It is assumed that this would be done once on the
    /// beginning of the game. Note that this is called on the singleton so multiple initializations
    /// will simply do nothing (which might cause problems with other objects). If for some reason a new
    /// initialization is needed, the @ref Dispose method should be called first (however ALL
    /// other initializations will be required first such as reinitializing the nodes). Also, it is assumed that
    /// every node created externally using the @ref CreateNode method will be released (using the @ref ReleaseNode
    /// method) BEFORE releasing the context.
    /// @param logger the logger object we will enter logs into
    /// @param query A query limiting the nodes found.
    /// @param xmlFileName this will hold an xml file to initialize from. A null or empty filename
    /// will simply be ignored and the object will be built without it. An illegal filename will cause
    /// an exception!
    /// @param recordingFilename This holds the filename for playing a recording.
    /// @ref OpenNIRecordAndPlayback "Recording and playing back sensor data").
    /// @return true on success, false on failure. 
    /// @note if the context was already initialized this will fail but the context would be valid!
    /// @note This implementation assumes that a depth generator is required for ALL uses including
    /// the creation of the skeleton. In theory, it is possible that some implementations will not 
    /// require a depth generator. This is currently not supported.
    public virtual bool Init(NIEventLogger logger, NIQuery query, string xmlFileName, string recordingFilename)
    {
        if (Valid)
        {
            if(logger!=null)
                logger.Log("trying to initialized a valid context!", NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects,NIEventLogger.VerboseLevel.Warning);
            return false; // failed to initialize
        }
        if (InitLogger(logger) == false)
        {
            Dispose();
            return false; // we failed an initialization step.
        }
        Log("In OpenNIContext.InitContext with logger=" + logger + " query=" + query, NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects, NIEventLogger.VerboseLevel.Verbose);
        if(m_context!=null || m_scriptNode!=null || m_depth!=null)
            throw new System.Exception("valid is false but internal structures are not null! m_context=" + m_context + " m_scriptNode=" + m_scriptNode + " m_depth=" + m_depth);
        m_Logger = logger;
        m_query = query;
        if (xmlFileName != null && xmlFileName.CompareTo("")!=0)
        {
            try
            {
                NIOpenNICheckVersion.Instance.ValidatePrerequisite();
                m_context = Context.CreateFromXmlFile(xmlFileName, out m_scriptNode);
                m_recordingPlayer = m_context.FindExistingNode(NodeType.Player) as Player;
            }
            catch (System.Exception ex)
            {
                Debug.Log(ex.Message);
                Log("failed to create from xmlFile!", NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects,NIEventLogger.VerboseLevel.Errors);
                Dispose();
                return false;
            }
            if (recordingFilename != null && recordingFilename.CompareTo("") != 0)
            {
                Log("Both xml and recording were defined. Ignoring recording information and using XML only!", NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects, NIEventLogger.VerboseLevel.Warning);
            }
         
        }
        else
        {
            try
            {
                NIOpenNICheckVersion.Instance.ValidatePrerequisite();
                m_context = new Context();
                if (recordingFilename != null && recordingFilename.CompareTo("") != 0)
                {
                    try
                    {
                        m_recordingPlayer = m_context.OpenFileRecordingEx(recordingFilename) as Player;
                    }
                    catch (System.Exception ex)
                    {
                        Debug.Log(recordingFilename);
                        Log("Failed to create recorder with message " + ex.Message, NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects, NIEventLogger.VerboseLevel.Errors);
                        Dispose();
                        return false;
                    }
                    
                }
            }
            catch (System.Exception ex)
            {
                if (ex as System.DllNotFoundException != null)
                {
                    throw new System.DllNotFoundException("The dll for OpenNI is not there. Please install OpenNI (using the mega installer");
                }
                else Debug.Log(ex.Message);
            }
            
        }
		if (m_context==null)
		{
            Log("failed to create a context!", NIEventLogger.Categories.Initialization, NIEventLogger.Sources.BaseObjects, NIEventLogger.VerboseLevel.Errors);
            Dispose();
			return false;
		}
//.........这里部分代码省略.........
开发者ID:znjRoLS,项目名称:RUISAircraftGunner,代码行数:101,代码来源:NIContext.cs


注:本文中的OpenNI.Context.OpenFileRecordingEx方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。