Skip to content

Commit

Permalink
Allowing transparency in ImageRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwedgbury committed May 11, 2018
1 parent e9f3add commit 410bfe0
Show file tree
Hide file tree
Showing 86 changed files with 840 additions and 1,612 deletions.
18 changes: 16 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.idea
/.idea
.idea/*
.DS_Store
/build
build
build/*
/captures
.externalNativeBuild
/examples/hello_ar_java/.idea
/examples/hello_ar_java/.gradle
/examples/hello_ar_java/app/build
/app/build
examples/hello_ar_java/local.properties
arcore-location/build
arcore-location/build/*
/arcore-location/build
/arcore-location/build/*
.idea/misc.xml
.idea/modules.xml
9 changes: 5 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ allprojects {
```

#### Step 2.
Add the ARCore-Location dependency. Replace `0.1.0` with the latest release from the [releases tab on Github](https://github.com/appoly/ARCore-Location/releases)
Add the ARCore-Location dependency. Replace `0.2.0` with the latest release from the [releases tab on Github](https://github.com/appoly/ARCore-Location/releases)
```
dependencies {
compile 'com.github.appoly:ARCore-Location:0.1.0'
compile 'com.github.appoly:ARCore-Location:0.2.0'
}
```

Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
}
90 changes: 53 additions & 37 deletions arcore-location/arcore-location.iml
Original file line number Diff line number Diff line change
Expand Up @@ -71,60 +71,76 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/attr" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/check-manifest" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/extractedTypedefs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/library_and_local_jars_jni" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-aidl" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packagedAssets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/packaged_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/public_res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/tmp" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 26 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="com.android.support:support-media-compat-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="junit:junit:4.12@jar" level="project" />
<orderEntry type="library" name="android.arch.lifecycle:common:1.0.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-core-3.0.1" level="project" />
<orderEntry type="library" name="com.android.support:support-fragment-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.squareup:javawriter:2.1.1@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" name="android.arch.lifecycle:runtime-1.0.0" level="project" />
<orderEntry type="library" name="com.android.support:appcompat-v7-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:support-annotations:26.1.0@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-core-utils-26.1.0" level="project" />
<orderEntry type="library" name="com.android.support:support-core-ui-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test:runner-1.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test:rules-1.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="com.android.support.test.espresso:espresso-idling-resource-3.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="com.android.support:support-compat-26.1.0" level="project" />
<orderEntry type="library" name="android.arch.core:common:1.0.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-library:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" name="com.google.ar:core-1.0.0" level="project" />
<orderEntry type="library" name="com.android.support:support-v4-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="net.sf.kxml:kxml2:2.3.0@jar" level="project" />
<orderEntry type="library" name="com.android.support:animated-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:runner-1.0.2" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-basement-15.0.1" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:animated-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support:support-annotations:27.1.1@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:appcompat-v7-26.1.0" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-fragment-26.1.0" level="project" />
<orderEntry type="library" name="Gradle: android.arch.core:common:1.0.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.google.ar:core-1.2.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-base-15.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-media-compat-26.1.0" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-annotations:26.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-v4-26.1.0" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-compat-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-core-3.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:common:1.0.0@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-vector-drawable-26.1.0" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-core-ui-26.1.0" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-location-15.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test:monitor-1.0.2" level="project" />
<orderEntry type="library" name="Gradle: com.android.support:support-core-utils-26.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: com.android.support.test.espresso:espresso-idling-resource-3.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-tasks-15.0.1" level="project" />
<orderEntry type="library" name="Gradle: com.google.android.gms:play-services-places-placereport-15.0.1" level="project" />
<orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" />
<orderEntry type="library" name="Gradle: android.arch.lifecycle:runtime-1.0.0" level="project" />
</component>
</module>
16 changes: 7 additions & 9 deletions arcore-location/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down Expand Up @@ -55,14 +55,12 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.google.ar:core:1.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.ar:core:1.2.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.0'

androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
}

Binary file modified arcore-location/build/outputs/aar/arcore-location-debug.aar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import android.app.Activity;
import android.content.Context;
import android.opengl.Matrix;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;

import com.google.ar.core.Anchor;
import com.google.ar.core.Frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public void createOnGlThread(Context context, int distance) {
Bitmap textureBitmap = null;
try {
textureBitmap = BitmapFactory.decodeStream(context.getAssets().open(pngName));
textureBitmap.setHasAlpha(true);

// Adjusts size of 3D shape to keep image aspect correct
float adjustedWidth = ((float)textureBitmap.getWidth() / 250) / 2;
Expand All @@ -111,6 +112,11 @@ public void createOnGlThread(Context context, int distance) {

GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);

// Transparency
GLES20.glBlendColor(0,0,0,0);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
GLES20.glEnable(GLES20.GL_BLEND);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, textureBitmap, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);

Expand Down Expand Up @@ -208,8 +214,15 @@ public void draw(float[] cameraView, float[] cameraPerspective, float lightInten
// Attach the object texture.
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextures[0]);

// enable transparency
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
GLES20.glBlendColor(0,0,0,0);

GLES20.glUniform1i(mTextureUniform, 0);
GLES20.glUniformMatrix4fv(mModelViewProjectionUniform, 1, false, mModelViewProjectionMatrix, 0);

// Set the vertex positions.
GLES20.glVertexAttribPointer(
mQuadPositionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0, mQuadVertices);
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'


Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 410bfe0

Please sign in to comment.