Skip to content

Commit ebda735

Browse files
committed
Merge branch 'rc/1.70.1' into release
2 parents 06b7c1f + 84c9752 commit ebda735

95 files changed

Lines changed: 2024 additions & 727 deletions

File tree

Some content is hidden

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

.github/actions/get-commit-msg/action.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,24 @@ runs:
2727
echo "$HASH" > /tmp/commit_hash.txt
2828
- name: Find commit message (PR)
2929
shell: bash
30-
id: checkout_code
3130
if: github.event_name == 'pull_request'
3231
run: |
33-
BEFORE_HASH=$(git rev-parse HEAD)
34-
echo "hash=$BEFORE_HASH" >> "$GITHUB_OUTPUT"
35-
# Next we will checkout the actual head (not the merge commits) of the PR
36-
AFTER_HASH="${{ github.event.pull_request.head.sha }}"
37-
git checkout $AFTER_HASH
38-
COMMIT_MESSAGE=$(git log -1 --no-merges)
39-
echo "$COMMIT_MESSAGE" > /tmp/commit_msg.txt
40-
echo "$AFTER_HASH" > /tmp/commit_hash.txt
32+
PR_NUMBER="${{ github.event.pull_request.number }}"
33+
# Fetch the head of the PR explicitly to handle forks. Depth 50 ensures we can traverse past recent merge commits.
34+
git fetch --depth=50 origin "pull/$PR_NUMBER/head:pr-head"
35+
36+
COMMIT_HASH=$(git log -1 --no-merges pr-head --format=%H)
37+
AUTHOR_NAME=$(git log -1 --no-merges pr-head --format=%an)
38+
AUTHOR_EMAIL=$(git log -1 --no-merges pr-head --format=%ae)
39+
TSTAMP=$(git log -1 --no-merges pr-head --format=%aI)
40+
COMMIT_MESSAGE=$(git log -1 --no-merges pr-head --format=%B)
41+
42+
echo "commit $COMMIT_HASH" > /tmp/commit_msg.txt
43+
echo "Author: ${AUTHOR_NAME}<${AUTHOR_EMAIL}>" >> /tmp/commit_msg.txt
44+
echo "Date: ${TSTAMP}" >> /tmp/commit_msg.txt
45+
echo "" >> /tmp/commit_msg.txt
46+
echo "$COMMIT_MESSAGE" >> /tmp/commit_msg.txt
47+
echo "$COMMIT_HASH" > /tmp/commit_hash.txt
4148
- shell: bash
4249
id: action_output
4350
run: |
@@ -47,9 +54,4 @@ runs:
4754
cat /tmp/commit_msg.txt >> "$GITHUB_OUTPUT"
4855
echo "$DELIMITER" >> "$GITHUB_OUTPUT"
4956
# Get the commit hash
50-
echo "hash=$(cat /tmp/commit_hash.txt)" >> "$GITHUB_OUTPUT"
51-
- name: Cleanup Find commit message (PR)
52-
shell: bash
53-
if: github.event_name == 'pull_request'
54-
run: |
55-
git checkout ${{ steps.checkout_code.outputs.hash }}
57+
echo "hash=$(cat /tmp/commit_hash.txt)" >> "$GITHUB_OUTPUT"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repositories {
3131
}
3232
3333
dependencies {
34-
implementation 'com.google.android.filament:filament-android:1.70.0'
34+
implementation 'com.google.android.filament:filament-android:1.70.1'
3535
}
3636
```
3737

@@ -50,7 +50,7 @@ Here are all the libraries available in the group `com.google.android.filament`:
5050
iOS projects can use CocoaPods to install the latest release:
5151

5252
```shell
53-
pod 'Filament', '~> 1.70.0'
53+
pod 'Filament', '~> 1.70.1'
5454
```
5555

5656
## Documentation

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ A new header is inserted each time a *tag* is created.
77
Instead, if you are authoring a PR for the main branch, add your release note to
88
[NEW_RELEASE_NOTES.md](./NEW_RELEASE_NOTES.md).
99

10+
## v1.70.1
11+
12+
1013
## v1.70.0
1114

1215
- engine: fix crash when using variance shadow maps

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ subprojects {
200200
google()
201201
}
202202

203-
if (!name.startsWith("sample") && name != "filament-tools") {
203+
if (!name.startsWith("sample") && name != "filament-tools" && name != "gradle-plugin") {
204204
apply plugin: 'com.android.library'
205205

206206
android {

android/buildSrc/build.gradle

Lines changed: 0 additions & 21 deletions
This file was deleted.

android/filament-utils-android/src/main/java/com/google/android/filament/utils/ModelViewer.kt

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ class ModelViewer(
106106
var skyboxCubemap: Texture? = null
107107

108108
private lateinit var displayHelper: DisplayHelper
109-
private lateinit var cameraManipulator: Manipulator
110-
private lateinit var gestureDetector: GestureDetector
109+
private var cameraManipulator: Manipulator? = null
110+
private var gestureDetector: GestureDetector? = null
111111
private var surfaceView: SurfaceView? = null
112112
private var textureView: TextureView? = null
113113

@@ -157,15 +157,13 @@ class ModelViewer(
157157
surfaceView: SurfaceView,
158158
engine: Engine = Engine.create(),
159159
uiHelper: UiHelper = UiHelper(UiHelper.ContextErrorPolicy.DONT_CHECK),
160-
manipulator: Manipulator? = null
160+
manipulator: Manipulator? = defaultCameraManipulator(surfaceView.width, surfaceView.height)
161161
) : this(engine, uiHelper) {
162-
cameraManipulator = manipulator ?: Manipulator.Builder()
163-
.targetPosition(kDefaultObjectPosition.x, kDefaultObjectPosition.y, kDefaultObjectPosition.z)
164-
.viewport(surfaceView.width, surfaceView.height)
165-
.build(Manipulator.Mode.ORBIT)
166-
167162
this.surfaceView = surfaceView
168-
gestureDetector = GestureDetector(surfaceView, cameraManipulator)
163+
cameraManipulator = manipulator
164+
cameraManipulator?.let { c ->
165+
gestureDetector = GestureDetector(surfaceView, c)
166+
}
169167
displayHelper = DisplayHelper(surfaceView.context)
170168
uiHelper.renderCallback = SurfaceCallback()
171169
uiHelper.attachTo(surfaceView)
@@ -177,15 +175,14 @@ class ModelViewer(
177175
textureView: TextureView,
178176
engine: Engine = Engine.create(),
179177
uiHelper: UiHelper = UiHelper(UiHelper.ContextErrorPolicy.DONT_CHECK),
180-
manipulator: Manipulator? = null
178+
manipulator: Manipulator? = defaultCameraManipulator(textureView.width, textureView.height)
181179
) : this(engine, uiHelper) {
182-
cameraManipulator = manipulator ?: Manipulator.Builder()
183-
.targetPosition(kDefaultObjectPosition.x, kDefaultObjectPosition.y, kDefaultObjectPosition.z)
184-
.viewport(textureView.width, textureView.height)
185-
.build(Manipulator.Mode.ORBIT)
186-
180+
cameraManipulator = manipulator
187181
this.textureView = textureView
188-
gestureDetector = GestureDetector(textureView, cameraManipulator)
182+
cameraManipulator = manipulator
183+
cameraManipulator?.let { c ->
184+
gestureDetector = GestureDetector(textureView, c)
185+
}
189186
displayHelper = DisplayHelper(textureView.context)
190187
uiHelper.renderCallback = SurfaceCallback()
191188
uiHelper.attachTo(textureView)
@@ -302,11 +299,13 @@ class ModelViewer(
302299
asset?.let { populateScene(it) }
303300

304301
// Extract the camera basis from the helper and push it to the Filament camera.
305-
cameraManipulator.getLookAt(eyePos, target, upward)
306-
camera.lookAt(
302+
cameraManipulator?.let { cm ->
303+
cm.getLookAt(eyePos, target, upward)
304+
camera.lookAt(
307305
eyePos[0], eyePos[1], eyePos[2],
308306
target[0], target[1], target[2],
309307
upward[0], upward[1], upward[2])
308+
}
310309

311310
// Render the scene, unless the renderer wants to skip the frame.
312311
if (renderer.beginFrame(swapChain!!, frameTimeNanos)) {
@@ -398,7 +397,7 @@ class ModelViewer(
398397
* Handles a [MotionEvent] to enable one-finger orbit, two-finger pan, and pinch-to-zoom.
399398
*/
400399
fun onTouchEvent(event: MotionEvent) {
401-
gestureDetector.onTouchEvent(event)
400+
gestureDetector?.onTouchEvent(event)
402401
}
403402

404403
@SuppressWarnings("ClickableViewAccessibility")
@@ -451,7 +450,7 @@ class ModelViewer(
451450

452451
override fun onResized(width: Int, height: Int) {
453452
view.viewport = Viewport(0, 0, width, height)
454-
cameraManipulator.setViewport(width, height)
453+
cameraManipulator?.setViewport(width, height)
455454
updateCameraProjection()
456455
synchronizePendingFrames(engine)
457456
}
@@ -468,5 +467,11 @@ class ModelViewer(
468467

469468
companion object {
470469
private val kDefaultObjectPosition = Float3(0.0f, 0.0f, -4.0f)
470+
private fun defaultCameraManipulator(width: Int, height: Int) : Manipulator {
471+
return Manipulator.Builder()
472+
.targetPosition(kDefaultObjectPosition.x, kDefaultObjectPosition.y, kDefaultObjectPosition.z)
473+
.viewport(width, height)
474+
.build(Manipulator.Mode.ORBIT)
475+
}
471476
}
472477
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ configured, the corresponding task will be disabled.
2525

2626
```groovy
2727
plugins {
28-
id 'filament-plugin'
28+
id 'com.google.android.filament-tools'
2929
}
3030
3131
filament {

android/gradle-plugin/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
plugins {
2+
id 'groovy-gradle-plugin'
3+
id 'com.gradle.plugin-publish' version '2.1.0'
4+
}
5+
6+
group = "com.google.android.filament"
7+
version = "0.1.0"
8+
9+
gradlePlugin {
10+
website = "https://github.com/google/filament/tree/main/android/gradle-plugin"
11+
vcsUrl = "https://github.com/google/filament/tree/main/android/gradle-plugin"
12+
13+
plugins {
14+
create("filament-tools") {
15+
id = "com.google.android.filament-tools"
16+
displayName = "Filament Tools Gradle Plugin"
17+
description = "A plugin that helps integrate Filament into Android projects"
18+
tags.addAll('android', 'graphics', 'rendering', 'filament', '3d', 'gltf', 'native')
19+
implementationClass = "com.google.android.filament.gradle.FilamentPlugin"
20+
}
21+
}
22+
}
23+
24+
repositories {
25+
mavenCentral()
26+
gradlePluginPortal()
27+
}
28+
29+
dependencies {
30+
implementation "com.google.gradle:osdetector-gradle-plugin:1.7.3"
31+
}

0 commit comments

Comments
 (0)