Permalink
Browse files

cardboard working with GVR SDK 1.10.0

  • Loading branch information...
1 parent 7f89148 commit c958737253f86dcef41ecf18037e1c72b826d983 @codeanticode codeanticode committed Jan 4, 2017
Showing with 608 additions and 436 deletions.
  1. +377 −0 libraries/cardboard/.settings/org.eclipse.jdt.core.prefs
  2. +56 −0 libraries/cardboard/.settings/org.eclipse.jdt.ui.prefs
  3. +3 −3 libraries/cardboard/build.xml
  4. +0 −21 libraries/cardboard/examples/Cube/AndroidManifest.xml
  5. +0 −3 libraries/cardboard/examples/Cube/code/sketch.properties
  6. BIN libraries/cardboard/gvrsdk/1.10.0/vr_audio.zip
  7. BIN libraries/cardboard/gvrsdk/1.10.0/vr_base.zip
  8. BIN libraries/cardboard/gvrsdk/1.10.0/vr_common.zip
  9. BIN libraries/cardboard/gvrsdk/cardboard_audio.zip
  10. BIN libraries/cardboard/gvrsdk/cardboard_common.zip
  11. BIN libraries/cardboard/gvrsdk/cardboard_core.zip
  12. BIN libraries/cardboard/lib/cardboard-audio-classes.jar
  13. BIN libraries/cardboard/lib/cardboard-common-classes.jar
  14. BIN libraries/cardboard/lib/cardboard-core-classes.jar
  15. BIN libraries/cardboard/lib/vr_audio-classes.jar
  16. BIN libraries/cardboard/lib/vr_base-classes.jar
  17. BIN libraries/cardboard/lib/vr_common-classes.jar
  18. +9 −9 libraries/cardboard/src/processing/cardboard/PCardboard.java
  19. +5 −3 libraries/cardboard/src/processing/cardboard/PGraphicsCardboard.java
  20. +1 −0 libraries/cardboard/src/processing/cardboard/PGraphicsCardboardMono.java
  21. +1 −0 libraries/cardboard/src/processing/cardboard/PGraphicsCardboardStereo.java
  22. +42 −21 libraries/cardboard/src/processing/cardboard/PSurfaceCardboard.java
  23. +55 −45 scripts/gvrsdk-update.sh
  24. +48 −192 src/processing/mode/android/AndroidBuild.java
  25. +0 −135 src/processing/mode/android/Manifest.java
  26. +0 −1 templates/CardboardActivity.java.tmpl
  27. +2 −3 templates/CardboardManifest.xml.tmpl
  28. +9 −0 templates/StylesCardboard.xml.tmpl
Oops, something went wrong.
@@ -0,0 +1,56 @@
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_processing
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=false
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=false
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
@@ -29,9 +29,9 @@
srcdir="src" destdir="bin"
encoding="UTF-8"
includeAntRuntime="false"
- classpath="lib/cardboard-audio-classes.jar;
- lib/cardboard-common-classes.jar;
- lib/cardboard-core-classes.jar;
+ classpath="lib/vr_base-classes.jar;
+ lib/vr_common-classes.jar;
+ lib/vr_audio-classes.jar;
../../android-core.zip;
${env.ANDROID_SDK}/platforms/android-23/android.jar"
nowarn="true"
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
- <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23"/>
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.NFC"/>
- <uses-permission android:name="android.permission.VIBRATE"/>
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/>
- <uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/>
- <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
- <application android:debuggable="true" android:icon="@drawable/icon" android:label="">
- <activity android:configChanges="orientation|keyboardHidden|screenSize" android:name=".MainActivity" android:screenOrientation="landscape">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- <category android:name="com.google.intent.category.CARDBOARD"/>
- </intent-filter>
- </activity>
- </application>
-</manifest>
@@ -1,3 +0,0 @@
-mode=Android
-component=cardboard
-mode.id=processing.mode.android.AndroidMode
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,16 +22,16 @@
package processing.cardboard;
-import com.google.vrtoolkit.cardboard.CardboardActivity;
-import com.google.vrtoolkit.cardboard.Eye;
+import com.google.vr.sdk.base.GvrActivity;
+import com.google.vr.sdk.base.Eye;
import android.content.Intent;
import android.util.DisplayMetrics;
import processing.android.AppComponent;
import processing.core.PApplet;
// http://pastebin.com/6wPgFYhq
-public class PCardboard extends CardboardActivity implements AppComponent {
+public class PCardboard extends GvrActivity implements AppComponent {
public static final String STEREO = "processing.cardboard.PGraphicsCardboardStereo";
public static final String MONO = "processing.cardboard.PGraphicsCardboardMono";
@@ -40,7 +40,7 @@
public static final int MONOCULAR = Eye.Type.MONOCULAR;
static public final int CARDBOARD = 3;
-
+
private DisplayMetrics metrics;
private PApplet sketch;
@@ -67,14 +67,14 @@ public int getDisplayHeight() {
public int getKind() {
return CARDBOARD;
}
-
+
public void dispose() {
- }
-
+ }
+
public void onPermissionsGranted() {
}
-
+
public void setSketch(PApplet sketch) {
this.sketch = sketch;
}
@@ -129,7 +129,7 @@ public void onPause() {
@Override
public void onDestroy() {
super.onDestroy();
- sketch.onDestroy();
+ sketch.onDestroy();
}
@@ -22,9 +22,9 @@
package processing.cardboard;
-import com.google.vrtoolkit.cardboard.Eye;
-import com.google.vrtoolkit.cardboard.HeadTransform;
-import com.google.vrtoolkit.cardboard.Viewport;
+import com.google.vr.sdk.base.Eye;
+import com.google.vr.sdk.base.HeadTransform;
+import com.google.vr.sdk.base.Viewport;
import processing.core.PMatrix3D;
import processing.opengl.PGL;
@@ -44,11 +44,13 @@
private PMatrix3D perspectiveMatrix;
+ @Override
protected PGL createPGL(PGraphicsOpenGL pg) {
return new PGLES(pg);
}
+ @Override
public void beginDraw() {
super.beginDraw();
pgl.viewport(viewPort.x, viewPort.y, viewPort.width, viewPort.height);
@@ -27,6 +27,7 @@
import processing.core.PSurface;
public class PGraphicsCardboardMono extends PGraphicsCardboard {
+ @Override
public PSurface createSurface(AppComponent component, SurfaceHolder holder) { // ignore
return new PSurfaceCardboard(this, component, holder, false);
}
@@ -27,6 +27,7 @@
import processing.core.PSurface;
public class PGraphicsCardboardStereo extends PGraphicsCardboard {
+ @Override
public PSurface createSurface(AppComponent component, SurfaceHolder holder) { // ignore
return new PSurfaceCardboard(this, component, holder, true);
}
@@ -27,11 +27,12 @@
import javax.microedition.khronos.egl.EGLConfig;
-import com.google.vrtoolkit.cardboard.CardboardActivity;
-import com.google.vrtoolkit.cardboard.CardboardView;
-import com.google.vrtoolkit.cardboard.Eye;
-import com.google.vrtoolkit.cardboard.HeadTransform;
-import com.google.vrtoolkit.cardboard.Viewport;
+import com.google.vr.sdk.base.GvrActivity;
+import com.google.vr.sdk.base.GvrView;
+import com.google.vr.sdk.base.AndroidCompat;
+import com.google.vr.sdk.base.Eye;
+import com.google.vr.sdk.base.HeadTransform;
+import com.google.vr.sdk.base.Viewport;
import android.app.Activity;
import android.app.ActivityManager;
@@ -53,54 +54,68 @@
public class PSurfaceCardboard extends PSurfaceGLES {
protected GLCardboardSurfaceView glview;
protected PGraphicsCardboard pgc;
-
- protected CardboardActivity cardboard;
+
+ protected GvrActivity cardboard;
protected AndroidCardboardStereoRenderer renderer;
public PSurfaceCardboard(PGraphics graphics, AppComponent component, SurfaceHolder holder, boolean vr) {
this.sketch = graphics.parent;
this.graphics = graphics;
this.component = component;
this.pgl = (PGLES)((PGraphicsOpenGL)graphics).pgl;
-
- cardboard = (CardboardActivity)component;
+
+ cardboard = (GvrActivity)component;
pgc = (PGraphicsCardboard)graphics;
glview = new GLCardboardSurfaceView(cardboard);
- glview.setVRModeEnabled(vr);
+ glview.setStereoModeEnabled(vr);
if (vr) {
glview.setDistortionCorrectionEnabled(true);
glview.setNeckModelEnabled(true);
-// glview.setElectronicDisplayStabilizationEnabled(true);
+// glview.setElectronicDisplayStabilizationEnabled(true);
+ }
+
+ // Enable Cardboard-trigger feedback with Daydream headsets. This is a simple way of supporting
+ // Daydream controller input for basic interactions using the existing Cardboard trigger API.
+ glview.enableCardboardTriggerEmulation();
+
+ if (glview.setAsyncReprojectionEnabled(true)) {
+ // Async reprojection decouples the app framerate from the display framerate,
+ // allowing immersive interaction even at the throttled clockrates set by
+ // sustained performance mode.
+ AndroidCompat.setSustainedPerformanceMode(cardboard, true);
}
- cardboard.setCardboardView(glview);
+ cardboard.setGvrView(glview);
surface = null;
}
-
+
@Override
public Context getContext() {
return cardboard;
}
-
+
@Override
public Activity getActivity() {
return cardboard;
}
-
+
@Override
public void finish() {
cardboard.finish();
}
-
+
+ @Override
public AssetManager getAssets() {
return cardboard.getAssets();
}
+ @Override
public void startActivity(Intent intent) {
cardboard.startActivity(intent);
}
+ @Override
public void initView(int sketchWidth, int sketchHeight) {
Window window = cardboard.getWindow();
@@ -118,10 +133,12 @@ public void initView(int sketchWidth, int sketchHeight) {
window.setContentView(glview);
}
+ @Override
public String getName() {
return cardboard.getComponentName().getPackageName();
}
+ @Override
public void setOrientation(int which) {
if (component.getKind() == AppComponent.FRAGMENT) {
if (which == PORTRAIT) {
@@ -132,18 +149,22 @@ public void setOrientation(int which) {
}
}
+ @Override
public File getFilesDir() {
return cardboard.getFilesDir();
}
+ @Override
public InputStream openFileInput(String filename) {
return null;
}
+ @Override
public File getFileStreamPath(String path) {
return cardboard.getFileStreamPath(path);
}
+ @Override
public void dispose() {
// surface.onDestroy();
}
@@ -186,7 +207,7 @@ public boolean isStopped() {
///////////////////////////////////////////////////////////
- public class GLCardboardSurfaceView extends CardboardView {
+ public class GLCardboardSurfaceView extends GvrView {
public GLCardboardSurfaceView(Context context) {
super(context);
@@ -250,19 +271,19 @@ public boolean onKeyUp(int code, android.view.KeyEvent event) {
return super.onKeyUp(code, event);
}
}
-
+
///////////////////////////////////////////////////////////
- // Android specific classes (Renderer, ConfigChooser)
+ // Android specific classes (Renderer, ConfigChooser)
public AndroidCardboardStereoRenderer getCardboardStereoRenderer() {
renderer = new AndroidCardboardStereoRenderer();
return renderer;
- }
+ }
- protected class AndroidCardboardStereoRenderer implements CardboardView.StereoRenderer {
+ protected class AndroidCardboardStereoRenderer implements GvrView.StereoRenderer {
public AndroidCardboardStereoRenderer() {
}
Oops, something went wrong.

0 comments on commit c958737

Please sign in to comment.