Move Float x MaterialColor operator

This commit is contained in:
Sven Weidauer 2024-12-01 12:22:51 +01:00
parent 20e50ad7b9
commit 687cb784fe
2 changed files with 3 additions and 2 deletions

View file

@ -12,3 +12,5 @@ data class MaterialColor(val r: Float, val g: Float, val b: Float) {
val Black: MaterialColor = MaterialColor(0f, 0f, 0f) val Black: MaterialColor = MaterialColor(0f, 0f, 0f)
} }
} }
operator fun Float.times(rhs: MaterialColor) = MaterialColor(this * rhs.r, this * rhs.g, this * rhs.b)

View file

@ -1,6 +1,5 @@
import java.io.File import java.io.File
operator fun Float.times(rhs: MaterialColor) = MaterialColor(this * rhs.r, this * rhs.g, this * rhs.b)
data class Ray(val origin: Point, val direction: Vector) { data class Ray(val origin: Point, val direction: Vector) {
fun at(t: Float) = origin + t * direction fun at(t: Float) = origin + t * direction