Exemplo n.º 1
0
 /// <summary>
 /// Get the MRMarker data for this SynthesizedMarker
 /// </summary>
 /// <returns>The MRMarker data</returns>
 public override MRMarker GetData()
 {
     m_Marker.pose    = m_PoseSource.GetTraitData();
     m_Marker.extents = m_ExtentsSource.GetTraitData();
     // synth markers default to tracking so that they always work in the content scene & instant sim.
     // for play mode / temporal sim, it's up to the provider to modify the tracking state after this.
     m_Marker.trackingState = MARSTrackingState.Tracking;
     return(m_Marker);
 }
Exemplo n.º 2
0
        void UpdatePlaneFromData()
        {
            if (m_UseMRPlaneMesh)
            {
                m_GeneratedPlane = m_RuntimePlane;
                var localScale = transform.localScale;

                // We duplicate the vertices here since the original list is serialized with the base plane
                if (localScale != Vector3.one && m_GeneratedPlane.vertices != null)
                {
                    m_GeneratedPlane.vertices = m_GeneratedPlane.vertices.ToList();
                }

                ScaleVertices(m_GeneratedPlane.vertices, localScale);
            }
            else
            {
                m_GeneratedPlane = new MRPlane {
                    id = m_RuntimePlane.id
                };

                if (m_OriginalMesh != null)
                {
                    var vertices       = m_OriginalMesh.vertices.ToList();
                    var verticesLength = vertices.Count;

                    ScaleVertices(vertices, transform.localScale);

                    var indices   = new List <int>(verticesLength * 3);
                    var normals   = new List <Vector3>(verticesLength);
                    var texCoords = new List <Vector2>(verticesLength);

                    PlaneUtils.TriangulatePlaneFromVertices(m_GeneratedPlane.pose, vertices, indices, normals, texCoords);

                    indices.TrimExcess();

                    // Mesh data is not initialized when MR Plane is created
                    m_GeneratedPlane.vertices           = vertices;
                    m_GeneratedPlane.indices            = indices;
                    m_GeneratedPlane.normals            = normals;
                    m_GeneratedPlane.textureCoordinates = texCoords;
                }
            }

            // Traits from other synthesized data
            m_GeneratedPlane.pose      = m_PoseSource.GetTraitData();
            m_GeneratedPlane.alignment = (MarsPlaneAlignment)m_AlignmentSource.GetTraitData();
            m_GeneratedPlane.extents   = m_ExtentsSource.GetTraitData();

            m_MRPlaneGenerated = true;
        }
Exemplo n.º 3
0
 public override MRReferencePoint GetData()
 {
     m_ReferencePoint.pose = m_PoseSource.GetTraitData();
     return(m_ReferencePoint);
 }