Skip to content
This repository has been archived by the owner on Mar 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request #87 from googlesamples/release-wasat
Browse files Browse the repository at this point in the history
Release wasat
  • Loading branch information
jguomoto authored Sep 22, 2016
2 parents b0704c3 + 79607ec commit 5dc9338
Show file tree
Hide file tree
Showing 125 changed files with 4,717 additions and 17 deletions.
Empty file modified NOTICE.txt
100755 → 100644
Empty file.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ different use cases of Tango technology:
sensor.
* **cpp_rgb_depth_sync_example** - Synchronize the depth
sensor 3D information with the color camera information.
* **cpp_video_stabilization_experiment** - Stabilize the video by
smoothing the pose and correcting for gravity.

The **cpp_example_util** project contains some common utility code that
is used for many samples.
Expand Down
Empty file modified cpp_augmented_reality_example/app/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_augmented_reality_example/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_augmented_reality_example/gradle/wrapper/gradle-wrapper.jar
100755 → 100644
Empty file.
Empty file.
Empty file modified cpp_augmented_reality_example/gradlew.bat
100755 → 100644
Empty file.
Empty file modified cpp_augmented_reality_example/settings.gradle
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/gradle/wrapper/gradle-wrapper.jar
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/gradle/wrapper/gradle-wrapper.properties
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/gradlew.bat
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/hello_area_description/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/hello_depth_perception/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/hello_motion_tracking/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/hello_video/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_basic_examples/settings.gradle
100755 → 100644
Empty file.
Empty file modified cpp_example_util/.gitignore
100755 → 100644
Empty file.
Empty file modified cpp_example_util/app/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_example_util/build.gradle
100755 → 100644
Empty file.
Empty file modified cpp_example_util/gradle.properties
100755 → 100644
Empty file.
Empty file modified cpp_example_util/gradle/wrapper/gradle-wrapper.jar
100755 → 100644
Empty file.
Empty file modified cpp_example_util/gradle/wrapper/gradle-wrapper.properties
100755 → 100644
Empty file.
Empty file modified cpp_example_util/gradlew.bat
100755 → 100644
Empty file.
Empty file modified cpp_example_util/settings.gradle
100755 → 100644
Empty file.
39 changes: 39 additions & 0 deletions cpp_mesh_builder_example/app/build.gradle
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')
}
33 changes: 33 additions & 0 deletions cpp_mesh_builder_example/app/src/main/AndroidManifest.xml
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>
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);
}
}
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();
}
}
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();
}
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;
Loading

0 comments on commit 5dc9338

Please sign in to comment.