Exemple #1
0
    void Start()
    {
        m_time         = 0.0f;
        m_forceRefresh = true;

        AbcSetLastUpdateState(AbcTime(0.0f), AbcAPI.GetAspectRatio(m_aspectRatioMode));
    }
 public override void AbcGetConfig(ref AbcAPI.aiConfig config)
 {
     if (m_aspectRatioMode != AbcAPI.aiAspectRatioModeOverride.InheritStreamSetting)
     {
         config.aspectRatio = AbcAPI.GetAspectRatio((AbcAPI.aiAspectRatioMode)m_aspectRatioMode);
     }
 }
Exemple #3
0
    void AbcSyncConfig()
    {
        m_config.swapHandedness      = m_swapHandedness;
        m_config.swapFaceWinding     = m_swapFaceWinding;
        m_config.normalsMode         = m_normalsMode;
        m_config.tangentsMode        = m_tangentsMode;
        m_config.cacheTangentsSplits = true;
        m_config.aspectRatio         = AbcAPI.GetAspectRatio(m_aspectRatioMode);
        m_config.forceUpdate         = false; // m_forceRefresh; ?
        m_config.useThreads          = m_useThreads;
        m_config.cacheSamples        = m_sampleCacheSize;
        m_config.submeshPerUVTile    = m_submeshPerUVTile;

        if (AbcIsValid())
        {
            AbcAPI.aiSetConfig(m_abc, ref m_config);
        }
    }
Exemple #4
0
    void AbcUpdateBegin(float time)
    {
        if (m_lastLogToFile != m_logToFile ||
            m_lastLogPath != m_logPath)
        {
            AbcAPI.aiEnableFileLog(m_logToFile, m_logPath);

            m_lastLogToFile = m_logToFile;
            m_lastLogPath   = m_logPath;
        }

        if (!m_loaded && m_pathToAbc != null)
        {
            // We have lost the alembic context, try to recover it
            m_loaded = AbcRecoverContext();
        }

        if (m_loaded)
        {
            if (!AbcIsValid())
            {
                // We have lost the alembic context, try to recover
                m_loaded = AbcRecoverContext();
                if (!m_loaded)
                {
                    Debug.LogWarning("AlembicStream.AbcUpdate: Lost alembic context");

                    return;
                }
            }

            m_time = time;

            float abcTime     = AbcTime(m_time);
            float aspectRatio = AbcAPI.GetAspectRatio(m_aspectRatioMode);

            if (AbcUpdateRequired(abcTime, aspectRatio))
            {
                if (m_verbose)
                {
                    Debug.Log("AlembicStream.AbcUpdate: t=" + m_time + " (t'=" + abcTime + ")");
                }

                if (m_pathToAbc != m_lastPathToAbc)
                {
                    if (m_verbose)
                    {
                        Debug.Log("AlembicStream.AbcUpdate: Path to alembic file changed");
                    }

                    AbcDetachElements();

                    AbcAPI.aiDestroyContext(m_abc);

                    m_elements.Clear();

                    AbcLoad(true);

                    AbcCleanupTree();
                }
                else
                {
                    AbcSyncConfig();

                    if (m_useThreads)
                    {
                        AbcAPI.aiUpdateSamplesBegin(m_abc, abcTime);
                        m_updateBegan = true;
                    }
                    else
                    {
                        AbcAPI.aiUpdateSamples(m_abc, abcTime);
                        AbcUpdateElements();
                    }
                }

                AbcSetLastUpdateState(abcTime, aspectRatio);
            }
        }
    }