Ejemplo n.º 1
0
        public void Process(Component[] comps)
        {
            float uniformScale = room.UniformScale;

            for (int i = 0; i < comps.Length; i++)
            {
                Component comp = comps[i];
                if (!comp)
                {
                    continue;
                }

                if (comp is JanusVREntryPortal)
                {
                    JanusVREntryPortal portal          = (JanusVREntryPortal)comp;
                    Transform          portalTransform = portal.transform;

                    Vector3 portalPos = JanusUtil.ConvertPosition(portal.GetJanusPosition(), uniformScale);
                    Vector3 xDir, yDir, zDir;

                    Quaternion rot = portalTransform.rotation;
                    //rot.eulerAngles += new Vector3(0, 180, 0);
                    JanusUtil.GetJanusVectors(rot, out xDir, out yDir, out zDir);

                    room.PortalPos  = portalPos;
                    room.PortalXDir = xDir;
                    room.PortalYDir = yDir;
                    room.PortalZDir = zDir;
                }
                else if (comp is JanusVRLink)
                {
                    JanusVRLink link = (JanusVRLink)comp;

                    Transform trans = link.transform;
                    Vector3   pos = JanusUtil.ConvertPosition(link.GetJanusPosition(), uniformScale);
                    Vector3   sca = trans.localScale;
                    Vector3   xDir, yDir, zDir;
                    JanusUtil.GetJanusVectors(trans.rotation, out xDir, out yDir, out zDir);

                    LinkObject linkObj = new LinkObject();
                    linkObj.pos   = pos;
                    linkObj.xDir  = xDir;
                    linkObj.yDir  = yDir;
                    linkObj.zDir  = zDir;
                    linkObj.col   = link.Color;
                    linkObj.scale = sca;
                    linkObj.url   = link.url;
                    linkObj.title = link.title;
                    //linkObj.image_id = link.url;

                    Material mat = link.meshRenderer.sharedMaterial;
                    Texture  tex = mat.mainTexture;
                    if (tex != null)
                    {
                    }

                    room.AddLinkObject(linkObj);
                }
            }
        }
Ejemplo n.º 2
0
        private static void CreateEntryPortal()
        {
            GameObject go = new GameObject("JanusVR Link");

            go.transform.localScale = new Vector3(1.8f, 2.5f, 1);

            MeshRenderer renderer = go.AddComponent <MeshRenderer>();
            MeshFilter   filter   = go.AddComponent <MeshFilter>();

            renderer.receiveShadows    = false;
            renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            filter.sharedMesh          = JanusResources.PlaneMesh;

            Material mat = Material.Instantiate(AssetDatabase.GetBuiltinExtraResource <Material>("Default-Diffuse.mat"));

            renderer.sharedMaterial = mat;

            JanusVRLink portal = go.AddComponent <JanusVRLink>();

            portal.meshRenderer = renderer;
            portal.filter       = filter;
        }
Ejemplo n.º 3
0
 public void OnEnable()
 {
     instance = (JanusVRLink)target;
 }