Skip to content

Commit

Permalink
Made materialInstance nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
jacky-ttt committed Oct 30, 2023
1 parent 8dda173 commit 66ad099
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions sceneview/src/main/java/io/github/sceneview/node/CubeNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ open class CubeNode(
* Should return the material to bind for the zero-based index of the primitive, must be less
* than the [Geometry.submeshes] size passed to constructor.
*/
materialInstances: (index: Int) -> MaterialInstance,
materialInstances: (index: Int) -> MaterialInstance?,
/**
* The parent node.
*
Expand Down Expand Up @@ -51,7 +51,7 @@ open class CubeNode(
/**
* Binds a material instance to all primitives.
*/
materialInstance: MaterialInstance,
materialInstance: MaterialInstance?,
parent: Node? = null,
renderableApply: RenderableManager.Builder.() -> Unit = {}
) : this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class CylinderNode(
* Should return the material to bind for the zero-based index of the primitive, must be less
* than the [Geometry.submeshes] size passed to constructor.
*/
materialInstances: (index: Int) -> MaterialInstance,
materialInstances: (index: Int) -> MaterialInstance?,
/**
* The parent node.
*
Expand Down Expand Up @@ -56,7 +56,7 @@ open class CylinderNode(
/**
* Binds a material instance to all primitives.
*/
materialInstance: MaterialInstance,
materialInstance: MaterialInstance?,
parent: Node? = null,
renderableApply: RenderableManager.Builder.() -> Unit = {}
) : this(
Expand Down
10 changes: 5 additions & 5 deletions sceneview/src/main/java/io/github/sceneview/node/GeometryNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ open class GeometryNode(
* Should return the material to bind for the zero-based index of the primitive, must be less
* than the [Geometry.submeshes] size passed to constructor.
*/
materialInstances: (index: Int) -> MaterialInstance,
materialInstances: (index: Int) -> MaterialInstance?,
/**
* The parent node.
*
Expand Down Expand Up @@ -75,7 +75,7 @@ open class GeometryNode(
/**
* Binds a material instance to all primitives.
*/
materialInstance: MaterialInstance,
materialInstance: MaterialInstance?,
parent: Node? = null,
renderableApply: RenderableManager.Builder.() -> Unit = {}
) : this(
Expand Down Expand Up @@ -105,7 +105,7 @@ open class BaseGeometryNode<T : Geometry>(
* Should return the material to bind for the zero-based index of the primitive, must be less
* than the [Geometry.submeshes] size passed to constructor.
*/
materialInstances: (index: Int) -> MaterialInstance,
materialInstances: (index: Int) -> MaterialInstance?,
/**
* The parent node.
*
Expand All @@ -125,7 +125,7 @@ open class BaseGeometryNode<T : Geometry>(
/**
* Binds a material instance to all primitives.
*/
materialInstance: MaterialInstance,
materialInstance: MaterialInstance?,
parent: Node? = null,
renderableApply: RenderableManager.Builder.() -> Unit = {}
) : this(
Expand All @@ -141,7 +141,7 @@ open class BaseGeometryNode<T : Geometry>(
.geometry(geometry)
.apply {
geometry.submeshes.forEachIndexed { index, _ ->
material(index, materialInstances(index))
materialInstances(index)?.let { material(index, it) }
}
}
.apply(renderableApply)
Expand Down
4 changes: 2 additions & 2 deletions sceneview/src/main/java/io/github/sceneview/node/PlaneNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ open class PlaneNode(
* Should return the material to bind for the zero-based index of the primitive, must be less
* than the [Geometry.submeshes] size passed to constructor.
*/
materialInstances: (index: Int) -> MaterialInstance,
materialInstances: (index: Int) -> MaterialInstance?,
/**
* The parent node.
*
Expand Down Expand Up @@ -55,7 +55,7 @@ open class PlaneNode(
/**
* Binds a material instance to all primitives.
*/
materialInstance: MaterialInstance,
materialInstance: MaterialInstance?,
parent: Node? = null,
renderableApply: RenderableManager.Builder.() -> Unit = {}
) : this(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class SphereNode(
* Should return the material to bind for the zero-based index of the primitive, must be less
* than the [Geometry.submeshes] size passed to constructor.
*/
materialInstances: (index: Int) -> MaterialInstance,
materialInstances: (index: Int) -> MaterialInstance?,
/**
* The parent node.
*
Expand Down Expand Up @@ -56,7 +56,7 @@ open class SphereNode(
/**
* Binds a material instance to all primitives.
*/
materialInstance: MaterialInstance,
materialInstance: MaterialInstance?,
parent: Node? = null,
renderableApply: RenderableManager.Builder.() -> Unit = {}
) : this(
Expand Down

0 comments on commit 66ad099

Please sign in to comment.