Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

Commit

Permalink
GVR Unity SDK v0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smdol committed Aug 4, 2016
1 parent 6ed9087 commit e88afaf
Show file tree
Hide file tree
Showing 83 changed files with 167 additions and 751 deletions.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/ControllerDebugInfo.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/ControllerDemo.unity
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/ControllerDemoManager.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/CubeActiveMaterial.mat
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/CubeHoverMaterial.mat
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/CubeInactiveMaterial.mat
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/Cursor.mat
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/GroundPlaneTranslucent.mat
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/ControllerDemo/GroundPlaneTranslucent.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified GoogleVR/DemoScenes/HeadsetDemo/CubeSound.wav
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/HeadsetDemo/DemoScene.unity
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/HeadsetDemo/FPS.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/HeadsetDemo/GroundPlane.mat
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/HeadsetDemo/GroundPlane.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified GoogleVR/DemoScenes/HeadsetDemo/Teleport.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/DemoScenes/README.md
100755 → 100644
Empty file.
7 changes: 5 additions & 2 deletions GoogleVR/Distortion/GvrDistortion.cginc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ float4 undistortVertex(float4 pos) {
}

// Surface shader hides away the MVP multiplication, so we have
// to multiply by _FixProjection = inverse(MVP)*_RealProjection.
// to multiply by _FixProjection = inverse(VP)*_RealProjection
// and then by inverse(M), in order to cancel it out and leave our
// own transform in place.
float4 undistortSurface(float4 pos) {
return mul(_FixProjection, undistort(pos));
float4 proj = mul(_FixProjection, undistort(pos));
return mul(_World2Object, proj);
}

#else
Expand Down
Empty file modified GoogleVR/Editor/GvrAudioListenerEditor.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Editor/GvrAudioRoomEditor.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Editor/GvrAudioSoundfieldEditor.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Editor/GvrAudioSourceEditor.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Editor/GvrGazeEditor.cs
100755 → 100644
Empty file.
267 changes: 0 additions & 267 deletions GoogleVR/LICENSE

This file was deleted.

Empty file modified GoogleVR/Legacy/Editor/GvrMenu.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Editor/GvrViewerEditor.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Editor/StereoControllerEditor.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Prefabs/GvrAdapter.prefab
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Prefabs/GvrHead.prefab
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Prefabs/GvrMain.prefab
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Prefabs/GvrManager.prefab
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/README.md
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Resources/SolidColor.shader
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Resources/UnlitTexture.shader
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/GvrHead.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/GvrCameraUtils.cs
100755 → 100644
Empty file.
28 changes: 14 additions & 14 deletions GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void Start() {
// Save reference to the found controller and it's camera.
controller = ctlr;
monoCamera = controller.GetComponent<Camera>();
UpdateStereoValues();
SetupStereo(/*forceUpdate=*/true);
}

public void UpdateStereoValues() {
Expand Down Expand Up @@ -135,24 +135,24 @@ public void UpdateStereoValues() {
}
}

private void SetupStereo() {
private void SetupStereo(bool forceUpdate) {
GvrViewer.Instance.UpdateState();

bool updateValues = forceUpdate // Being called from Start(), most likely.
|| controller.keepStereoUpdated // Parent camera may be animating.
|| GvrViewer.Instance.ProfileChanged // New QR code.
|| cam.targetTexture == null
&& GvrViewer.Instance.StereoScreen != null ; // Need to (re)assign targetTexture.
if (updateValues) {
// Set projection, viewport and targetTexture.
UpdateStereoValues();
}

// Will need to update view transform if there is a COI, or if there is a remnant of
// prior stereo-adjustment smoothing to finish off.
bool haveCOI = controller.centerOfInterest != null
&& controller.centerOfInterest.gameObject.activeInHierarchy;
bool updatePosition = haveCOI || interpPosition < 1;

if (controller.keepStereoUpdated || GvrViewer.Instance.ProfileChanged
|| cam.targetTexture == null && GvrViewer.Instance.StereoScreen != null) {
// Set projection and viewport.
UpdateStereoValues();
// Also view transform.
updatePosition = true;
}

if (updatePosition) {
if (updateValues || haveCOI || interpPosition < 1) {
// Set view transform.
float proj11 = cam.projectionMatrix[1, 1];
float zScale = transform.lossyScale.z;
Expand Down Expand Up @@ -183,7 +183,7 @@ void OnPreCull() {
cam.enabled = false;
return;
}
SetupStereo();
SetupStereo(/*forceUpdate=*/false);
if (!controller.directRender && GvrViewer.Instance.StereoScreen != null) {
// Some image effects clobber the whole screen. Add a final image effect to the chain
// which restores side-by-side stereo.
Expand Down
Empty file modified GoogleVR/Legacy/Scripts/Internal/GvrPostRender.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/GvrPreRender.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/GvrProfile.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/StereoController.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/VRDevices/AndroidDevice.cs
100755 → 100644
Empty file.
Empty file modified GoogleVR/Legacy/Scripts/Internal/VRDevices/BaseAndroidDevice.cs
100755 → 100644
Empty file.
2 changes: 0 additions & 2 deletions GoogleVR/Legacy/Scripts/Internal/VRDevices/BaseVRDevice.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ protected BaseVRDevice() {
public abstract void SetDistortionCorrectionEnabled(bool enabled);

public abstract void SetNeckModelScale(float scale);
public abstract void SetElectronicDisplayStabilizationEnabled(bool enabled);

public virtual bool SupportsNativeDistortionCorrection(List<string> diagnostics) {
return true;
Expand Down Expand Up @@ -146,7 +145,6 @@ public Rect GetViewport(GvrViewer.Eye eye,
protected int leftEyeOrientation;
protected int rightEyeOrientation;

public bool triggered;
public bool tilted;
public bool profileChanged;
public bool backButtonPressed;
Expand Down
2 changes: 0 additions & 2 deletions GoogleVR/Legacy/Scripts/Internal/VRDevices/EditorDevice.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public override bool SupportsNativeUILayer(List<string> diagnostics) {
public override void SetVRModeEnabled(bool enabled) {}
public override void SetDistortionCorrectionEnabled(bool enabled) {}
public override void SetNeckModelScale(float scale) {}
public override void SetElectronicDisplayStabilizationEnabled(bool enabled) {}

private Quaternion initialRotation = Quaternion.identity;

Expand Down Expand Up @@ -91,7 +90,6 @@ public override void UpdateState() {
var neck = (rot * neckOffset - neckOffset.y * Vector3.up) * GvrViewer.Instance.NeckModelScale;
headPose.Set(neck, rot);

triggered = Input.GetMouseButtonDown(0);
tilted = Input.GetKeyUp(KeyCode.Escape);
}

Expand Down
Loading

0 comments on commit e88afaf

Please sign in to comment.