public static void Add(object o) { if (Contains(o)) { return; } CleanReferences(); references.Add(new WeakReference(o)); Type type = o.GetType(); if (type == typeof(HvrActor)) { if (onActorAdded != null) { onActorAdded((HvrActor)o); } } if (type == typeof(HvrRender)) { HvrRender render = (HvrRender)o; List <HvrActor> actors = new List <HvrActor>(); GetObjects(actors); foreach (HvrActor actor in actors) { render.AddHvrActor(actor); } } }
public void RenderCamera(HvrRender hvrRender, HVRViewportInterface viewport, bool resizedViewport = false) { // If the Unity viewport has been resized and an OpenGL renderer // is in use then Unity will have recreated the main OpenGL // context so all framebuffer and vertex attribute objects that // are not shareable need to be destroyed and recreated. // // The extra call to `PlayerInterface.PreRender()` in this case is // to make sure that the vertex buffers are populated for the // render call below to avoid flickering. if (resizedViewport) { StaticInterface.Self().ResetFrameBuffersAndMeshes(); PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface); PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface); } Update(); LateUpdate(); if (!SceneInterface.Self().sceneHasPreRendered) { PlayerInterface.PreRender(SceneInterface.Self().hvrSceneInterface); SceneInterface.Self().sceneHasPreRendered = true; } PlayerInterface.Render(SceneInterface.Self().hvrSceneInterface, viewport); }
public static void WillRender() { foreach (WeakReference weak in references) { if (weak.IsAlive) { Type type = weak.Target.GetType(); if (type == typeof(HvrRender)) { HvrRender render = (HvrRender)weak.Target; render.WillRender(); } else if (type == typeof(HvrLight)) { HvrLight light = (HvrLight)weak.Target; light.WillRender(); } } } }