예제 #1
0
        public void StartRecording(IStreamSettings streamSettings, int take)
        {
            var playbackBuffer = new PlaybackBuffer(streamSettings)
            {
                name = string.Format("{0:yyyy_MM_dd_HH_mm}-Take{1:00}", DateTime.Now, take)
            };

            Debug.Log(string.Format("Starting take: {0}", playbackBuffer.name));

            m_ActivePlaybackBuffer = playbackBuffer;

            var bufferSize = streamSettings.bufferSize;

            if (bufferSize != m_CurrentBufferSize)
            {
                m_BufferQueue.Clear();
            }

            m_CurrentBufferSize = bufferSize;
            new Thread(() =>
            {
                while (m_ActivePlaybackBuffer != null)
                {
                    if (m_BufferQueue.Count < k_MinBufferAmount)
                    {
                        for (var i = 0; i < k_BufferCreateAmount; i++)
                        {
                            m_BufferQueue.Enqueue(new byte[m_CurrentBufferSize]);
                        }
                    }

                    Thread.Sleep(1);
                }
            }).Start();
        }
        public void UpdateBlendShapeIndices(IStreamSettings settings)
        {
            m_LastStreamSettings = settings;
            var locations       = settings.locations;
            var blendShapeCount = locations.Length;

            m_BlendShapes     = new float[blendShapeCount];
            blendShapesScaled = new float[blendShapeCount];
            m_Indices.Clear();
            var streamSettings = streamReader.streamSource.streamSettings;

            foreach (var meshRenderer in m_SkinnedMeshRenderers)
            {
                var mesh    = meshRenderer.sharedMesh;
                var count   = mesh.blendShapeCount;
                var indices = new BlendShapeIndexData[count];
                for (var i = 0; i < count; i++)
                {
                    var shapeName = mesh.GetBlendShapeName(i);
                    var index     = -1;
                    foreach (var mapping in streamSettings.mappings)
                    {
                        var to   = mapping.to;
                        var from = mapping.from;
                        if (shapeName.Contains(from))
                        {
                            index = Array.IndexOf(streamSettings.locations, from);
                        }

                        if (shapeName.Contains(to))
                        {
                            index = Array.IndexOf(streamSettings.locations, from);
                        }
                    }

                    if (index < 0)
                    {
                        for (var j = 0; j < streamSettings.locations.Length; j++)
                        {
                            if (shapeName.Contains(streamSettings.locations[j]))
                            {
                                index = j;
                                break;
                            }
                        }
                    }

                    indices[i] = new BlendShapeIndexData(index, shapeName);

                    if (index < 0)
                    {
                        Debug.LogWarningFormat("Blend shape {0} is not a valid AR blend shape", shapeName);
                    }
                }

                m_Indices.Add(meshRenderer, indices);
            }
        }
예제 #3
0
 public void UpdateBlendShapeIndices(IStreamSettings settings)
 {
     m_LastStreamSettings    = settings;
     m_EyeLookDownLeftIndex  = settings.GetLocationIndex(BlendShapeUtils.EyeLookDownLeft);
     m_EyeLookDownRightIndex = settings.GetLocationIndex(BlendShapeUtils.EyeLookDownRight);
     m_EyeLookInLeftIndex    = settings.GetLocationIndex(BlendShapeUtils.EyeLookInLeft);
     m_EyeLookInRightIndex   = settings.GetLocationIndex(BlendShapeUtils.EyeLookInRight);
     m_EyeLookOutLeftIndex   = settings.GetLocationIndex(BlendShapeUtils.EyeLookOutLeft);
     m_EyeLookOutRightIndex  = settings.GetLocationIndex(BlendShapeUtils.EyeLookOutRight);
     m_EyeLookUpLeftIndex    = settings.GetLocationIndex(BlendShapeUtils.EyeLookUpLeft);
     m_EyeLookUpRightIndex   = settings.GetLocationIndex(BlendShapeUtils.EyeLookUpRight);
 }
예제 #4
0
        public PlaybackBuffer(IStreamSettings streamSettings)
        {
            m_BufferSize        = streamSettings.bufferSize;
            m_ErrorCheck        = streamSettings.ErrorCheck;
            m_BlendShapeCount   = streamSettings.BlendShapeCount;
            m_BlendShapeSize    = streamSettings.BlendShapeSize;
            m_HeadPoseOffset    = streamSettings.HeadPoseOffset;
            m_CameraPoseOffset  = streamSettings.CameraPoseOffset;
            m_FrameNumberOffset = streamSettings.FrameNumberOffset;

            m_Locations = streamSettings.locations;
            m_Mappings  = streamSettings.mappings;
        }
예제 #5
0
 public void StartRecording(IStreamSettings settings, int take)
 {
     playbackData.StartRecording(settings, take);
 }
예제 #6
0
 /// <summary>
 /// Used for mapping the the blendshape locations this returns the index of the string in the Locations array.
 /// </summary>
 /// <param name="streamSettings">Stream Setting that contains the Locations array.</param>
 /// <param name="location">Name of blendshape location you want to find.</param>
 /// <returns>Index of string in Locations array.</returns>
 public static int GetLocationIndex(this IStreamSettings streamSettings, string location)
 {
     return(Array.IndexOf(streamSettings.locations, location));
 }