This repository has been archived by the owner on Mar 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from googlesamples/release-wasat
Release wasat
- Loading branch information
Showing
125 changed files
with
4,717 additions
and
17 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file modified
0
cpp_augmented_reality_example/gradle/wrapper/gradle-wrapper.jar
100755 → 100644
Empty file.
Empty file modified
0
cpp_augmented_reality_example/gradle/wrapper/gradle-wrapper.properties
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 19 | ||
buildToolsVersion "21.1.2" | ||
|
||
defaultConfig { | ||
minSdkVersion 19 | ||
targetSdkVersion 19 | ||
} | ||
|
||
sourceSets.main { | ||
jniLibs.srcDir 'src/main/libs' | ||
jni.srcDirs = []; | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
compileTask -> compileTask.dependsOn ndkBuild | ||
} | ||
task ndkBuild(type: Exec) { | ||
Properties properties = new Properties() | ||
properties.load(project.rootProject.file('local.properties').newDataInputStream()) | ||
def ndkbuild = properties.getProperty('ndk.dir', null)+"/ndk-build" | ||
commandLine ndkbuild, '-C', file('src/main/jni').absolutePath | ||
} | ||
|
||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile project(':cpp_example_util') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.projecttango.examples.cpp.meshbuilder" | ||
android:versionCode="0" | ||
android:versionName="0" > | ||
|
||
<uses-sdk | ||
android:minSdkVersion="19" | ||
android:targetSdkVersion="19" /> | ||
|
||
<uses-permission android:name="android.permission.CAMERA" /> | ||
<uses-feature android:glEsVersion="0x00020000" android:required="true" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
<uses-library | ||
android:name="com.projecttango.libtango_device2" | ||
android:required="true" /> | ||
<activity | ||
android:name="com.projecttango.examples.cpp.meshbuilder.MeshBuilderActivity" | ||
android:label="@string/app_name_long" | ||
android:screenOrientation="nosensor"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
145 changes: 145 additions & 0 deletions
145
...mple/app/src/main/java/com/projecttango/examples/cpp/meshbuilder/MeshBuilderActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.projecttango.examples.cpp.meshbuilder; | ||
|
||
import android.app.Activity; | ||
import android.content.ComponentName; | ||
import android.content.ServiceConnection; | ||
import android.opengl.GLSurfaceView; | ||
import android.os.Bundle; | ||
import android.os.IBinder; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.Toast; | ||
|
||
import com.projecttango.examples.cpp.util.TangoInitializationHelper; | ||
|
||
/** | ||
* The main activity of the application which shows debug information | ||
* and a glSurfaceView that renders graphic content. | ||
*/ | ||
public class MeshBuilderActivity extends Activity implements View.OnClickListener { | ||
// The minimum Tango Core version required from this application. | ||
private static final int MIN_TANGO_CORE_VERSION = 9377; | ||
|
||
// The package name of Tang Core, used for checking minimum Tango Core version. | ||
private static final String TANGO_PACKAGE_NAME = "com.projecttango.tango"; | ||
|
||
// Tag for debug logging. | ||
private static final String TAG = MeshBuilderActivity.class.getSimpleName(); | ||
|
||
// GLSurfaceView and its renderer, all of the graphic content is rendered | ||
// through OpenGL ES 2.0 in the native code. | ||
private MeshBuilderRenderer mRenderer; | ||
private GLSurfaceView mGLView; | ||
|
||
private Button mClearButton; | ||
private Button mToggleButton; | ||
|
||
private boolean m3drRunning = true; | ||
|
||
// Tango Service connection. | ||
ServiceConnection mTangoServiceConnection = new ServiceConnection() { | ||
public void onServiceConnected(ComponentName name, IBinder service) { | ||
// Synchronization around MeshBuilderActivity object is to avoid | ||
// Tango disconnect in the middle of the connecting operation. | ||
TangoJNINative.onTangoServiceConnected(service); | ||
} | ||
|
||
public void onServiceDisconnected(ComponentName name) { | ||
// Handle this if you need to gracefully shutdown/retry | ||
// in the event that Tango itself crashes/gets upgraded while running. | ||
} | ||
}; | ||
|
||
public MeshBuilderActivity() { | ||
TangoJNINative.activityCtor(m3drRunning); | ||
} | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.activity_mesh_builder); | ||
|
||
// Setup UI elements and listeners. | ||
mClearButton = (Button) findViewById(R.id.clear_button); | ||
mClearButton.setOnClickListener(this); | ||
|
||
mToggleButton = (Button) findViewById(R.id.toggle_button); | ||
mToggleButton.setOnClickListener(this); | ||
|
||
// OpenGL view where all of the graphics are drawn | ||
mGLView = (GLSurfaceView) findViewById(R.id.gl_surface_view); | ||
|
||
// Configure OpenGL renderer | ||
mGLView.setEGLContextClientVersion(2); | ||
|
||
// Configure OpenGL renderer | ||
mRenderer = new MeshBuilderRenderer(); | ||
mGLView.setRenderer(mRenderer); | ||
|
||
refreshUi(); | ||
TangoJNINative.onCreate(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
switch (v.getId()) { | ||
case R.id.toggle_button: | ||
m3drRunning = !m3drRunning; | ||
mGLView.queueEvent(new Runnable() { | ||
@Override | ||
public void run() { | ||
TangoJNINative.onToggleButtonClicked(m3drRunning); | ||
} | ||
}); | ||
break; | ||
case R.id.clear_button: | ||
mGLView.queueEvent(new Runnable() { | ||
@Override | ||
public void run() { | ||
TangoJNINative.onClearButtonClicked(); | ||
} | ||
}); | ||
break; | ||
} | ||
|
||
refreshUi(); | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
mGLView.onResume(); | ||
|
||
TangoInitializationHelper.bindTangoService(this, mTangoServiceConnection); | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
super.onPause(); | ||
mGLView.onPause(); | ||
TangoJNINative.onPause(); | ||
unbindService(mTangoServiceConnection); | ||
} | ||
|
||
private void refreshUi() { | ||
int textId = m3drRunning ? R.string.pause : R.string.resume; | ||
mToggleButton.setText(textId); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...mple/app/src/main/java/com/projecttango/examples/cpp/meshbuilder/MeshBuilderRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.projecttango.examples.cpp.meshbuilder; | ||
|
||
import android.opengl.GLSurfaceView; | ||
import javax.microedition.khronos.egl.EGLConfig; | ||
import javax.microedition.khronos.opengles.GL10; | ||
|
||
/** | ||
* MeshBuilderRenderer renders graphic content. | ||
*/ | ||
public class MeshBuilderRenderer implements GLSurfaceView.Renderer { | ||
// Render loop of the Gl context. | ||
public void onDrawFrame(GL10 gl) { | ||
TangoJNINative.onGlSurfaceDrawFrame(); | ||
} | ||
|
||
// Called when the surface size changes. | ||
public void onSurfaceChanged(GL10 gl, int width, int height) { | ||
TangoJNINative.onGlSurfaceChanged(width, height); | ||
} | ||
|
||
// Called when the surface is created or recreated. | ||
public void onSurfaceCreated(GL10 gl, EGLConfig config) { | ||
TangoJNINative.onGlSurfaceCreated(); | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...r_example/app/src/main/java/com/projecttango/examples/cpp/meshbuilder/TangoJNINative.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.projecttango.examples.cpp.meshbuilder; | ||
|
||
import android.app.Activity; | ||
import android.os.IBinder; | ||
import android.util.Log; | ||
|
||
import com.projecttango.examples.cpp.util.TangoInitializationHelper; | ||
|
||
/** | ||
* Interfaces between native C++ code and Java code. | ||
*/ | ||
public class TangoJNINative { | ||
static { | ||
// This project depends on tango_client_api, so we need to make sure we load | ||
// the correct library first. | ||
if (TangoInitializationHelper.loadTangoSharedLibrary() == | ||
TangoInitializationHelper.ARCH_ERROR) { | ||
Log.e("TangoJNINative", "ERROR! Unable to load libtango_client_api.so!"); | ||
} | ||
System.loadLibrary("cpp_mesh_builder_example"); | ||
} | ||
|
||
/** | ||
* Interfaces to native ActivityCtor function. | ||
* | ||
* @param reconstructionRunning the initial state of reconstruction. | ||
*/ | ||
public static native void activityCtor(boolean reconstructionRunning); | ||
|
||
/** | ||
* Interfaces to native OnCreate function. | ||
* | ||
* @param callerActivity the caller activity of this function. | ||
*/ | ||
public static native void onCreate(Activity callerActivity); | ||
|
||
/** | ||
* Called when the Tango service is connected successfully. | ||
* | ||
* @param nativeTangoServiceBinder The native binder object. | ||
*/ | ||
public static native void onTangoServiceConnected(IBinder nativeTangoServiceBinder); | ||
|
||
/** | ||
* Interfaces to native OnPause function. | ||
*/ | ||
public static native void onPause(); | ||
|
||
// Allocate OpenGL resources for rendering. | ||
public static native void onGlSurfaceCreated(); | ||
|
||
// Setup the view port width and height. | ||
public static native void onGlSurfaceChanged(int width, int height); | ||
|
||
// Main render loop. | ||
public static native void onGlSurfaceDrawFrame(); | ||
|
||
// Called when the toggle button is clicked | ||
public static native void onToggleButtonClicked(boolean reconstructionRunning); | ||
|
||
// Called when the clear button is clicked | ||
public static native void onClearButtonClicked(); | ||
} |
21 changes: 21 additions & 0 deletions
21
...der_example/app/src/main/java/com/projecttango/examples/cpp/meshbuilder/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Native mesh building example. | ||
*/ | ||
|
||
package com.projecttango.examples.cpp.meshbuilder; |
Oops, something went wrong.