コード例 #1
0
        // sync
        public override void usdiUpdate(double time)
        {
            if (!m_needsUpdate)
            {
                return;
            }
            base.usdiUpdate(time);

            if (m_asyncRead != null)
            {
                m_asyncRead.Wait();
            }

            if (m_needsUploadMeshData)
            {
                usdi.usdiUniMeshAssignBounds(m_umesh, ref m_meshData.center, ref m_meshData.extents);

                //// fall back
                // m_umesh.bounds = new Bounds(m_meshData.center, m_meshData.extents);
            }

            if (m_needsAllocateMeshData && m_frame == 0)
            {
                bool close = m_meshSummary.topology_variance == usdi.TopologyVariance.Constant;
                usdiUploadMeshData(time, true, close);
            }

            bool active = isActiveAndEnabled && m_renderer.isVisible;

            if (m_directVBUpdate)
            {
                if (m_vuCmd == null)
                {
                    m_vuCmd = new usdi.VertexUpdateCommand(usdi.usdiGetNameS(m_mesh));
                }

                if (active)
                {
                    m_vuCmd.Update(ref m_meshData, m_VB, m_IB);
                }
            }
            else
            {
                if (active && m_needsUploadMeshData && m_frame > 1 && !m_directVBUpdate)
                {
                    bool updateIndices = m_meshSummary.topology_variance == usdi.TopologyVariance.Heterogenous;
                    usdiUploadMeshData(m_timeRead, updateIndices, false);
                }
            }

            ++m_frame;
        }
コード例 #2
0
        public void usdiKickVBUpdateTask(ref usdi.SubmeshData data, bool updateIndices)
        {
            bool active = m_renderer.isVisible;

            if (active)
            {
                if (m_vuCmd == null)
                {
                    m_vuCmd = new usdi.VertexUpdateCommand(usdi.usdiPrimGetNameS(m_schema));
                }
                m_vuCmd.Update(ref data, m_VB, updateIndices ? m_IB : IntPtr.Zero);
            }
        }