Skip to content

Commit 14716e0

Browse files
authored
Merge pull request #755 from processing/ar-image-markers-gsoc2023
Working implementation of augmented images
2 parents 7e576fa + 91b13c2 commit 14716e0

File tree

9 files changed

+297
-96
lines changed

9 files changed

+297
-96
lines changed

debug/gradle.properties

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@
55
# The setting is particularly useful for tweaking memory settings.
66
# Default value: -Xmx1024m -XX:MaxPermSize=256m
77
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
8-
#
8+
org.gradle.jvmargs=-Xmx1536M
9+
910
# When configured, Gradle will run in incubating parallel mode.
1011
# This option should only be used with decoupled projects. More details, visit
1112
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1213
# org.gradle.parallel=true
13-
#Wed Dec 30 11:02:34 EST 2020
14+
1415
android.enableJetifier=true
1516
android.useAndroidX=true
16-
17-
# Line to fix the ''module java.base does not "opens java.io" to unnamed module '' error in Android Studio:
18-
# https://stackoverflow.com/questions/67782975/how-to-fix-the-module-java-base-does-not-opens-java-io-to-unnamed-module
19-
# Probably not needed if using a version of the Android Gradle Plugin compatible with the JDK:
20-
# https://docs.gradle.org/current/userguide/compatibility.html
21-
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import processing.ar.*;
2+
3+
ARTracker tracker;
4+
ARAnchor anchor;
5+
PShape earth;
6+
7+
void setup() {
8+
fullScreen(AR);
9+
10+
tracker = new ARTracker(this);
11+
12+
PImage earthImg = loadImage("earth.jpg");
13+
tracker.start();
14+
tracker.addImage("earth", earthImg);
15+
16+
earth = createShape(SPHERE, 0.5);
17+
}
18+
19+
void draw() {
20+
lights();
21+
22+
if (mousePressed) {
23+
// Create new anchor at the current touch point
24+
if (anchor != null) anchor.dispose();
25+
ARTrackable hit = tracker.get(mouseX, mouseY);
26+
if (hit != null && hit.isImage() && hit.getName().equals("earth")) anchor = new ARAnchor(hit);
27+
else anchor = null;
28+
}
29+
30+
if (anchor != null) {
31+
anchor.attach();
32+
shape(earth);
33+
anchor.detach();
34+
}
35+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
component=ar
230 KB
Loading

0 commit comments

Comments
 (0)