public IImage GetThumbnail() { if (thumbnail == null) { thumbnail = renderService.CreateRenderTargetImage(ThumbnailSize); renderService.Render(thumbnail, new [] { Viewport.Create(IntVector2.Zero, ThumbnailSize, ThumbnailView.Create(this)) }, 0); } else if (thumbnailDirty) { renderService.Render(thumbnail, new[] { Viewport.Create(IntVector2.Zero, ThumbnailSize, ThumbnailView.Create(this)) }, 0); } thumbnailDirty = false; return(thumbnail); }
public void Initialize() { minimap = GameObject.CreatePrimitive(PrimitiveType.Quad); minimap.name = "Minimap"; minimap.transform.SetParent(globalObjectService.VrLeftHand.transform, false); minimap.transform.localRotation = Quaternion.AngleAxis(75.0f, Vector3.right); minimap.transform.localPosition = new Vector3(0.0F, -0.1F, 0.25F); minimap.transform.localScale = new Vector3(0.8f, -0.4f, 1f); var material = new Material(Shader.Find("Unlit/Texture")); rttImge = (UcRenderTextureImage)renderService.CreateRenderTargetImage(MinimapImageSize); material.mainTexture = rttImge.Texture; minimap.transform.GetComponent <MeshRenderer>().material = material; var textCanvasObj = new GameObject("Minimap - Text Above"); textCanvasObj.transform.SetParent(minimap.transform, false); //textAbove.transform.localRotation = Quaternion.AngleAxis(75.0f, Vector3.right); //textAbove.transform.localPosition = new Vector3(0.0F, 1F, 0.25F); //textAbove.transform.localScale var canvas = textCanvasObj.AddComponent <Canvas>(); canvas.renderMode = RenderMode.WorldSpace; var textAboveTransform = textCanvasObj.GetComponent <RectTransform>(); textAboveTransform.localPosition = new Vector3(0, -0.6f, 0); textAboveTransform.localScale = new Vector3(1.25f, -2.5f, 1); textAboveTransform.sizeDelta = new Vector2(100, 100); var canvasScaler = textCanvasObj.AddComponent <CanvasScaler>(); canvasScaler.dynamicPixelsPerUnit = 100; var textObject = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/MinimapTextPrefab")); textObject.transform.SetParent(textCanvasObj.transform, false); textAbove = textObject.GetComponent <Text>(); var textTransform = textAbove.GetComponent <RectTransform>(); textAbove.text = ""; var storyGraphView = AmFactory.Create <StoryGraphView>(); var viewport = AmFactory.Create <Viewport>(); viewport.Width = MinimapImageSize.Width; viewport.Height = MinimapImageSize.Height; viewport.View = storyGraphView; viewports = new IViewport[] { viewport }; laser = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Laser")); SetEnabled(false); }