Skip to content
Snippets Groups Projects
Commit 76b5fea1 authored by stendler's avatar stendler
Browse files

removed debugging and deactivated camera on non-mobile

we won't have a funcitoning camera on our demo-laptop. and if we had one you would just see yourself.

Needs a merge later with the UI stuff to get the correct rotation of the picture though.

debugging removed as we removed the canvas already and we have nullReferences now.
parent f4000927
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ namespace MemoryBox.arScene.Scripts
var mesh = AssetDatabase.LoadAssetAtPath<Mesh>(path + "20.wav.obj");
var material = AssetDatabase.LoadAssetAtPath<Material>("Assets"+ s + "MemoryBox" + s + "Materials" + s + "Thunderstorm.mat");
AddMemstone("01", 52.52625f, 13.40070f, mesh, material);
Logger.AddDebug("test memstone added - "+(mesh!=null)+"/"+(material!=null)+" - "+path);
//Logger.AddDebug("test memstone added - "+(mesh!=null)+"/"+(material!=null)+" - "+path);
}
}
}
......@@ -31,7 +31,7 @@ namespace MemoryBox.arScene.Scripts
// may need to situational based on rotation ?
GameObject cameraParent = new GameObject ("camParent");
DebugInfo.AddDebug("camParent");
//DebugInfo.AddDebug("camParent");
cameraParent.transform.position = transform.position;
transform.parent = cameraParent.transform;
......@@ -39,31 +39,36 @@ namespace MemoryBox.arScene.Scripts
cameraParent.transform.Rotate (Vector3.right, 90);
}
DebugInfo.AddDebug("camParent transformed");
//DebugInfo.AddDebug("camParent transformed");
Input.gyro.enabled = true;
DebugInfo.AddDebug("gyro enabled");
//DebugInfo.AddDebug("gyro enabled");
// adjust rotation of visible area
Input.compass.enabled = true;
VisibleAreaContainer.transform.rotation = Quaternion.Euler(0, -Input.compass.magneticHeading, 0);
_webCameraTexture = new WebCamTexture();
if (Application.isMobilePlatform)
{
WebCameraPlane.GetComponent<Renderer>().material.mainTexture = _webCameraTexture;
_webCameraTexture.filterMode = FilterMode.Trilinear; // quality >? performance
// this reports very low values at the initilization
DebugInfo.AddDebug(_webCameraTexture.width+"x"+_webCameraTexture.height);
//DebugInfo.AddDebug(_webCameraTexture.width+"x"+_webCameraTexture.height);
}
// set webCamPanel screen size
PlaneResize();
DebugInfo.AddDebug("Plane resized");
//DebugInfo.AddDebug("Plane resized");
if (Application.isMobilePlatform)
{
_webCameraTexture.Play();
DebugInfo.AddDebug("camera plays");
//DebugInfo.AddDebug("camera plays");
}
//InvokeRepeating("RecalculateCameraResolution", 0.5f, 2f);
}
......@@ -72,16 +77,16 @@ namespace MemoryBox.arScene.Scripts
{
// this does not seem to work well with gyro activated and eg looking down (at least after initialization)
var distance = Vector3.Distance(WebCameraPlane.transform.position, transform.position);
DebugInfo.AddDebug(distance.ToString());
//DebugInfo.AddDebug(distance.ToString());
var v3ViewPort = new Vector3(0, 0, distance);
var v3BottomLeft = Camera.main.ViewportToWorldPoint(v3ViewPort);
v3ViewPort.Set(1, 1, distance);
var v3TopRight = Camera.main.ViewportToWorldPoint(v3ViewPort);
DebugInfo.AddDebug(v3BottomLeft.ToString());
DebugInfo.AddDebug(v3TopRight.ToString());
//DebugInfo.AddDebug(v3BottomLeft.ToString());
//DebugInfo.AddDebug(v3TopRight.ToString());
WebCameraPlane.transform.localScale = new Vector3(-v3BottomLeft.x / 4, 1, -v3BottomLeft.y / 4);
ScreenInfo.SetText(Display.main.renderingWidth+"x"+Display.main.renderingHeight);
//ScreenInfo.SetText(Display.main.renderingWidth+"x"+Display.main.renderingHeight);
if(_webCameraTexture != null && _camInitialized)
RecalculateCameraResolution();
......@@ -94,16 +99,16 @@ namespace MemoryBox.arScene.Scripts
if (x / z > z / x)
{
DebugInfo.AddDebug("height=?"+z/x*_webCameraTexture.width);
//DebugInfo.AddDebug("height=?"+z/x*_webCameraTexture.width);
_webCameraTexture.requestedHeight = (int)(z / x * _webCameraTexture.width);
}
else
{
DebugInfo.AddDebug("width=?"+x/z*_webCameraTexture.height);
//DebugInfo.AddDebug("width=?"+x/z*_webCameraTexture.height);
_webCameraTexture.requestedWidth = (int)(x / z * _webCameraTexture.height);
}
// check whether the camera resolution gets changed at all after our request
CameraInfo.SetText(_webCameraTexture.width+"x"+_webCameraTexture.height);
//CameraInfo.SetText(_webCameraTexture.width+"x"+_webCameraTexture.height);
}
// Update is called once per frame
......@@ -137,13 +142,13 @@ namespace MemoryBox.arScene.Scripts
}
else if (_webCameraTexture != null &&
(_webCameraTexture.width > 100 || _webCameraTexture.height > 100)
|| WebCamTexture.devices.Length < 1)
|| WebCamTexture.devices.Length < 1 || !Application.isMobilePlatform)
{
// show actual screen content after camera initialisation
// also resolution stuff
// eg resizing the plane or request a different camera resolution
RecalculateCameraResolution();
_toggleInitPanel();
//_toggleInitPanel();
_camInitialized = true; // do this all just once
}
}
......@@ -153,7 +158,7 @@ namespace MemoryBox.arScene.Scripts
var image = InitPanel.GetComponent<Image>();
if (image == null) return;
image.enabled = !image.enabled;
DebugInfo.AddDebug("init panel toggled");
//DebugInfo.AddDebug("init panel toggled");
}
public void ToggleWebCam()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment