Skip to content

Commit

Permalink
ARCore Android SDK v1.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bsanjin committed Dec 11, 2020
1 parent 9b87760 commit eaa8594
Show file tree
Hide file tree
Showing 27 changed files with 1,986 additions and 967 deletions.
1,806 changes: 948 additions & 858 deletions libraries/include/arcore_c_api.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion samples/augmented_faces_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
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 @@ -53,8 +53,8 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
natives 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'
natives 'com.google.ar:core:1.22.0'

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.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 @@ -26,7 +26,7 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
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 @@ -26,7 +26,7 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
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 @@ -53,8 +53,8 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
natives 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'
natives 'com.google.ar:core:1.22.0'

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
Expand Down
2 changes: 1 addition & 1 deletion samples/computervision_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
4 changes: 2 additions & 2 deletions samples/hello_ar_c/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
natives 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'
natives 'com.google.ar:core:1.22.0'

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
Expand Down
2 changes: 1 addition & 1 deletion samples/hello_ar_java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ android {

dependencies {
// ARCore (Google Play Services for AR) library.
implementation 'com.google.ar:core:1.21.0'
implementation 'com.google.ar:core:1.22.0'

// Obj - a simple Wavefront OBJ file loader
// https://github.com/javagl/Obj
Expand Down
3 changes: 3 additions & 0 deletions samples/hello_ar_java/app/src/main/assets/models/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The file "dfg.raw" is a raw image file of dimensions 64x64 with two color
channels stored in 16-bit floats. It can be regenerated by using the script
"generate_dfg_texture.py" provided in the ARCore SDK under /tools/.
Binary file not shown.
118 changes: 118 additions & 0 deletions samples/hello_ar_java/app/src/main/assets/shaders/cubemap_filter.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#version 300 es
/*
* Copyright 2020 Google LLC
*
* 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.
*/
precision mediump float;

// The number of mipmap levels in the cubemap is equal to the number of
// roughness levels that we precalculate for filtering the cubemap for roughness
// in real-time.
const int kNumberOfRoughnessLevels = NUMBER_OF_MIPMAP_LEVELS;

// The number of importance samples to use for roughness filtering of the
// cubemap.
const int kNumberOfImportanceSamples = NUMBER_OF_IMPORTANCE_SAMPLES;

struct ImportanceSampleCacheEntry {
vec3 direction; // Direction to sample in tangent space
float contribution; // Weighted contribution of the sample's radiance
float level; // The mipmap level to sample from the cubemap. Can be
// in-between integer levels for trilinear filtering.
};

struct ImportanceSampleCache {
int number_of_entries;
ImportanceSampleCacheEntry entries[kNumberOfImportanceSamples];
};

// This array's length is one less than the number of roughness levels since the
// first roughness level can be skipped.
uniform ImportanceSampleCache
u_ImportanceSampleCaches[kNumberOfRoughnessLevels - 1];

// The source radiance cubemap to be filtered.
uniform samplerCube u_Cubemap;

// The roughness level that we are filtering for.
uniform int u_RoughnessLevel;

in vec2 v_Position;

#ifdef PX_LOCATION
layout(location = PX_LOCATION) out vec4 o_FragColorPX;
#endif
#ifdef NX_LOCATION
layout(location = NX_LOCATION) out vec4 o_FragColorNX;
#endif
#ifdef PY_LOCATION
layout(location = PY_LOCATION) out vec4 o_FragColorPY;
#endif
#ifdef NY_LOCATION
layout(location = NY_LOCATION) out vec4 o_FragColorNY;
#endif
#ifdef PZ_LOCATION
layout(location = PZ_LOCATION) out vec4 o_FragColorPZ;
#endif
#ifdef NZ_LOCATION
layout(location = NZ_LOCATION) out vec4 o_FragColorNZ;
#endif

vec4 Filter(const vec3 n) {
if (u_RoughnessLevel == 0) {
// Roughness level 0 is just a straight copy.
return vec4(textureLod(u_Cubemap, n, 0.0).rgb, 1.0);
}

vec3 up = abs(n.z) < 0.9999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);

mat3 tangentToWorld;
tangentToWorld[0] = normalize(cross(up, n));
tangentToWorld[1] = cross(n, tangentToWorld[0]);
tangentToWorld[2] = n;

ImportanceSampleCache cache = u_ImportanceSampleCaches[u_RoughnessLevel - 1];
vec3 radiance = vec3(0.0);
for (int i = 0; i < cache.number_of_entries; ++i) {
ImportanceSampleCacheEntry entry = cache.entries[i];
radiance +=
textureLod(u_Cubemap, tangentToWorld * entry.direction, entry.level)
.rgb *
entry.contribution;
}
return vec4(radiance, 1.0);
}

void main() {
float u = v_Position.x;
float v = v_Position.y;
#ifdef PX_LOCATION
o_FragColorPX = Filter(normalize(vec3(+1, -v, -u)));
#endif
#ifdef NX_LOCATION
o_FragColorNX = Filter(normalize(vec3(-1, -v, +u)));
#endif
#ifdef PY_LOCATION
o_FragColorPY = Filter(normalize(vec3(+u, +1, +v)));
#endif
#ifdef NY_LOCATION
o_FragColorNY = Filter(normalize(vec3(+u, -1, -v)));
#endif
#ifdef PZ_LOCATION
o_FragColorPZ = Filter(normalize(vec3(+u, -v, +1)));
#endif
#ifdef NZ_LOCATION
o_FragColorNZ = Filter(normalize(vec3(-u, -v, -1)));
#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#version 300 es
/*
* Copyright 2020 Google LLC
*
* 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.
*/

layout(location = 0) in vec4 a_Position;

out vec2 v_Position;

void main() {
gl_Position = a_Position;
v_Position = a_Position.xy;
}
Loading

0 comments on commit eaa8594

Please sign in to comment.