All Downloads are FREE. Search and download functionalities are using the official Maven repository.

godot.gen.godot.VisualShaderNodeColorFunc.kt Maven / Gradle / Ivy

// 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.core.TypeManager
import godot.core.VariantType.LONG
import godot.core.VariantType.NIL
import godot.core.memory.TransferContext
import godot.util.VoidPtr
import kotlin.Boolean
import kotlin.Int
import kotlin.Long
import kotlin.Suppress

/**
 * A [godot.core.Color] function to be used within the visual shader graph.
 *
 * Accept a [godot.core.Color] to the input port and transform it according to [function].
 */
@GodotBaseType
public open class VisualShaderNodeColorFunc : VisualShaderNode() {
  /**
   * A function to be applied to the input color. See [enum Function] for options.
   */
  public var function: Function
    get() {
      TransferContext.writeArguments()
      TransferContext.callMethod(rawPtr, MethodBindings.getFunctionPtr, LONG)
      return VisualShaderNodeColorFunc.Function.from(TransferContext.readReturnValue(LONG) as Long)
    }
    set(`value`) {
      TransferContext.writeArguments(LONG to value.id)
      TransferContext.callMethod(rawPtr, MethodBindings.setFunctionPtr, NIL)
    }

  public override fun new(scriptIndex: Int): Boolean {
    callConstructor(ENGINECLASS_VISUALSHADERNODECOLORFUNC, scriptIndex)
    return true
  }

  public enum class Function(
    id: Long,
  ) {
    /**
     * Converts the color to grayscale using the following formula:
     *
     * ```
     * 			vec3 c = input;
     * 			float max1 = max(c.r, c.g);
     * 			float max2 = max(max1, c.b);
     * 			float max3 = max(max1, max2);
     * 			return vec3(max3, max3, max3);
     * 			```
     */
    FUNC_GRAYSCALE(0),
    /**
     * Converts HSV vector to RGB equivalent.
     */
    FUNC_HSV2RGB(1),
    /**
     * Converts RGB vector to HSV equivalent.
     */
    FUNC_RGB2HSV(2),
    /**
     * Applies sepia tone effect using the following formula:
     *
     * ```
     * 			vec3 c = input;
     * 			float r = (c.r * 0.393) + (c.g * 0.769) + (c.b * 0.189);
     * 			float g = (c.r * 0.349) + (c.g * 0.686) + (c.b * 0.168);
     * 			float b = (c.r * 0.272) + (c.g * 0.534) + (c.b * 0.131);
     * 			return vec3(r, g, b);
     * 			```
     */
    FUNC_SEPIA(3),
    /**
     * Represents the size of the [enum Function] enum.
     */
    FUNC_MAX(4),
    ;

    public val id: Long
    init {
      this.id = id
    }

    public companion object {
      public fun from(`value`: Long) = entries.single { it.id == `value` }
    }
  }

  public companion object

  internal object MethodBindings {
    public val setFunctionPtr: VoidPtr =
        TypeManager.getMethodBindPtr("VisualShaderNodeColorFunc", "set_function")

    public val getFunctionPtr: VoidPtr =
        TypeManager.getMethodBindPtr("VisualShaderNodeColorFunc", "get_function")
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy