Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ dependencies {
implementation("com.google.android.filament:gltfio-android:1.57.1")
implementation("com.google.android.filament:filament-utils-android:1.57.1")

implementation("com.airbnb.android:lottie-compose:6.5.0")

testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
Expand Down
Binary file modified app/src/main/assets/models/level_2.glb
Binary file not shown.
Binary file modified app/src/main/assets/models/level_3.glb
Binary file not shown.
Binary file modified app/src/main/assets/models/level_4.glb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ data class PiggyBankEntryItem(
val id: String,
val type: String,
val amount: Long,
val occurredAt: String,
val occurredDate: String,
val title: String
)

Expand All @@ -30,6 +30,6 @@ fun PiggyBankEntryItem.toDomain(): PiggyBankEntry =
id = id,
type = type,
amount = amount,
occurredAt = occurredAt,
occurredAt = occurredDate,
title = title
)
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ fun NavigationGraph(
onBackClick = { navBackStack.removeLastOrNull() },
onFinish = {
navBackStack.removeLastOrNull()
}
},
isEdit = key.isEdit
)
}

Expand All @@ -199,6 +200,7 @@ fun NavigationGraph(
is Screen.MainAccountDetail -> NavEntry(key) {
MainAccountDetailScreen(
accountNo = key.accountNo,
onBackClick = {navBackStack.removeLastOrNull()}
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ package com.ssafy.tiggle.presentation.ui.growth
import android.annotation.SuppressLint
import android.content.Context
import android.view.Choreographer
import android.view.SurfaceView
import android.view.MotionEvent
import androidx.compose.runtime.*
import android.view.SurfaceView
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.viewinterop.AndroidView
import com.google.android.filament.utils.ModelViewer
import com.google.android.filament.utils.Utils
import com.google.android.filament.IndirectLight
import com.google.android.filament.gltfio.ResourceLoader
import android.graphics.PixelFormat
import android.util.Log
import com.google.android.filament.EntityManager
import com.google.android.filament.LightManager
import com.google.android.filament.gltfio.ResourceLoader
import com.google.android.filament.utils.ModelViewer
import com.google.android.filament.utils.Utils
import java.io.IOException
import java.nio.ByteBuffer
import java.nio.ByteOrder
Expand All @@ -27,6 +28,7 @@ import kotlin.math.PI
*/
// ์ „์—ญ ๋ณ€์ˆ˜
private var baseTransform: FloatArray? = null

// ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ž๋™์žฌ์ƒ์šฉ ์ƒํƒœ
private var animIndex: Int = -1
private var animDurationSec: Float = 0f
Expand Down Expand Up @@ -122,6 +124,7 @@ fun Character3D(
}
)
}

private fun setupFrontLight(modelViewer: ModelViewer) {
// ๋ฐฐ๊ฒฝ์€ ํˆฌ๋ช…/์Šค์นด์ด๋ฐ•์Šค ์—†์Œ (ํ•„์š”์‹œ ์ƒ‰๋งŒ ๋ฐ”๊พธ์„ธ์š”)
modelViewer.scene.skybox = null
Expand All @@ -135,12 +138,13 @@ private fun setupFrontLight(modelViewer: ModelViewer) {
val key = EntityManager.get().create()
LightManager.Builder(LightManager.Type.DIRECTIONAL)
.color(1.0f, 1.0f, 1.0f) // ์ˆœ๋ฐฑ์ƒ‰ ๋ผ์ดํŠธ
.intensity(200_000f) // ๋ฐ๊ธฐ (ํ•„์š”ํ•˜๋ฉด 80k~200k ์‚ฌ์ด๋กœ ์กฐ์ ˆ)
.intensity(450_000f) // ๋ฐ๊ธฐ (ํ•„์š”ํ•˜๋ฉด 80k~200k ์‚ฌ์ด๋กœ ์กฐ์ ˆ)
.direction(0f, -0.2f, -1f) // โœ… ํ™”๋ฉด ์ •๋ฉด(โ€“Z)์—์„œ ์•ฝ๊ฐ„ ์•„๋ž˜๋กœ
.castShadows(false) // ๊ทธ๋ฆผ์ž ๋น„ํ™œ์„ฑํ™”
.build(modelViewer.engine, key)
modelViewer.scene.addEntity(key)
}

/**
* ํˆฌ๋ช… ๋ฐฐ๊ฒฝ ์„ค์ •
*/
Expand Down Expand Up @@ -195,10 +199,10 @@ private fun loadModelForLevel(context: Context, modelViewer: ModelViewer, level:

// column-major 4x4, translation์€ [12],[13],[14] ์Šฌ๋กฏ
val trs = floatArrayOf(
scale, 0f, 0f, 0f,
0f, scale,0f, 0f,
0f, 0f, scale,0f,
0f, translateY, 0f, 1f
scale, 0f, 0f, 0f,
0f, scale, 0f, 0f,
0f, 0f, scale, 0f,
0f, translateY, 0f, 1f
)
tm.setTransform(rootInst, trs)

Expand Down Expand Up @@ -277,6 +281,7 @@ private fun enableHorizontalDragRotation(surfaceView: SurfaceView, modelViewer:
MotionEvent.ACTION_DOWN -> {
lastTouchX = event.x
}

MotionEvent.ACTION_MOVE -> {
val dx = event.x - lastTouchX
lastTouchX = event.x
Expand Down Expand Up @@ -319,9 +324,9 @@ private fun multiplyMat4(a: FloatArray, b: FloatArray): FloatArray {
for (j in 0..3) {
var sum = 0f
for (k in 0..3) {
sum += a[i + k*4] * b[k + j*4]
sum += a[i + k * 4] * b[k + j * 4]
}
out[i + j*4] = sum
out[i + j * 4] = sum
}
}
return out
Expand Down
Loading