// THIS FILE IS GENERATED! DO NOT EDIT IT MANUALLY!
@file:Suppress("PackageDirectoryMismatch", "unused", "FunctionName", "RedundantModalityModifier",
    "UNCHECKED_CAST", "JoinDeclarationAndAssignment", "USELESS_CAST",
    "RemoveRedundantQualifierName", "NOTHING_TO_INLINE", "NON_FINAL_MEMBER_IN_OBJECT",
    "RedundantVisibilityModifier", "RedundantUnitReturnType", "MemberVisibilityCanBePrivate")

package godot

import godot.`annotation`.GodotBaseType
import godot.`internal`.memory.TransferContext
import godot.`internal`.reflection.TypeManager
import godot.common.interop.VoidPtr
import godot.core.NodePath
import godot.core.Rect2
import godot.core.VariantArray
import godot.core.VariantParser.ARRAY
import godot.core.VariantParser.BOOL
import godot.core.VariantParser.LONG
import godot.core.VariantParser.NIL
import godot.core.VariantParser.NODE_PATH
import godot.core.VariantParser.OBJECT
import godot.core.VariantParser.RECT2
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * [LightmapGIData] contains baked lightmap and dynamic object probe data for [LightmapGI]. It is
 * replaced every time lightmaps are baked in [LightmapGI].
 */
@GodotBaseType
public open class LightmapGIData : Resource() {
  /**
   * The lightmap atlas textures generated by the lightmapper.
   */
  public final inline var lightmapTextures: VariantArray<TextureLayered>
    @JvmName("lightmapTexturesProperty")
    get() = getLightmapTextures()
    @JvmName("lightmapTexturesProperty")
    set(`value`) {
      setLightmapTextures(value)
    }

  public final inline var usesSphericalHarmonics: Boolean
    @JvmName("usesSphericalHarmonicsProperty")
    get() = isUsingSphericalHarmonics()
    @JvmName("usesSphericalHarmonicsProperty")
    set(`value`) {
      setUsesSphericalHarmonics(value)
    }

  /**
   * The lightmap atlas texture generated by the lightmapper.
   */
  public final inline var lightTexture: TextureLayered?
    @JvmName("lightTextureProperty")
    get() = getLightTexture()
    @JvmName("lightTextureProperty")
    set(`value`) {
      setLightTexture(value)
    }

  public override fun new(scriptIndex: Int): Unit {
    createNativeObject(ENGINECLASS_LIGHTMAPGIDATA, scriptIndex)
  }

  public final fun setLightmapTextures(lightTextures: VariantArray<TextureLayered>): Unit {
    TransferContext.writeArguments(ARRAY to lightTextures)
    TransferContext.callMethod(ptr, MethodBindings.setLightmapTexturesPtr, NIL)
  }

  public final fun getLightmapTextures(): VariantArray<TextureLayered> {
    TransferContext.writeArguments()
    TransferContext.callMethod(ptr, MethodBindings.getLightmapTexturesPtr, ARRAY)
    return (TransferContext.readReturnValue(ARRAY) as VariantArray<TextureLayered>)
  }

  /**
   * If [usesSphericalHarmonics] is `true`, tells the engine to treat the lightmap data as if it was
   * baked with directional information.
   * **Note:** Changing this value on already baked lightmaps will not cause them to be baked again.
   * This means the material appearance will look incorrect until lightmaps are baked again, in which
   * case the value set here is discarded as the entire [LightmapGIData] resource is replaced by the
   * lightmapper.
   */
  public final fun setUsesSphericalHarmonics(usesSphericalHarmonics: Boolean): Unit {
    TransferContext.writeArguments(BOOL to usesSphericalHarmonics)
    TransferContext.callMethod(ptr, MethodBindings.setUsesSphericalHarmonicsPtr, NIL)
  }

  /**
   * If `true`, lightmaps were baked with directional information. See also
   * [LightmapGI.directional].
   */
  public final fun isUsingSphericalHarmonics(): Boolean {
    TransferContext.writeArguments()
    TransferContext.callMethod(ptr, MethodBindings.isUsingSphericalHarmonicsPtr, BOOL)
    return (TransferContext.readReturnValue(BOOL) as Boolean)
  }

  /**
   * Adds an object that is considered baked within this [LightmapGIData].
   */
  public final fun addUser(
    path: NodePath,
    uvScale: Rect2,
    sliceIndex: Int,
    subInstance: Int,
  ): Unit {
    TransferContext.writeArguments(NODE_PATH to path, RECT2 to uvScale, LONG to sliceIndex.toLong(), LONG to subInstance.toLong())
    TransferContext.callMethod(ptr, MethodBindings.addUserPtr, NIL)
  }

  /**
   * Returns the number of objects that are considered baked within this [LightmapGIData].
   */
  public final fun getUserCount(): Int {
    TransferContext.writeArguments()
    TransferContext.callMethod(ptr, MethodBindings.getUserCountPtr, LONG)
    return (TransferContext.readReturnValue(LONG) as Long).toInt()
  }

  /**
   * Returns the [NodePath] of the baked object at index [userIdx].
   */
  public final fun getUserPath(userIdx: Int): NodePath {
    TransferContext.writeArguments(LONG to userIdx.toLong())
    TransferContext.callMethod(ptr, MethodBindings.getUserPathPtr, NODE_PATH)
    return (TransferContext.readReturnValue(NODE_PATH) as NodePath)
  }

  /**
   * Clear all objects that are considered baked within this [LightmapGIData].
   */
  public final fun clearUsers(): Unit {
    TransferContext.writeArguments()
    TransferContext.callMethod(ptr, MethodBindings.clearUsersPtr, NIL)
  }

  public final fun setLightTexture(lightTexture: TextureLayered?): Unit {
    TransferContext.writeArguments(OBJECT to lightTexture)
    TransferContext.callMethod(ptr, MethodBindings.setLightTexturePtr, NIL)
  }

  public final fun getLightTexture(): TextureLayered? {
    TransferContext.writeArguments()
    TransferContext.callMethod(ptr, MethodBindings.getLightTexturePtr, OBJECT)
    return (TransferContext.readReturnValue(OBJECT) as TextureLayered?)
  }

  public companion object

  internal object MethodBindings {
    public val setLightmapTexturesPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "set_lightmap_textures", 381264803)

    public val getLightmapTexturesPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "get_lightmap_textures", 3995934104)

    public val setUsesSphericalHarmonicsPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "set_uses_spherical_harmonics", 2586408642)

    public val isUsingSphericalHarmonicsPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "is_using_spherical_harmonics", 36873697)

    public val addUserPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "add_user", 4272570515)

    public val getUserCountPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "get_user_count", 3905245786)

    public val getUserPathPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "get_user_path", 408788394)

    public val clearUsersPtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "clear_users", 3218959716)

    public val setLightTexturePtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "set_light_texture", 1278366092)

    public val getLightTexturePtr: VoidPtr =
        TypeManager.getMethodBindPtr("LightmapGIData", "get_light_texture", 3984243839)
  }
}
