public setARCameraProjection ( |
||
i_camera | ||
return | void |
void Awake() { if (WebCamTexture.devices.Length <= 0) { return; } var wcTexture = new WebCamTexture(320, 240, 15); _device = NyARUnityWebCam.CreateInstance(wcTexture); _panel.material.mainTexture = wcTexture; var config = new NyARMarkerSystemConfig(_device.width, _device.height); _arSystem = new NyARUnityMarkerSystem(config); _arSystem.setARBackgroundTransform(_panel.transform); _arSystem.setARCameraProjection(_camera); foreach (var model in GetModels()) { model.MarkerSetup(this); } _device.Start(); }
void Awake() { // Check PS Eye number try { int psEyeCount = PSEyeTexture.CLEyeGetCameraCount(); switch (psEyeCount) { case 0: Debug.LogError("No PS Eye found"); return; case 1: Debug.LogError("Only one PS Eye found"); return; } } catch (Exception e) { Debug.LogError("Oops..., Failed at loading CLEyeMulticam.dll. Please relaunch Unity!"); Debug.LogError(e.ToString()); return; } // Make PS Eye texture var PsEyeTexture = new PSEyeTexture(PsEyeId, FrameRate, true); psEye_ = new NyARUnityPSEye(PsEyeTexture); // Marker system var config = new NyARMarkerSystemConfig(PsEyeTexture.Width, PsEyeTexture.Height); markerSystem_ = new NyARUnityMarkerSystem(config); // Load marker from texture var markerTexture = (Texture2D)(Resources.Load(MarkerName, typeof(Texture2D))); markerId_ = markerSystem_.addARMarker(markerTexture, 16, 25, 80); // Marker layer MarkerObject.layer = Layer; for (int i = 0; i < MarkerObject.transform.GetChildCount(); ++i) { MarkerObject.transform.GetChild(i).gameObject.layer = Layer; } // Set camera background Background.renderer.material.mainTexture = PsEyeTexture.Texture; Background.layer = Layer; ARCamera.cullingMask &= ~(1 << HiddenLayer); markerSystem_.setARBackgroundTransform(Background.transform); markerSystem_.setARCameraProjection(ARCamera); }