Skip to content

Commit

Permalink
ARCore Android SDK v1.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nvictornvictor committed Mar 19, 2020
1 parent 7fb56db commit 98cb803
Show file tree
Hide file tree
Showing 20 changed files with 1,148 additions and 2,074 deletions.
2,900 changes: 889 additions & 2,011 deletions LICENSE

Large diffs are not rendered by default.

80 changes: 58 additions & 22 deletions libraries/include/arcore_c_api.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017 Google Inc. All Rights Reserved.
* Copyright 2017-2020 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.
Expand Down Expand Up @@ -121,6 +121,9 @@
/// @defgroup cameraconfig CameraConfig
/// Camera configuration.

/// @defgroup cameraconfigfilter CameraConfigFilter
/// Filters available camera configurations.

/// @defgroup frame Frame
/// Per-frame state.

Expand Down Expand Up @@ -389,6 +392,8 @@ typedef struct ArAugmentedImage_ ArAugmentedImage;

/// @}

// image_segmentation_people)

// Augmented Faces

/// @addtogroup augmented_face
Expand Down Expand Up @@ -646,8 +651,7 @@ AR_DEFINE_ENUM(ArStatus){
/// To avoid this error, ensure that Session_checkSupported() returns true.
AR_ERROR_UNSUPPORTED_CONFIGURATION = -8,

/// The Android camera permission was not granted prior to calling
/// ArSession_resume().
/// The application does not have Android camera permission.
AR_ERROR_CAMERA_PERMISSION_NOT_GRANTED = -9,

/// Acquire failed because the object being acquired was already released.
Expand Down Expand Up @@ -1007,12 +1011,12 @@ AR_DEFINE_ENUM(ArPointOrientationMode){
/// @ingroup cloud
/// Indicates the cloud configuration of the ::ArSession.
AR_DEFINE_ENUM(ArCloudAnchorMode){
/// Anchor Hosting is disabled. This is the value set in the default
/// Cloud Anchors are disabled. This is the value set in the default
/// ::ArConfig.
AR_CLOUD_ANCHOR_MODE_DISABLED = 0,
/// Anchor Hosting is enabled. Setting this value and calling
/// @c ArSession_configure() will require that the application have the
/// Android INTERNET permission.
/// This mode will enable Cloud Anchors. Setting this value and calling @c
/// ArSssion_configure() will require the application to have the Android
/// INTERNET permission.
AR_CLOUD_ANCHOR_MODE_ENABLED = 1,
};

Expand Down Expand Up @@ -1351,6 +1355,8 @@ void ArConfig_getAugmentedImageDatabase(
const ArConfig *config,
ArAugmentedImageDatabase *out_augmented_image_database);

// image_segmentation_people)

/// Stores the currently configured augmented face mode into @c
/// *augmented_face_mode.
void ArConfig_getAugmentedFaceMode(const ArSession *session,
Expand Down Expand Up @@ -1541,31 +1547,56 @@ AR_DEFINE_ENUM(ArCameraConfigDepthSensorUsage){
AR_CAMERA_CONFIG_DEPTH_SENSOR_USAGE_DO_NOT_USE = 0x0002,
};

// Creates a camera config filters object with default values set for
// backward compatibility. The caller can update the config filters it
// wants and then get the matching camera configs.
/// @addtogroup cameraconfigfilter
/// @{

/// Creates a camera config filter object.
///
/// @param[in] session The ARCore session
/// @param[out] out_filter A pointer to an @c ArCameraConfigFilter* to receive
/// the address of the newly allocated ArCameraConfigFilter
void ArCameraConfigFilter_create(const ArSession *session,
ArCameraConfigFilter **out_filter);

/// Releases memory used by the provided camera config filters object.
/// Releases memory used by the provided camera config filter object.
///
/// @param[in] filter The filter to release memory for.
void ArCameraConfigFilter_destroy(ArCameraConfigFilter *filter);

/// Sets the fps filter.
/// Sets the desired framerates to allow.
///
/// @param[in] session The ARCore session
/// @param[in, out] filter The filter object to change
/// @param[in] fps_filters A 32bit integer representing multiple
/// @c ArCameraConfigTargetFps values, bitwise-or'd together
void ArCameraConfigFilter_setTargetFps(const ArSession *session,
ArCameraConfigFilter *filter,
const uint32_t fps_filters);

/// Gets the fps filter state.
/// Gets the desired framerates to allow.
///
/// @param[in] session The ARCore session
/// @param[in] filter The filter object to query
/// @param[out] out_fps_filters To be filled in with the desired framerates
/// allowed
void ArCameraConfigFilter_getTargetFps(const ArSession *session,
ArCameraConfigFilter *filter,
uint32_t *out_fps_filters);

/// Sets depth sensor usage filter. Default is to not filter.
/// Sets the desired depth sensor usages to allow.
///
/// @param[in] session The ARCore session
/// @param[in, out] filter The filter object to change
/// @param[in] depth_sensor_usage_filters A 32bit integer representing
/// multiple @c ArCameraConfigDepthSensorUsage values, bitwise-or'd
/// together
void ArCameraConfigFilter_setDepthSensorUsage(
const ArSession *session,
ArCameraConfigFilter *filter,
uint32_t depth_sensor_usage_filters);

/// @}

// === ArSession methods ===

/// @addtogroup session
Expand Down Expand Up @@ -1600,11 +1631,12 @@ ArStatus ArSession_checkSupported(const ArSession *session,
AR_DEPRECATED(
"deprecated in release 1.2.0. Please see function documentation");

/// Configures the session with the given config.
/// Note: a session is always initially configured with the default config.
/// This should be called if a configuration different than default is needed.
/// Configures the session.
///
/// A session initially has a default configuration. This should be called if a
/// configuration different than default is needed.
///
/// The following configurations are not supported:
/// The following configurations are unsupported:
///
/// - When using the (default) back-facing camera:
/// - #AR_AUGMENTED_FACE_MODE_MESH3D.
Expand All @@ -1614,10 +1646,13 @@ ArStatus ArSession_checkSupported(const ArSession *session,
/// - #AR_CLOUD_ANCHOR_MODE_ENABLED.
/// - #AR_LIGHT_ESTIMATION_MODE_ENVIRONMENTAL_HDR.
///
/// @param[in] session The ARCore session.
/// @param[in] config The new configuration setting for the session.
///
/// @return #AR_SUCCESS or any of:
/// - #AR_ERROR_FATAL
/// - #AR_ERROR_UNSUPPORTED_CONFIGURATION If the configuration is not supported,
/// see above restrictions
/// - #AR_ERROR_UNSUPPORTED_CONFIGURATION if the configuration is not supported.
/// See above restrictions.
/// - #AR_ERROR_INTERNET_PERMISSION_NOT_GRANTED
ArStatus ArSession_configure(ArSession *session, const ArConfig *config);

Expand Down Expand Up @@ -1898,9 +1933,10 @@ void ArSession_getCameraConfig(const ArSession *session,
///
/// Beginning with ARCore SDK 1.15.0, some devices support additional camera
/// configs with lower GPU texture resolutions than the device's default GPU
/// texture resolution. See the ARCore supported devices
/// texture resolution. These additional resolutions are only returned when the
/// filter is not a @c nullptr. See the ARCore supported devices
/// (https://developers.google.com/ar/discover/supported-devices) page for
/// details.
/// an up to date list of supported devices.
///
/// Element 0 will contain the camera config that best matches the filter
/// settings, according to the following priority:
Expand Down
4 changes: 2 additions & 2 deletions samples/augmented_image_c/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.15.0'
natives 'com.google.ar:core:1.15.0'
implementation 'com.google.ar:core:1.16.0'
natives 'com.google.ar:core:1.16.0'

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
Expand Down
2 changes: 1 addition & 1 deletion samples/augmented_image_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.15.0'
implementation 'com.google.ar:core:1.16.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ public void draw(
float[] texCoordTransformed;
switch (cameraToDisplayRotation) {
case 90:
texCoordTransformed = new float[] {1 - u, 1 - v, u, 1 - v, 1 - u, v, u, v};
texCoordTransformed = new float[] {1 - u, 1 - v, 1 - u, v, u, 1 - v, u, v};
break;
case 180:
texCoordTransformed = new float[] {1 - u, v, 1 - u, 1 - v, u, v, u, 1 - v};
texCoordTransformed = new float[] {1 - u, v, u, v, 1 - u, 1 - v, u, 1 - v};
break;
case 270:
texCoordTransformed = new float[] {u, v, 1 - u, v, u, 1 - v, 1 - u, 1 - v};
texCoordTransformed = new float[] {u, v, u, 1 - v, 1 - u, v, 1 - u, 1 - v};
break;
case 0:
texCoordTransformed = new float[] {u, 1 - v, u, v, 1 - u, 1 - v, 1 - u, v};
texCoordTransformed = new float[] {u, 1 - v, 1 - u, 1 - v, u, v, 1 - u, v};
break;
default:
throw new IllegalArgumentException("Unhandled rotation: " + cameraToDisplayRotation);
Expand Down Expand Up @@ -235,8 +235,19 @@ private void draw() {
ShaderUtil.checkGLError(TAG, "BackgroundRendererDraw");
}

/**
* (-1, 1) ------- (1, 1)
* | \ |
* | \ |
* | \ |
* | \ |
* (-1, -1) ------ (1, -1)
* Ensure triangles are front-facing, to support glCullFace().
* This quad will be drawn using GL_TRIANGLE_STRIP which draws two
* triangles: v0->v1->v2, then v2->v1->v3.
*/
private static final float[] QUAD_COORDS =
new float[] {
-1.0f, -1.0f, -1.0f, +1.0f, +1.0f, -1.0f, +1.0f, +1.0f,
-1.0f, -1.0f, +1.0f, -1.0f, -1.0f, +1.0f, +1.0f, +1.0f,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.TreeMap;

/** Shader helper functions. */
public class ShaderUtil {
Expand All @@ -29,11 +31,23 @@ public class ShaderUtil {
*
* @param type The type of shader we will be creating.
* @param filename The filename of the asset file about to be turned into a shader.
* @param defineValuesMap The #define values to add to the top of the shader source code.
* @return The shader object handler.
*/
public static int loadGLShader(String tag, Context context, int type, String filename)
public static int loadGLShader(
String tag, Context context, int type, String filename, Map<String, Integer> defineValuesMap)
throws IOException {
// Load shader source code.
String code = readShaderFileFromAssets(context, filename);

// Prepend any #define values specified during this run.
String defines = "";
for (Map.Entry<String, Integer> entry : defineValuesMap.entrySet()) {
defines += "#define " + entry.getKey() + " " + entry.getValue() + "\n";
}
code = defines + code;

// Compiles shader code.
int shader = GLES20.glCreateShader(type);
GLES20.glShaderSource(shader, code);
GLES20.glCompileShader(shader);
Expand All @@ -56,6 +70,13 @@ public static int loadGLShader(String tag, Context context, int type, String fil
return shader;
}

/** Overload of loadGLShader that assumes no additional #define values to add. */
public static int loadGLShader(String tag, Context context, int type, String filename)
throws IOException {
Map<String, Integer> emptyDefineValuesMap = new TreeMap<>();
return loadGLShader(tag, context, type, filename, emptyDefineValuesMap);
}

/**
* Checks if we've had an error inside of OpenGL ES, and if so what that error is.
*
Expand Down
2 changes: 1 addition & 1 deletion samples/cloud_anchor_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.15.0'
implementation 'com.google.ar:core:1.16.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ public void draw(
float[] texCoordTransformed;
switch (cameraToDisplayRotation) {
case 90:
texCoordTransformed = new float[] {1 - u, 1 - v, u, 1 - v, 1 - u, v, u, v};
texCoordTransformed = new float[] {1 - u, 1 - v, 1 - u, v, u, 1 - v, u, v};
break;
case 180:
texCoordTransformed = new float[] {1 - u, v, 1 - u, 1 - v, u, v, u, 1 - v};
texCoordTransformed = new float[] {1 - u, v, u, v, 1 - u, 1 - v, u, 1 - v};
break;
case 270:
texCoordTransformed = new float[] {u, v, 1 - u, v, u, 1 - v, 1 - u, 1 - v};
texCoordTransformed = new float[] {u, v, u, 1 - v, 1 - u, v, 1 - u, 1 - v};
break;
case 0:
texCoordTransformed = new float[] {u, 1 - v, u, v, 1 - u, 1 - v, 1 - u, v};
texCoordTransformed = new float[] {u, 1 - v, 1 - u, 1 - v, u, v, 1 - u, v};
break;
default:
throw new IllegalArgumentException("Unhandled rotation: " + cameraToDisplayRotation);
Expand Down Expand Up @@ -235,8 +235,19 @@ private void draw() {
ShaderUtil.checkGLError(TAG, "BackgroundRendererDraw");
}

/**
* (-1, 1) ------- (1, 1)
* | \ |
* | \ |
* | \ |
* | \ |
* (-1, -1) ------ (1, -1)
* Ensure triangles are front-facing, to support glCullFace().
* This quad will be drawn using GL_TRIANGLE_STRIP which draws two
* triangles: v0->v1->v2, then v2->v1->v3.
*/
private static final float[] QUAD_COORDS =
new float[] {
-1.0f, -1.0f, -1.0f, +1.0f, +1.0f, -1.0f, +1.0f, +1.0f,
-1.0f, -1.0f, +1.0f, -1.0f, -1.0f, +1.0f, +1.0f, +1.0f,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.TreeMap;

/** Shader helper functions. */
public class ShaderUtil {
Expand All @@ -29,11 +31,23 @@ public class ShaderUtil {
*
* @param type The type of shader we will be creating.
* @param filename The filename of the asset file about to be turned into a shader.
* @param defineValuesMap The #define values to add to the top of the shader source code.
* @return The shader object handler.
*/
public static int loadGLShader(String tag, Context context, int type, String filename)
public static int loadGLShader(
String tag, Context context, int type, String filename, Map<String, Integer> defineValuesMap)
throws IOException {
// Load shader source code.
String code = readShaderFileFromAssets(context, filename);

// Prepend any #define values specified during this run.
String defines = "";
for (Map.Entry<String, Integer> entry : defineValuesMap.entrySet()) {
defines += "#define " + entry.getKey() + " " + entry.getValue() + "\n";
}
code = defines + code;

// Compiles shader code.
int shader = GLES20.glCreateShader(type);
GLES20.glShaderSource(shader, code);
GLES20.glCompileShader(shader);
Expand All @@ -56,6 +70,13 @@ public static int loadGLShader(String tag, Context context, int type, String fil
return shader;
}

/** Overload of loadGLShader that assumes no additional #define values to add. */
public static int loadGLShader(String tag, Context context, int type, String filename)
throws IOException {
Map<String, Integer> emptyDefineValuesMap = new TreeMap<>();
return loadGLShader(tag, context, type, filename, emptyDefineValuesMap);
}

/**
* Checks if we've had an error inside of OpenGL ES, and if so what that error is.
*
Expand Down
4 changes: 2 additions & 2 deletions samples/computervision_c/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ android {

dependencies {
// ARCore library
implementation 'com.google.ar:core:1.15.0'
natives 'com.google.ar:core:1.15.0'
implementation 'com.google.ar:core:1.16.0'
natives 'com.google.ar:core:1.16.0'

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
Expand Down
Loading

0 comments on commit 98cb803

Please sign in to comment.