Skip to content

Commit 0d7d556

Browse files
authored
Merge branch 'android-0273-v4.1.0-beta2' into master
2 parents 430e04a + a85cbaa commit 0d7d556

File tree

125 files changed

+8999
-1150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+8999
-1150
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
mode/processing-core.zip
2-
mode/mode/*.jar
2+
mode/mode/AndroidMode.jar
3+
mode/mode/gradle-tooling-api*
4+
mode/mode/slf4j*
35

46
mode/libraries/vr/library
7+
mode/libraries/ar/library
58
mode/tools/SDKUpdated/tool
69

710
studio/.gradle

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Processing for Android
33

44
This is the main repository for Processing for Android. It includes the core library inside the core folder, and the mode itself in the root. See the [wiki](https://github.com/processing/processing-android/wiki) for build instructions.
55

6-
The core and VR libraries are available on JCentral, so they can be easily imported
6+
The core, VR, and AR libraries are available on JCentral, so they can be easily imported
77
into Gradle projects:
88

99
[processing-core](https://bintray.com/p5android/processing-android/processing-core)
1010

1111
[processing-vr](https://bintray.com/p5android/processing-android/processing-vr)
1212

13+
[processing-ar](https://bintray.com/p5android/processing-android/processing-ar)
14+
1315

build.gradle

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ allprojects {
2727
ext.supportLibsVersion = '26.0.2'
2828
ext.wearVersion = '2.1.0'
2929
ext.gvrVersion = '1.150.0'
30+
ext.garVersion = '1.2.0'
3031
ext.processingVersion = '3.3.7'
3132
ext.toolingVersion = '4.3'
3233
ext.slf4jVersion = '1.7.10'
3334
ext.gradlewVersion = '4.4.1'
3435
ext.toolsLibVersion = '26.0.0-dev'
36+
ext.jdtVersion = '3.11.100'
3537

3638
Properties modeProperties = new Properties()
3739
modeProperties.load(project.rootProject.file("mode/mode.properties").newDataInputStream())
@@ -41,6 +43,10 @@ allprojects {
4143
vrProperties.load(project.rootProject.file("mode/libraries/vr/library.properties").newDataInputStream())
4244
ext.vrLibVersion = vrProperties.getProperty("prettyVersion")
4345

46+
Properties arProperties = new Properties()
47+
arProperties.load(project.rootProject.file("mode/libraries/ar/library.properties").newDataInputStream())
48+
ext.arLibVersion = arProperties.getProperty("prettyVersion")
49+
4450

4551
def fn = project.rootProject.file("local.properties")
4652
if (!fn.exists()) {
@@ -93,9 +99,11 @@ task dist {
9399
// Copy assets to build dir
94100
FileUtils.copyDirectory(file("mode/templates"), file("${root}/templates"))
95101
FileUtils.copyDirectory(file("mode/examples"), file("${root}/examples"))
96-
FileUtils.copyDirectory(file("mode/icons"), file("${root}/icons"))
97-
FileUtils.copyDirectory(file("mode/mode"), file("${root}/mode"))
102+
FileUtils.copyDirectory(file("mode/icons"), file("${root}/icons"))
98103
FileUtils.copyDirectory(file("mode/theme"), file("${root}/theme"))
104+
FileUtils.copyDirectory(file("mode/mode"), file("${root}/mode"))
105+
delete "${root}/mode/jdi.jar"
106+
delete "${root}/mode/jdimodel.jar"
99107

100108
Files.copy(file("mode/processing-core.zip").toPath(),
101109
file("${root}/processing-core.zip").toPath(), REPLACE_EXISTING);
@@ -115,7 +123,16 @@ task dist {
115123
FileUtils.copyDirectory(file("mode/libraries/vr/src"),
116124
file("${root}/libraries/vr/src"))
117125
Files.copy(file("mode/libraries/vr/library.properties").toPath(),
118-
file("${root}/libraries/vr/library.properties").toPath(), REPLACE_EXISTING);
126+
file("${root}/libraries/vr/library.properties").toPath(), REPLACE_EXISTING);
127+
128+
FileUtils.copyDirectory(file("mode/libraries/ar/examples"),
129+
file("${root}/libraries/ar/examples"))
130+
FileUtils.copyDirectory(file("mode/libraries/ar/library"),
131+
file("${root}/libraries/ar/library"))
132+
FileUtils.copyDirectory(file("mode/libraries/ar/src"),
133+
file("${root}/libraries/ar/src"))
134+
Files.copy(file("mode/libraries/ar/library.properties").toPath(),
135+
file("${root}/libraries/ar/library.properties").toPath(), REPLACE_EXISTING);
119136

120137
File distFolder = file("dist");
121138
distFolder.mkdirs();

core/src/assets/grid.png

73.4 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
precision mediump float;
2+
3+
uniform sampler2D u_Texture;
4+
5+
uniform vec4 u_LightingParameters;
6+
uniform vec4 u_MaterialParameters;
7+
8+
varying vec3 v_ViewPosition;
9+
varying vec3 v_ViewNormal;
10+
varying vec2 v_TexCoord;
11+
12+
void main() {
13+
const float kGamma = 0.4545454;
14+
const float kInverseGamma = 2.2;
15+
vec3 viewLightDirection = u_LightingParameters.xyz;
16+
float lightIntensity = u_LightingParameters.w;
17+
float materialAmbient = u_MaterialParameters.x;
18+
float materialDiffuse = u_MaterialParameters.y;
19+
float materialSpecular = u_MaterialParameters.z;
20+
float materialSpecularPower = u_MaterialParameters.w;
21+
vec3 viewFragmentDirection = normalize(v_ViewPosition);
22+
vec3 viewNormal = normalize(v_ViewNormal);
23+
vec4 objectColor = texture2D(u_Texture, vec2(v_TexCoord.x, 1.0 - v_TexCoord.y));
24+
objectColor.rgb = pow(objectColor.rgb, vec3(kInverseGamma));
25+
float ambient = materialAmbient;
26+
float diffuse = lightIntensity * materialDiffuse *
27+
0.5 * (dot(viewNormal, viewLightDirection) + 1.0);
28+
vec3 reflectedLightDirection = reflect(viewLightDirection, viewNormal);
29+
float specularStrength = max(0.0, dot(viewFragmentDirection, reflectedLightDirection));
30+
float specular = lightIntensity * materialSpecular *
31+
pow(specularStrength, materialSpecularPower);
32+
gl_FragColor.a = objectColor.a;
33+
gl_FragColor.rgb = pow(objectColor.rgb * (ambient + diffuse) + specular, vec3(kGamma));
34+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
uniform mat4 u_ModelView;
2+
uniform mat4 u_ModelViewProjection;
3+
4+
attribute vec4 a_Position;
5+
attribute vec3 a_Normal;
6+
attribute vec2 a_TexCoord;
7+
8+
varying vec3 v_ViewPosition;
9+
varying vec3 v_ViewNormal;
10+
varying vec2 v_TexCoord;
11+
12+
void main() {
13+
v_ViewPosition = (u_ModelView * a_Position).xyz;
14+
v_ViewNormal = normalize((u_ModelView * vec4(a_Normal, 0.0)).xyz);
15+
v_TexCoord = a_TexCoord;
16+
gl_Position = u_ModelViewProjection * a_Position;
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
precision highp float;
2+
uniform sampler2D u_Texture;
3+
uniform vec4 u_dotColor;
4+
uniform vec4 u_lineColor;
5+
uniform vec4 u_gridControl;
6+
varying vec3 v_TexCoordAlpha;
7+
8+
void main() {
9+
vec4 control = texture2D(u_Texture, v_TexCoordAlpha.xy);
10+
float dotScale = v_TexCoordAlpha.z;
11+
float lineFade = max(0.0, u_gridControl.z * v_TexCoordAlpha.z - (u_gridControl.z - 1.0));
12+
vec3 color = (control.r * dotScale > u_gridControl.x) ? u_dotColor.rgb
13+
: (control.g > u_gridControl.y) ? u_lineColor.rgb * lineFade
14+
: (u_lineColor.rgb * 0.25 * lineFade) ;
15+
gl_FragColor = vec4(color, v_TexCoordAlpha.z * u_gridControl.w);
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
uniform mat4 u_Model;
2+
uniform mat4 u_ModelViewProjection;
3+
uniform mat2 u_PlaneUvMatrix;
4+
5+
attribute vec3 a_XZPositionAlpha;
6+
7+
varying vec3 v_TexCoordAlpha;
8+
9+
void main() {
10+
vec4 position = vec4(a_XZPositionAlpha.x, 0.0, a_XZPositionAlpha.y, 1.0);
11+
v_TexCoordAlpha = vec3(u_PlaneUvMatrix * (u_Model * position).xz, a_XZPositionAlpha.z);
12+
gl_Position = u_ModelViewProjection * position;
13+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
precision mediump float;
2+
varying vec4 v_Color;
3+
4+
void main() {
5+
gl_FragColor = v_Color;
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
uniform mat4 u_ModelViewProjection;
2+
uniform vec4 u_Color;
3+
uniform float u_PointSize;
4+
5+
attribute vec4 a_Position;
6+
7+
varying vec4 v_Color;
8+
9+
void main() {
10+
v_Color = u_Color;
11+
gl_Position = u_ModelViewProjection * vec4(a_Position.xyz, 1.0);
12+
gl_PointSize = u_PointSize;
13+
}

0 commit comments

Comments
 (0)