path
stringlengths
4
280
owner
stringlengths
2
39
repo_id
int64
21.1k
879M
is_fork
bool
2 classes
languages_distribution
stringlengths
13
1.95k
content
stringlengths
7
482k
issues
int64
0
13.9k
main_language
stringclasses
121 values
forks
stringlengths
1
5
stars
int64
0
111k
commit_sha
stringlengths
40
40
size
int64
7
482k
name
stringlengths
1
100
license
stringclasses
93 values
compiler/javac-wrapper/src/org/jetbrains/kotlin/javac/wrappers/symbols/SymbolBasedValueParameter.kt
JakeWharton
99,388,807
false
null
/* * Copyright 2010-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.kotlin.javac.wrappers.symbols import org.jetbrains.kotlin.javac.JavacWrapper import org.jetbrains.kotlin.load.java.structure.JavaAnnotation import org.jetbrains.kotlin.load.java.structure.JavaType import org.jetbrains.kotlin.load.java.structure.JavaValueParameter import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import javax.lang.model.element.VariableElement class SymbolBasedValueParameter( element: VariableElement, private val elementName : String, override val isVararg : Boolean, javac: JavacWrapper ) : SymbolBasedElement<VariableElement>(element, javac), JavaValueParameter { override val annotations: Collection<JavaAnnotation> get() = element.annotationMirrors.map { SymbolBasedAnnotation(it, javac) } override fun findAnnotation(fqName: FqName) = element.findAnnotation(fqName, javac) override val isDeprecatedInJavaDoc: Boolean get() = javac.isDeprecated(element) override val name: Name get() = Name.identifier(elementName) override val type: JavaType get() = SymbolBasedType.create(element.asType(), javac) }
5
null
5748
83
4383335168338df9bbbe2a63cb213a68d0858104
1,781
kotlin
Apache License 2.0
zoomable/src/main/java/net/engawapg/lib/zoomable/Zoomable.kt
usuiat
582,659,097
false
null
/* * Copyright 2022 usuiat * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.engawapg.lib.zoomable import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.spring import androidx.compose.foundation.gestures.awaitEachGesture import androidx.compose.foundation.gestures.awaitFirstDown import androidx.compose.foundation.gestures.calculateCentroid import androidx.compose.foundation.gestures.calculatePan import androidx.compose.foundation.gestures.calculateZoom import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size import androidx.compose.ui.input.pointer.AwaitPointerEventScope import androidx.compose.ui.input.pointer.PointerEvent import androidx.compose.ui.input.pointer.PointerEventPass import androidx.compose.ui.input.pointer.PointerInputChange import androidx.compose.ui.input.pointer.PointerInputScope import androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNode import androidx.compose.ui.input.pointer.positionChanged import androidx.compose.ui.layout.Measurable import androidx.compose.ui.layout.MeasureResult import androidx.compose.ui.layout.MeasureScope import androidx.compose.ui.node.DelegatingNode import androidx.compose.ui.node.LayoutModifierNode import androidx.compose.ui.node.ModifierNodeElement import androidx.compose.ui.node.PointerInputModifierNode import androidx.compose.ui.platform.InspectorInfo import androidx.compose.ui.unit.Constraints import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.toSize import androidx.compose.ui.util.fastAny import androidx.compose.ui.util.fastForEach import kotlinx.coroutines.launch /** * Customized transform gesture detector. * * A caller of this function can choose if the pointer events will be consumed. * And the caller can implement [onGestureStart] and [onGestureEnd] event. * * @param canConsumeGesture Lambda that asks the caller whether the gesture can be consumed. * @param onGesture This lambda is called when [canConsumeGesture] returns true. * @param onGestureStart This lambda is called when a gesture starts. * @param onGestureEnd This lambda is called when a gesture ends. * @param onTap will be called when single tap is detected. * @param onDoubleTap will be called when double tap is detected. * @param enableOneFingerZoom If true, enable one finger zoom gesture, double tap followed by * vertical scrolling. */ private suspend fun PointerInputScope.detectTransformGestures( canConsumeGesture: (pan: Offset, zoom: Float) -> Boolean, onGesture: (centroid: Offset, pan: Offset, zoom: Float, timeMillis: Long) -> Unit, onGestureStart: () -> Unit = {}, onGestureEnd: () -> Unit = {}, onTap: (position: Offset) -> Unit = {}, onDoubleTap: (position: Offset) -> Unit = {}, enableOneFingerZoom: Boolean = true, ) = awaitEachGesture { val firstDown = awaitFirstDown(requireUnconsumed = false) onGestureStart() var firstUp: PointerInputChange = firstDown var hasMoved = false var isMultiTouch = false var isLongPressed = false forEachPointerEventUntilReleased { event, isTouchSlopPast -> if (isTouchSlopPast) { val zoomChange = event.calculateZoom() val panChange = event.calculatePan() if (zoomChange != 1f || panChange != Offset.Zero) { val centroid = event.calculateCentroid(useCurrent = true) val timeMillis = event.changes[0].uptimeMillis if (canConsumeGesture(panChange, zoomChange)) { onGesture(centroid, panChange, zoomChange, timeMillis) event.consumePositionChanges() } } hasMoved = true } if (event.changes.size > 1) { isMultiTouch = true } firstUp = event.changes[0] } if (firstUp.uptimeMillis - firstDown.uptimeMillis > viewConfiguration.longPressTimeoutMillis) { isLongPressed = true } val isTap = !hasMoved && !isMultiTouch && !isLongPressed // Vertical scrolling following a double tap is treated as a zoom gesture. if (isTap) { val secondDown = awaitSecondDown(firstUp) if (secondDown == null) { onTap(firstUp.position) } else { var isDoubleTap = true var secondUp: PointerInputChange = secondDown forEachPointerEventUntilReleased { event, isTouchSlopPast -> if (isTouchSlopPast) { if (enableOneFingerZoom) { val panChange = event.calculatePan() val zoomChange = 1f + panChange.y * 0.004f if (zoomChange != 1f) { val centroid = event.calculateCentroid(useCurrent = true) val timeMillis = event.changes[0].uptimeMillis if (canConsumeGesture(Offset.Zero, zoomChange)) { onGesture(centroid, Offset.Zero, zoomChange, timeMillis) event.consumePositionChanges() } } } isDoubleTap = false } if (event.changes.size > 1) { isDoubleTap = false } secondUp = event.changes[0] } if (secondUp.uptimeMillis - secondDown.uptimeMillis > viewConfiguration.longPressTimeoutMillis) { isDoubleTap = false } if (isDoubleTap) { onDoubleTap(secondUp.position) } } } onGestureEnd() } /** * Invoke action for each PointerEvent until all pointers are released. * * @param action Callback function that will be called every PointerEvents occur. */ private suspend fun AwaitPointerEventScope.forEachPointerEventUntilReleased( action: (event: PointerEvent, isTouchSlopPast: Boolean) -> Unit, ) { val touchSlop = TouchSlop(viewConfiguration.touchSlop) do { val mainEvent = awaitPointerEvent(pass = PointerEventPass.Main) if (mainEvent.changes.fastAny { it.isConsumed }) { break } val isTouchSlopPast = touchSlop.isPast(mainEvent) action(mainEvent, isTouchSlopPast) if (isTouchSlopPast) { continue } val finalEvent = awaitPointerEvent(pass = PointerEventPass.Final) if (finalEvent.changes.fastAny { it.isConsumed }) { break } } while (mainEvent.changes.fastAny { it.pressed }) } /** * Await second down or timeout from first up * * @param firstUp The first up event * @return If the second down event comes before timeout, returns it. If not, returns null. */ private suspend fun AwaitPointerEventScope.awaitSecondDown( firstUp: PointerInputChange ): PointerInputChange? = withTimeoutOrNull(viewConfiguration.doubleTapTimeoutMillis) { val minUptime = firstUp.uptimeMillis + viewConfiguration.doubleTapMinTimeMillis var change: PointerInputChange // The second tap doesn't count if it happens before DoubleTapMinTime of the first tap do { change = awaitFirstDown() } while (change.uptimeMillis < minUptime) change } /** * Consume event if the position is changed. */ private fun PointerEvent.consumePositionChanges() { changes.fastForEach { if (it.positionChanged()) { it.consume() } } } /** * Touch slop detector. * * This class holds accumulated zoom and pan value to see if touch slop is past. * * @param threshold Threshold of movement of gesture after touch down. If the movement exceeds this * value, it is judged to be a swipe or zoom gesture. */ private class TouchSlop(private val threshold: Float) { private var pan = Offset.Zero private var _isPast = false /** * Judge the touch slop is past. * * @param event Event that occurs this time. * @return True if the accumulated zoom or pan exceeds the threshold. */ fun isPast(event: PointerEvent): Boolean { if (_isPast) { return true } if (event.changes.size > 1) { // If there are two or more fingers, we determine the touch slop is past immediately. _isPast = true } else { pan += event.calculatePan() _isPast = pan.getDistance() > threshold } return _isPast } } /** * [ScrollGesturePropagation] defines when [Modifier.zoomable] propagates scroll gestures to the * parent composable element. */ enum class ScrollGesturePropagation { /** * Propagates the scroll gesture to the parent composable element when the content is scrolled * to the edge and attempts to scroll further. */ ContentEdge, /** * Propagates the scroll gesture to the parent composable element when the content is not zoomed. */ NotZoomed, } /** * Modifier function that make the content zoomable. * * @param zoomState A [ZoomState] object. * @param zoomEnabled specifies if zoom behaviour is enabled or disabled. Even if this is false, * [onTap] and [onDoubleTap] will be called. * @param enableOneFingerZoom If true, enable one finger zoom gesture, double tap followed by * vertical scrolling. * @param scrollGesturePropagation specifies when scroll gestures are propagated to the parent * composable element. * @param onTap will be called when single tap is detected on the element. * @param onDoubleTap will be called when double tap is detected on the element. This is a suspend * function and called in a coroutine scope. The default is to toggle the scale between 1.0f and * 2.5f with animation. */ fun Modifier.zoomable( zoomState: ZoomState, zoomEnabled: Boolean = true, enableOneFingerZoom: Boolean = true, scrollGesturePropagation: ScrollGesturePropagation = ScrollGesturePropagation.ContentEdge, onTap: (position: Offset) -> Unit = {}, onDoubleTap: suspend (position: Offset) -> Unit = { position -> if (zoomEnabled) zoomState.toggleScale(2.5f, position) }, ): Modifier = this then ZoomableElement( zoomState, zoomEnabled, enableOneFingerZoom, scrollGesturePropagation, onTap, onDoubleTap, ) private data class ZoomableElement( val zoomState: ZoomState, val zoomEnabled: Boolean, val enableOneFingerZoom: Boolean, val scrollGesturePropagation: ScrollGesturePropagation, val onTap: (position: Offset) -> Unit, val onDoubleTap: suspend (position: Offset) -> Unit, ): ModifierNodeElement<ZoomableNode>() { override fun create(): ZoomableNode = ZoomableNode( zoomState, zoomEnabled, enableOneFingerZoom, scrollGesturePropagation, onTap, onDoubleTap, ) override fun update(node: ZoomableNode) { node.update( zoomState, zoomEnabled, enableOneFingerZoom, scrollGesturePropagation, onTap, onDoubleTap, ) } override fun InspectorInfo.inspectableProperties() { name = "zoomable" properties["zoomState"] = zoomState properties["zoomEnabled"] = zoomEnabled properties["enableOneFingerZoom"] = enableOneFingerZoom properties["scrollGesturePropagation"] = scrollGesturePropagation properties["onTap"] = onTap properties["onDoubleTap"] = onDoubleTap } } private class ZoomableNode( var zoomState: ZoomState, var zoomEnabled: Boolean, var enableOneFingerZoom: Boolean, var scrollGesturePropagation: ScrollGesturePropagation, var onTap: (position: Offset) -> Unit, var onDoubleTap: suspend (position: Offset) -> Unit, ): PointerInputModifierNode, LayoutModifierNode, DelegatingNode() { var measuredSize = Size.Zero fun update( zoomState: ZoomState, zoomEnabled: Boolean, enableOneFingerZoom: Boolean, scrollGesturePropagation: ScrollGesturePropagation, onTap: (position: Offset) -> Unit, onDoubleTap: suspend (position: Offset) -> Unit, ) { if (this.zoomState != zoomState) { zoomState.setLayoutSize(measuredSize) this.zoomState = zoomState } this.zoomEnabled = zoomEnabled this.enableOneFingerZoom = enableOneFingerZoom this.scrollGesturePropagation = scrollGesturePropagation this.onTap = onTap this.onDoubleTap = onDoubleTap } val pointerInputNode = delegate(SuspendingPointerInputModifierNode { detectTransformGestures( onGestureStart = { resetConsumeGesture() zoomState.startGesture() }, canConsumeGesture = { pan, zoom -> zoomEnabled && canConsumeGesture(pan, zoom) }, onGesture = { centroid, pan, zoom, timeMillis -> if (zoomEnabled) { coroutineScope.launch { zoomState.applyGesture( pan = pan, zoom = zoom, position = centroid, timeMillis = timeMillis, ) } } }, onGestureEnd = { coroutineScope.launch { zoomState.endGesture() } }, onTap = onTap, onDoubleTap = { position -> coroutineScope.launch { onDoubleTap(position) } }, enableOneFingerZoom = enableOneFingerZoom, ) }) private var consumeGesture: Boolean? = null private fun resetConsumeGesture() { consumeGesture = null } private fun canConsumeGesture(pan: Offset, zoom: Float): Boolean { val currentValue = consumeGesture if (currentValue != null) { return currentValue } val newValue = when { zoom != 1f -> true zoomState.scale == 1f -> false scrollGesturePropagation == ScrollGesturePropagation.NotZoomed -> true else -> zoomState.willChangeOffset(pan) } consumeGesture = newValue return newValue } override fun onPointerEvent( pointerEvent: PointerEvent, pass: PointerEventPass, bounds: IntSize ) { pointerInputNode.onPointerEvent(pointerEvent, pass, bounds) } override fun onCancelPointerInput() { pointerInputNode.onCancelPointerInput() } override fun MeasureScope.measure( measurable: Measurable, constraints: Constraints ): MeasureResult { val placeable = measurable.measure(constraints) measuredSize = IntSize(placeable.measuredWidth, placeable.measuredHeight).toSize() zoomState.setLayoutSize(measuredSize) return layout(placeable.width, placeable.height) { placeable.placeWithLayer(x = 0, y = 0) { scaleX = zoomState.scale scaleY = zoomState.scale translationX = zoomState.offsetX translationY = zoomState.offsetY } } } } /** * Toggle the scale between [targetScale] and 1.0f. * * @param targetScale Scale to be set if this function is called when the scale is 1.0f. * @param position Zoom around this point. * @param animationSpec The animation configuration. */ suspend fun ZoomState.toggleScale( targetScale: Float, position: Offset, animationSpec: AnimationSpec<Float> = spring(), ) { val newScale = if (scale == 1f) targetScale else 1f changeScale(newScale, position, animationSpec) }
8
null
9
373
995750b59fce6d916e6e2bf6c801d1bdfc389cc7
16,392
Zoomable
Apache License 2.0
ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMarkerOptions.kt
bluesource
342,192,341
false
null
package at.bluesource.choicesdk.maps.hms import android.os.Parcel import at.bluesource.choicesdk.maps.common.BitmapDescriptor import at.bluesource.choicesdk.maps.common.LatLng import at.bluesource.choicesdk.maps.common.LatLng.Companion.toChoiceLatLng import at.bluesource.choicesdk.maps.common.LatLng.Companion.toHmsLatLng import at.bluesource.choicesdk.maps.common.options.MarkerOptions import com.huawei.hms.maps.model.BitmapDescriptorFactory /** * Wrapper class for hms version of MarkerOptions * * @property markerOptions hms MarkerOptions instance * @see com.huawei.hms.maps.model.MarkerOptions */ internal class HmsMarkerOptions(private val markerOptions: com.huawei.hms.maps.model.MarkerOptions) : MarkerOptions { override fun alpha(alpha: Float): MarkerOptions { markerOptions.alpha(alpha) return this } override fun anchor(u: Float, v: Float): MarkerOptions { markerOptions.anchorMarker(u, v) return this } override fun draggable(draggable: Boolean): MarkerOptions { markerOptions.draggable(draggable) return this } override fun flat(flat: Boolean): MarkerOptions { markerOptions.flat(flat) return this } override fun getAnchorU(): Float { return markerOptions.markerAnchorU } override fun getAnchorV(): Float { return markerOptions.markerAnchorV } override fun getInfoWindowAnchorU(): Float { return markerOptions.infoWindowAnchorU } override fun getInfoWindowAnchorV(): Float { return markerOptions.infoWindowAnchorV } override fun getPosition(): LatLng { return markerOptions.position.toChoiceLatLng() } override fun getRotation(): Float { return markerOptions.rotation } override fun getSnippet(): String { return markerOptions.snippet } override fun getTitle(): String { return markerOptions.title } override fun getZIndex(): Float { return markerOptions.zIndex } override fun icon(bitmapDescriptor: BitmapDescriptor): MarkerOptions { when (bitmapDescriptor) { is BitmapDescriptor.HmsBitmapDescriptor -> markerOptions.icon(bitmapDescriptor.value) else -> markerOptions.icon(BitmapDescriptorFactory.defaultMarker()) } return this } override fun defaultIcon(): MarkerOptions { markerOptions.icon(BitmapDescriptorFactory.defaultMarker()) return this } override fun infoWindowAnchor(u: Float, v: Float): MarkerOptions { markerOptions.infoWindowAnchor(u, v) return this } override fun isDraggable(): Boolean { return markerOptions.isDraggable } override fun isFlat(): Boolean { return markerOptions.isFlat } override fun isVisible(): Boolean { return markerOptions.isVisible } override fun position(latLng: LatLng): MarkerOptions { markerOptions.position(latLng.toHmsLatLng()) return this } override fun rotation(rotation: Float): MarkerOptions { markerOptions.rotation(rotation) return this } override fun snippet(snippet: String): MarkerOptions { markerOptions.snippet(snippet) return this } override fun title(title: String): MarkerOptions { markerOptions.title(title) return this } override fun visible(visible: Boolean): MarkerOptions { markerOptions.visible(visible) return this } override fun writeToParcel(out: Parcel, flags: Int) { markerOptions.writeToParcel(out, flags) } override fun zIndex(zIndex: Float) { markerOptions.zIndex(zIndex) } internal fun getHmsMarkerOptions(): com.huawei.hms.maps.model.MarkerOptions { return this.markerOptions } }
11
null
19
85
4c70f2711f9ee71aa7ae73ab4d6eaa5a3fa81274
3,865
ChoiceSDK
Apache License 2.0
src/backend/ci/core/repository/api-repository/src/main/kotlin/com/tencent/devops/repository/pojo/AppInstallationResult.kt
TencentBlueKing
189,153,491
false
{"Kotlin": 30176725, "Vue": 6739254, "JavaScript": 1256623, "Go": 616850, "Lua": 567159, "TypeScript": 461781, "SCSS": 365654, "Shell": 157561, "Java": 153049, "CSS": 106299, "HTML": 96201, "Python": 39238, "Less": 24714, "Makefile": 10630, "Smarty": 10297, "Dockerfile": 5097, "Batchfile": 4908, "PowerShell": 1626, "VBScript": 189}
package com.tencent.devops.repository.pojo import io.swagger.v3.oas.annotations.media.Schema @Schema(title = "代码库项目app安装结果") data class AppInstallationResult( @get:Schema(title = "状态") val status: Boolean, @get:Schema(title = "url地址") val url: String = "" )
719
Kotlin
498
2,382
dd483c38bdbe5c17fa0e5e5bc3390cd1cd40757c
276
bk-ci
MIT License
src/main/kotlin/dev/shtanko/algorithms/leetcode/MaxValueBoundedArray.kt
ashtanko
203,993,092
false
{"Kotlin": 5878379, "Shell": 1168, "Makefile": 917}
/* * Copyright 2023 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package dev.shtanko.algorithms.leetcode /** * 1802. Maximum Value at a Given Index in a Bounded Array * @see <a href="https://leetcode.com/problems/maximum-value-at-a-given-index-in-a-bounded-array/">Source</a> */ fun interface MaxValueBoundedArray { fun maxValue(n: Int, index: Int, maxSum: Int): Int } /** * Approach: Greedy + Binary Search */ class MaxValueBoundedArraySolution : MaxValueBoundedArray { override fun maxValue(n: Int, index: Int, maxSum: Int): Int { var left = 1 var right = maxSum while (left < right) { val mid = (left + right + 1) / 2 if (getSum(index, mid, n) <= maxSum) { left = mid } else { right = mid - 1 } } return left } private fun getSum(index: Int, value: Int, n: Int): Long { var count: Long = 0 // On index's left: // If value > index, there are index + 1 numbers in the arithmetic sequence: // [value - index, ..., value - 1, value]. // Otherwise, there are value numbers in the arithmetic sequence: // [1, 2, ..., value - 1, value], plus a sequence of length (index - value + 1) of 1s. count += if (value > index) { (value + value - index).toLong() * (index + 1) / 2 } else { (value + 1).toLong() * value / 2 + index - value + 1 } // On index's right: // If value >= n - index, there are n - index numbers in the arithmetic sequence: // [value, value - 1, ..., value - n + 1 + index]. // Otherwise, there are value numbers in the arithmetic sequence: // [value, value - 1, ..., 1], plus a sequence of length (n - index - value) of 1s. count += if (value >= n - index) { (value + value - n + 1 + index).toLong() * (n - index) / 2 } else { (value + 1).toLong() * value / 2 + n - index - value } return count - value } }
4
Kotlin
0
19
c3eeb85a0de638ec76f4f18f99224c1569661568
2,585
kotlab
Apache License 2.0
plugins/github/src/org/jetbrains/plugins/github/authentication/accounts/GHAccountManager.kt
JetBrains
2,489,216
false
null
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.github.authentication.accounts import com.intellij.collaboration.auth.AccountManagerBase import com.intellij.collaboration.auth.AccountsListener import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.Service import com.intellij.openapi.components.service import com.intellij.util.messages.Topic import org.jetbrains.annotations.ApiStatus import org.jetbrains.plugins.github.api.GithubServerPath import org.jetbrains.plugins.github.util.GithubUtil internal val GithubAccount.isGHAccount: Boolean get() = server.isGithubDotCom /** * Handles application-level Github accounts */ @Service internal class GHAccountManager : AccountManagerBase<GithubAccount, String>(GithubUtil.SERVICE_DISPLAY_NAME) { override fun accountsRepository() = service<GHPersistentAccounts>() override fun serializeCredentials(credentials: String): String = credentials override fun deserializeCredentials(credentials: String): String = credentials init { @Suppress("DEPRECATION") addListener(this, object : AccountsListener<GithubAccount> { override fun onAccountListChanged(old: Collection<GithubAccount>, new: Collection<GithubAccount>) { val removedPublisher = ApplicationManager.getApplication().messageBus.syncPublisher(ACCOUNT_REMOVED_TOPIC) for (account in (old - new)) { removedPublisher.accountRemoved(account) } val tokenPublisher = ApplicationManager.getApplication().messageBus.syncPublisher(ACCOUNT_TOKEN_CHANGED_TOPIC) for (account in (new - old)) { tokenPublisher.tokenChanged(account) } } override fun onAccountCredentialsChanged(account: GithubAccount) = ApplicationManager.getApplication().messageBus.syncPublisher(ACCOUNT_TOKEN_CHANGED_TOPIC).tokenChanged(account) }) } companion object { @Deprecated("Use TOPIC") @Suppress("DEPRECATION") @JvmStatic val ACCOUNT_REMOVED_TOPIC = Topic("GITHUB_ACCOUNT_REMOVED", AccountRemovedListener::class.java) @Deprecated("Use TOPIC") @Suppress("DEPRECATION") @JvmStatic val ACCOUNT_TOKEN_CHANGED_TOPIC = Topic("GITHUB_ACCOUNT_TOKEN_CHANGED", AccountTokenChangedListener::class.java) fun createAccount(name: String, server: GithubServerPath) = GithubAccount(name, server) } } @Deprecated("Use GithubAuthenticationManager.addListener") @ApiStatus.ScheduledForRemoval interface AccountRemovedListener { fun accountRemoved(removedAccount: GithubAccount) } @Deprecated("Use GithubAuthenticationManager.addListener") @ApiStatus.ScheduledForRemoval interface AccountTokenChangedListener { fun tokenChanged(account: GithubAccount) }
191
null
4372
13,319
4d19d247824d8005662f7bd0c03f88ae81d5364b
2,842
intellij-community
Apache License 2.0
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/tasks/DeleteDeviceTask.kt
matrix-org
287,466,066
false
null
/* * Copyright 2020 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.matrix.android.sdk.internal.crypto.tasks import org.matrix.android.sdk.api.auth.UIABaseAuth import org.matrix.android.sdk.api.auth.UserInteractiveAuthInterceptor import org.matrix.android.sdk.api.session.uia.UiaResult import org.matrix.android.sdk.internal.auth.registration.handleUIA import org.matrix.android.sdk.internal.crypto.api.CryptoApi import org.matrix.android.sdk.internal.crypto.model.rest.DeleteDeviceParams import org.matrix.android.sdk.internal.network.GlobalErrorReceiver import org.matrix.android.sdk.internal.network.executeRequest import org.matrix.android.sdk.internal.task.Task import timber.log.Timber import javax.inject.Inject internal interface DeleteDeviceTask : Task<DeleteDeviceTask.Params, Unit> { data class Params( val deviceId: String, val userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor?, val userAuthParam: UIABaseAuth? ) } internal class DefaultDeleteDeviceTask @Inject constructor( private val cryptoApi: CryptoApi, private val globalErrorReceiver: GlobalErrorReceiver ) : DeleteDeviceTask { override suspend fun execute(params: DeleteDeviceTask.Params) { try { executeRequest(globalErrorReceiver) { cryptoApi.deleteDevice(params.deviceId, DeleteDeviceParams(params.userAuthParam?.asMap())) } } catch (throwable: Throwable) { if (params.userInteractiveAuthInterceptor == null || handleUIA( failure = throwable, interceptor = params.userInteractiveAuthInterceptor, retryBlock = { authUpdate -> execute(params.copy(userAuthParam = authUpdate)) } ) != UiaResult.SUCCESS ) { Timber.d("## UIA: propagate failure") throw throwable } } } }
75
null
27
97
55cc7362de34a840c67b4bbb3a14267bc8fd3b9c
2,597
matrix-android-sdk2
Apache License 2.0
build-logic/src/main/kotlin/com.example.platform.plugin/SamplePlugin.kt
android
623,336,962
false
null
/* * Copyright 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.platform.plugin import com.android.build.api.dsl.LibraryExtension import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.api.plugins.JavaPluginExtension import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.project import org.jetbrains.kotlin.gradle.tasks.KotlinCompile class SamplePlugin : Plugin<Project> { override fun apply(target: Project) { with(target) { val libs = extensions .getByType(VersionCatalogsExtension::class.java) .named("libs") with(pluginManager) { apply("com.android.library") apply("org.jetbrains.kotlin.android") apply("org.jetbrains.kotlin.kapt") apply("com.google.devtools.ksp") apply("dagger.hilt.android.plugin") apply<CommonConventionPlugin>() } pluginManager.withPlugin("java") { extensions.configure<JavaPluginExtension> { toolchain { it.languageVersion.set(JavaLanguageVersion.of(11)) } } } // TODO: remove when KSP starts respecting the Java/Kotlin toolchain tasks.withType(KotlinCompile::class.java).configureEach { it.kotlinOptions { jvmTarget = "11" } } pluginManager.withPlugin("com.android.library") { configure<LibraryExtension> { compileSdk = 33 defaultConfig { minSdk = 21 targetSdk = 33 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = libs.findVersion("composeCompiler").get().toString() } } } dependencies { // Do not add the shared module to itself if (!project.displayName.contains("samples:base")) { "implementation"(project(":samples:base")) } "implementation"(platform(libs.findLibrary("compose.bom").get())) "androidTestImplementation"(platform(libs.findLibrary("compose.bom").get())) "implementation"(libs.findLibrary("casa.base").get()) "ksp"(libs.findLibrary("casa.processor").get()) "implementation"(libs.findLibrary("hilt.android").get()) "kapt"(libs.findLibrary("hilt.compiler").get()) "implementation"(libs.findLibrary("androidx.core").get()) "implementation"(libs.findLibrary("androidx.fragment").get()) "implementation"(libs.findLibrary("androidx.activity.compose").get()) "implementation"(libs.findLibrary("compose.foundation.foundation").get()) "implementation"(libs.findLibrary("compose.runtime.runtime").get()) "implementation"(libs.findLibrary("compose.runtime.livedata").get()) "implementation"(libs.findLibrary("androidx.lifecycle.viewmodel.compose").get()) "implementation"(libs.findLibrary("compose.ui.ui").get()) "implementation"(libs.findLibrary("compose.material3").get()) "implementation"(libs.findLibrary("coil.compose").get()) "implementation"(libs.findLibrary("coil.video").get()) "implementation"(libs.findLibrary("accompanist.permissions").get()) "implementation"(libs.findLibrary("compose.ui.tooling.preview").get()) "debugImplementation"(libs.findLibrary("compose.ui.tooling").get()) } } } }
6
null
90
977
0479d2e8697c5d986d8ac7c135399e408bea78c8
5,009
platform-samples
Apache License 2.0
bezier/src/main/java/io/channel/bezier/icon/ArrowHookRightDown.kt
channel-io
736,533,981
false
{"Kotlin": 2421787, "Python": 12500}
@file:Suppress("ObjectPropertyName", "UnusedReceiverParameter") // Auto-generated by script/generate_compose_bezier_icon.py package io.channel.bezier.icon import androidx.compose.foundation.layout.size import androidx.compose.material.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import io.channel.bezier.BezierIcon import io.channel.bezier.BezierIcons val BezierIcons.ArrowHookRightDown: BezierIcon get() = object : BezierIcon { override val imageVector: ImageVector get() = _arrowHookRightDown ?: ImageVector.Builder( name = "ArrowHookRightDown", defaultWidth = 24.dp, defaultHeight = 24.dp, viewportWidth = 24f, viewportHeight = 24f, ).apply { path( fill = SolidColor(Color(0xFF313234)), strokeLineWidth = 1f, pathFillType = PathFillType.EvenOdd, ) { moveTo(9.5f, 3.026f) lineTo(13.0f, 3.026f) arcTo(1.0f, 1.0f, 270.0f, isMoreThanHalf = false, isPositiveArc = true, 13.0f, 5.026f) lineTo(9.5f, 5.026f) arcTo(4.505f, 4.505f, 269.93644391695096f, isMoreThanHalf = false, isPositiveArc = false, 5.0f, 9.526f) curveTo(5.0f, 12.008f, 7.02f, 14.026f, 9.5f, 14.026f) lineTo(18.82f, 14.026f) lineTo(15.527000000000001f, 10.733f) arcTo(1.0f, 1.0f, 136.03544024379647f, isMoreThanHalf = false, isPositiveArc = true, 16.942f, 9.32f) lineTo(21.562f, 13.940000000000001f) arcTo(1.5f, 1.5f, 315.03565071645426f, isMoreThanHalf = false, isPositiveArc = true, 21.562f, 16.060000000000002f) lineTo(16.942f, 20.680000000000003f) arcTo(1.0f, 1.0f, 43.964559756203556f, isMoreThanHalf = true, isPositiveArc = true, 15.527000000000001f, 19.267000000000003f) lineTo(18.767000000000003f, 16.027f) lineTo(9.5f, 16.027f) arcTo(6.51f, 6.51f, 90.08794449072336f, isMoreThanHalf = false, isPositiveArc = true, 3.0f, 9.527000000000001f) curveTo(3.0f, 5.942000000000001f, 5.916f, 3.027000000000001f, 9.5f, 3.027000000000001f) } }.build().also { _arrowHookRightDown = it } } private var _arrowHookRightDown: ImageVector? = null @Preview(showBackground = true) @Composable private fun ArrowHookRightDownIconPreview() { Icon( modifier = Modifier.size(128.dp), imageVector = BezierIcons.ArrowHookRightDown.imageVector, contentDescription = null, ) }
7
Kotlin
3
6
39cd58b0dd4a1543d54f0c1ce7c605f33ce135c6
3,176
bezier-compose
MIT License
kotlin/services/ecs/src/main/kotlin/com/kotlin/ecs/CreateService.kt
awsdocs
66,023,605
false
null
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package com.kotlin.ecs // snippet-start:[ecs.kotlin.create_service.import] import aws.sdk.kotlin.services.ecs.EcsClient import aws.sdk.kotlin.services.ecs.model.AwsVpcConfiguration import aws.sdk.kotlin.services.ecs.model.CreateServiceRequest import aws.sdk.kotlin.services.ecs.model.LaunchType import aws.sdk.kotlin.services.ecs.model.NetworkConfiguration import kotlin.system.exitProcess // snippet-end:[ecs.kotlin.create_service.import] /** Before running this Kotlin code example, set up your development environment, including your credentials. For more information, see the following documentation topic: https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/setup.html */ suspend fun main(args: Array<String>) { val usage = """ Usage: <clusterName> <serviceName> <securityGroups> <subnets> <taskDefinition> Where: clusterName - The name of the ECS cluster. serviceName - The name of the ECS service to create. securityGroups - The name of the security group. subnets - The name of the subnet. taskDefinition - The name of the task definition. """ if (args.size != 5) { println(usage) exitProcess(0) } val clusterName = args[0] val serviceName = args[1] val securityGroups = args[2] val subnets = args[3] val taskDefinition = args[4] val serviceArn = createNewService(clusterName, serviceName, securityGroups, subnets, taskDefinition) println("The ARN of the service is $serviceArn") } // snippet-start:[ecs.kotlin.create_service.main] suspend fun createNewService( clusterNameVal: String, serviceNameVal: String, securityGroupsVal: String, subnetsVal: String, taskDefinitionVal: String, ): String? { val vpcConfiguration = AwsVpcConfiguration { securityGroups = listOf(securityGroupsVal) subnets = listOf(subnetsVal) } val configuration = NetworkConfiguration { awsvpcConfiguration = vpcConfiguration } val request = CreateServiceRequest { cluster = clusterNameVal networkConfiguration = configuration desiredCount = 1 launchType = LaunchType.Fargate serviceName = serviceNameVal taskDefinition = taskDefinitionVal } EcsClient { region = "us-east-1" }.use { ecsClient -> val response = ecsClient.createService(request) return response.service?.serviceArn } } // snippet-end:[ecs.kotlin.create_service.main]
248
null
5614
9,502
3d8f94799b9c661cd7092e03d6673efc10720e52
2,676
aws-doc-sdk-examples
Apache License 2.0
app/src/main/java/com/allentom/diffusion/ui/screens/setting/Screen.kt
AllenTom
744,304,887
false
{"Kotlin": 1228732}
package com.allentom.diffusion.ui.screens.setting import android.content.Context import android.widget.Toast import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults 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.res.stringResource import androidx.compose.ui.unit.dp import com.allentom.diffusion.ConstValues import com.allentom.diffusion.MainActivity import com.allentom.diffusion.R import com.allentom.diffusion.api.translate.TranslateHelper import com.allentom.diffusion.composables.BaiduTranslateOptionsDialog import com.allentom.diffusion.composables.TextPickUpItem import com.allentom.diffusion.store.AppConfigStore @OptIn(ExperimentalMaterial3Api::class) @Composable fun SettingScreen() { val context = LocalContext.current var translateEngine by remember { mutableStateOf(AppConfigStore.config.translateEngine) } var preferredLanguage by remember { mutableStateOf(AppConfigStore.config.preferredLanguage) } fun onLogOut(context: Context) { AppConfigStore.config = AppConfigStore.config.copy(sdwUrl = "") AppConfigStore.saveData(context) Toast.makeText(context, context.getString(R.string.logout_success), Toast.LENGTH_SHORT) .show() (context as MainActivity).finish() } var isBaiduOptionsDialogShow by remember { mutableStateOf(false) } if (isBaiduOptionsDialogShow) { BaiduTranslateOptionsDialog( initialAppKey = AppConfigStore.config.baiduTranslateAppId, initialSecretKey = AppConfigStore.config.baiduTranslateSecretKey, onDismiss = { isBaiduOptionsDialogShow = false }, onConfirm = { appKey, secretKey -> AppConfigStore.updateAndSave(context) { it.copy(baiduTranslateAppId = appKey, baiduTranslateSecretKey = secretKey) } isBaiduOptionsDialogShow = false TranslateHelper.initTranslator() } ) } Scaffold( topBar = { TopAppBar( title = { Text(text = stringResource(R.string.settings_screen_title)) }, colors = TopAppBarDefaults.topAppBarColors( containerColor = MaterialTheme.colorScheme.primaryContainer, titleContentColor = MaterialTheme.colorScheme.primary, ), ) }, ) { paddingValues: PaddingValues -> Box( modifier = Modifier.padding(paddingValues = paddingValues) ) { Column( modifier = Modifier.padding(16.dp) ) { TextPickUpItem( label = stringResource(R.string.translate_engine), value = translateEngine, options = listOf("Google", "Baidu"), onValueChange = { AppConfigStore.updateAndSave(context) { config -> config.copy(translateEngine = it) } translateEngine = it TranslateHelper.initTranslator() } ) if (translateEngine == "Baidu") { ListItem( modifier = Modifier.clickable { isBaiduOptionsDialogShow = true }, headlineContent = { Text( text = stringResource(R.string.baidu_translate_option), ) } ) } TextPickUpItem( label = stringResource(R.string.preferred_language), value = preferredLanguage, onGetDisplayValue = { _, value -> ConstValues.TranslateLangs[value] ?: value.name }, options = TranslateHelper.getToLanguage() ) { selectVal -> preferredLanguage = selectVal AppConfigStore.updateAndSave(context) { it.copy(preferredLanguage = selectVal) } } Spacer(modifier = Modifier.padding(top = 16.dp)) Button( modifier = Modifier.fillMaxWidth(), onClick = { onLogOut(context) }) { Text(text = stringResource(R.string.logout)) } } } } }
1
Kotlin
19
187
9dcf3f1b466f9fc8f98851cee41aa8bae88f1139
5,543
diffusion-client
MIT License
cutilslibrary/src/main/java/com/utils/library/http/download/DownloadHandler.kt
EasonHolmes
390,691,373
false
{"Java": 270865, "Kotlin": 185892}
package com.utils.library.http.download import android.os.Bundle import android.os.Handler import android.os.Looper import android.os.Message /** * 用于线程传递ui的 */ internal class DownloadHandler { /** * handle ,处理ui方面的onProgress */ private var mHandler: Handler? = null private var mDownloadListener: DownloadListener? = null /** * 初始化handler */ fun initHandler(downloadListener: DownloadListener) { if (mHandler != null) { return } mDownloadListener = downloadListener // 同步锁此类 synchronized(DownloadHandler::class.java) { if (mHandler == null) { mHandler = object : Handler(Looper.getMainLooper()) { override fun handleMessage(msg: Message) { super.handleMessage(msg) if (msg == null) { return } if (msg.what == WHAT_UPDATE) { val updateData = msg.data ?: return val progress = updateData.getInt(PROGRESS) downloadListener.onProgress(progress) } } } } } } /** * 传递进度给ui * * @param progress 进度,100为满 */ fun onProgress(progress: Int) { if (Looper.myLooper() == Looper.getMainLooper()) { mDownloadListener!!.onProgress(progress) return } val message = mHandler!!.obtainMessage() message.what = WHAT_UPDATE val data = Bundle() data.putInt(PROGRESS, progress) message.data = data mHandler!!.sendMessage(message) } companion object { /** * 更新进度 */ private const val WHAT_UPDATE = 0x01 private const val PROGRESS = "progress" } }
1
null
1
1
e551ff7e3f3bb7345483e09cbef8dcc547ef19e6
1,929
CBaseLibrary
Apache License 2.0
library/src/main/java/com/chamber/kotlin/library/listener/OnDataChamberChangeListener.kt
afiqiqmal
120,424,075
false
null
package com.zeroone.conceal.listener /** * @author : hafiq on 20/04/2017. */ interface OnDataChamberChangeListener { fun onDataChange(key: String, value: String) }
0
Kotlin
0
8
b0f0e91fdd3003cb85b7174ae65e214e628fb736
171
SharedChamber-Kotlin
MIT License
game/ui-strings/src/main/kotlin/de/gleex/pltcmd/game/ui/strings/transformations/Blueprint.kt
Baret
227,677,538
false
null
package de.gleex.pltcmd.game.ui.strings.transformations import de.gleex.pltcmd.game.ui.strings.Transformation import de.gleex.pltcmd.model.elements.Elements import de.gleex.pltcmd.model.elements.blueprint.AbstractElementBlueprint import java.util.* internal val blueprintTransformation: Transformation<AbstractElementBlueprint<*>> = { format -> // TODO: Implement actual transformation defaultTransformation( Elements.nameOf(this) ?.replace("(.)([A-Z])".toRegex(), "$1 $2") ?.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() } ?: "$corps $kind $rung", format) }
46
Kotlin
0
4
e82f7df817cfeec7b9441ecec756865f3f87104e
668
pltcmd
MIT License
app/src/main/java/com/cid/bot/data/message.kt
SWPP
151,753,633
false
null
package com.cid.bot.data import androidx.room.* import com.cid.bot.* import io.reactivex.Completable import io.reactivex.Observable import javax.inject.Inject @Entity data class Message( @PrimaryKey val id: Int?, val sender: String?, val receiver: String?, val text: String, val created: String? = null, @Embedded val music: Music? = null, val chips: List<Int> = listOf() ) class MessageRepository @Inject constructor(private val networkManager: NetworkManager) { @Inject lateinit var remoteSource: MessageRemoteSource @Inject lateinit var localSource: MessageLocalSource fun getMessages(): Observable<HResult<List<Message>>> { if (networkManager.isConnectedToInternet) { return remoteSource.getMessages().andSave(localSource::saveMessages) } return localSource.getMessages() } fun getMessage(id: Int): Observable<HResult<Message>> { if (networkManager.isConnectedToInternet) { return remoteSource.getMessage(id).andSave(localSource::saveMessage) } return localSource.getMessage(id) } fun postMessage(text: String): Observable<HResult<Message>> { if (!networkManager.isConnectedToInternet) return Observable.just(networkManager.getNetworkError()) return remoteSource.postMessage(text).andSave(localSource::saveMessage) } } class MessageRemoteSource @Inject constructor(private val net: NetworkManager) { fun getMessages(): Observable<HResult<List<Message>>> { return net.api.loadAllMessages().toHResult() } fun getMessage(id: Int): Observable<HResult<Message>> { return net.api.loadMessage(id).toHResult() } fun postMessage(text: String): Observable<HResult<Message>> { return net.api.sendMessage(text).toHResult() } } class MessageLocalSource @Inject constructor(db: AppDatabase) { private val dao = db.messageDao() fun getMessages(): Observable<HResult<List<Message>>> { return singleObservable { HResult(dao.getAll()) } } fun getMessage(id: Int): Observable<HResult<Message>> { return singleObservable { HResult(dao.getById(id)) } } fun saveMessage(message: Message): Completable { return singleCompletable { dao.insert(message) } } fun saveMessages(messages: List<Message>): Completable { return singleCompletable { dao.deleteAll() dao.insertAll(messages) } } } @Dao interface MessageDao { @Query("SELECT * FROM Message") fun getAll(): List<Message> @Query("SELECT * FROM Message WHERE id = :id") fun getById(id: Int): Message @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(message: Message) @Insert(onConflict = OnConflictStrategy.REPLACE) fun insertAll(messages: List<Message>) @Query("DELETE FROM Message") fun deleteAll() }
0
Kotlin
1
0
5d92364ca0b054ad4dba1a8a21b03548ea213a98
2,929
cid-frontend
MIT License
cesium-kotlin/src/jsMain/kotlin/cesium/engine/ShowGeometryInstanceAttribute.kt
karakum-team
393,199,102
false
null
// Automatically generated - do not modify! @file:JsModule("@cesium/engine") package cesium.engine import js.typedarrays.Uint8Array /** * Value and type information for per-instance geometry attribute that determines if the geometry instance will be shown. * ``` * const instance = new GeometryInstance({ * geometry : new BoxGeometry({ * vertexFormat : VertexFormat.POSITION_AND_NORMAL, * minimum : new Cartesian3(-250000.0, -250000.0, -250000.0), * maximum : new Cartesian3(250000.0, 250000.0, 250000.0) * }), * modelMatrix : Matrix4.multiplyByTranslation(Transforms.eastNorthUpToFixedFrame( * Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cartesian3(0.0, 0.0, 1000000.0), new Matrix4()), * id : 'box', * attributes : { * show : new ShowGeometryInstanceAttribute(false) * } * }); * ``` * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html">Online Documentation</a> * * @constructor * @param [show] Determines if the geometry instance will be shown. * Default value - `true` * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html">Online Documentation</a> */ external class ShowGeometryInstanceAttribute( show: Boolean? = definedExternally, ) { /** * The values for the attributes stored in a typed array. * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html#value">Online Documentation</a> */ var value: Uint8Array /** * The datatype of each component in the attribute, e.g., individual elements in * [ColorGeometryInstanceAttribute.value]. * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html#componentDatatype">Online Documentation</a> */ val componentDatatype: ComponentDatatype /** * The number of components in the attributes, i.e., [ColorGeometryInstanceAttribute.value]. * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html#componentsPerAttribute">Online Documentation</a> */ val componentsPerAttribute: Int /** * When `true` and `componentDatatype` is an integer format, * indicate that the components should be mapped to the range [0, 1] (unsigned) * or [-1, 1] (signed) when they are accessed as floating-point for rendering. * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html#normalize">Online Documentation</a> */ val normalize: Boolean companion object { /** * Converts a boolean show to a typed array that can be used to assign a show attribute. * ``` * const attributes = primitive.getGeometryInstanceAttributes('an id'); * attributes.show = ShowGeometryInstanceAttribute.toValue(true, attributes.show); * ``` * @param [show] The show value. * @param [result] The array to store the result in, if undefined a new instance will be created. * @return The modified result parameter or a new instance if result was undefined. * @see <a href="https://cesium.com/docs/cesiumjs-ref-doc/ShowGeometryInstanceAttribute.html#.toValue">Online Documentation</a> */ fun toValue( show: Boolean, result: Uint8Array? = definedExternally, ): Uint8Array } }
0
null
8
36
95b065622a9445caf058ad2581f4c91f9e2b0d91
3,415
types-kotlin
Apache License 2.0
src/main/kotlin/adventofcode/year2022/Day08TreetopTreeHouse.kt
pfolta
573,956,675
false
{"Kotlin": 199554, "Dockerfile": 214}
package adventofcode.year2022 import adventofcode.Puzzle import adventofcode.PuzzleInput import adventofcode.common.product import adventofcode.year2022.Day08TreetopTreeHouse.Companion.Direction.DOWN import adventofcode.year2022.Day08TreetopTreeHouse.Companion.Direction.LEFT import adventofcode.year2022.Day08TreetopTreeHouse.Companion.Direction.RIGHT import adventofcode.year2022.Day08TreetopTreeHouse.Companion.Direction.UP class Day08TreetopTreeHouse(customInput: PuzzleInput? = null) : Puzzle(customInput) { private val treeMap by lazy { input.lines().map { line -> line.map(Char::digitToInt) } } override fun partOne() = treeMap .flatMapIndexed { y, row -> row.mapIndexed { x, tree -> Direction .values() .map { direction -> treeMap.neighbors(x, y, direction).filter { neighbor -> neighbor >= tree } } .any(List<Int>::isEmpty) } } .count { tree -> tree } override fun partTwo() = treeMap .flatMapIndexed { y, row -> row.mapIndexed { x, tree -> Direction .values() .map { direction -> val neighbors = treeMap.neighbors(x, y, direction) when (val tallestNeighbor = neighbors.indexOfFirst { neighbor -> neighbor >= tree }) { -1 -> neighbors.size else -> tallestNeighbor + 1 } } } } .maxOf(List<Int>::product) companion object { private enum class Direction { DOWN, LEFT, RIGHT, UP } private fun List<List<Int>>.neighbors(x: Int, y: Int, direction: Direction) = when (direction) { DOWN -> map { row -> row[x] }.drop(y + 1) LEFT -> this[y].take(x).reversed() RIGHT -> this[y].drop(x + 1) UP -> map { row -> row[x] }.take(y).reversed() } } }
0
Kotlin
0
0
c20489304c3ced82a67fc290f5046e631b4bf9c9
2,017
AdventOfCode
MIT License
src/main/kotlin/dev/sterner/api/rift/SimpleSpiritCharge.kt
mrsterner
832,295,137
false
{"Kotlin": 370399, "Java": 8111, "GLSL": 4530}
package dev.sterner.api.rift import com.sammy.malum.core.systems.spirit.MalumSpiritType import com.sammy.malum.registry.common.SpiritTypeRegistry import net.minecraft.nbt.CompoundTag data class SimpleSpiritCharge( private val charges: MutableMap<MalumSpiritType, Int> = mutableMapOf( SpiritTypeRegistry.AQUEOUS_SPIRIT to 0, SpiritTypeRegistry.AERIAL_SPIRIT to 0, SpiritTypeRegistry.ARCANE_SPIRIT to 0, SpiritTypeRegistry.EARTHEN_SPIRIT to 0, SpiritTypeRegistry.ELDRITCH_SPIRIT to 0, SpiritTypeRegistry.INFERNAL_SPIRIT to 0, SpiritTypeRegistry.SACRED_SPIRIT to 0, SpiritTypeRegistry.WICKED_SPIRIT to 0, SpiritTypeRegistry.UMBRAL_SPIRIT to 0 ) ) { fun setInfiniteCount() { charges.keys.forEach { charges[it] = 50 } } fun shouldBeInfinite(): Boolean { return charges.values.all { it >= 50 } } fun addToCharge(type: MalumSpiritType, count: Int) { charges[type] = (charges[type] ?: 0) + count } fun removeFromCharge(type: MalumSpiritType, count: Int): Boolean { val currentCount = charges[type] ?: return false return if (currentCount >= count) { charges[type] = currentCount - count true } else { false } } fun deserializeNBT(nbt: CompoundTag): SimpleSpiritCharge { charges.keys.forEach { charges[it] = nbt.getInt(it.identifier) } return this } fun serializeNBT(nbt: CompoundTag) { charges.forEach { (type, count) -> nbt.putInt(type.identifier, count) } } fun getTotalCharge(): Int { return charges.values.sum() } fun rechargeInfiniteCount() { charges.forEach { (type, count) -> if (count < 50) { charges[type] = count + 1 return } } } }
0
Kotlin
0
0
efbe1bc78d343ddb881f571382955b72706e54c5
1,883
voidbound
Creative Commons Zero v1.0 Universal
app-inspection/inspectors/network/model/src/com/android/tools/idea/appinspection/inspectors/network/model/rules/RuleDataListener.kt
JetBrains
60,701,247
false
null
/* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.idea.appinspection.inspectors.network.model.rules /** * RuleDataListener defines the interface for an object that listens * to changes in a [RuleData]. */ interface RuleDataListener { fun onRuleNameChanged(ruleData: RuleData) fun onRuleIsActiveChanged(ruleData: RuleData) fun onRuleDataChanged(ruleData: RuleData) } open class RuleDataAdapter : RuleDataListener { override fun onRuleNameChanged(ruleData: RuleData) = Unit override fun onRuleIsActiveChanged(ruleData: RuleData) = Unit override fun onRuleDataChanged(ruleData: RuleData) = Unit }
5
null
227
948
10110983c7e784122d94c7467e9d243aba943bf4
1,207
android
Apache License 2.0
console-framework-client-api/src/main/java/io/axoniq/console/framework/api/notifications/NotificationLevel.kt
AxonIQ
682,516,729
false
{"Kotlin": 158963, "Java": 28249}
/* * Copyright (c) 2022-2024. AxonIQ B.V. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.axoniq.console.framework.api.notifications import com.fasterxml.jackson.annotation.JsonProperty enum class NotificationLevel { @JsonProperty("d") Debug, @JsonProperty("i") Info, @JsonProperty("w") Warn }
0
Kotlin
0
0
e19a997dfb14348c44be5568611ef32943d32ee0
847
console-framework-client
Apache License 2.0
app/src/main/java/com/vitorpamplona/amethyst/model/User.kt
vitorpamplona
587,850,619
false
null
package com.vitorpamplona.amethyst.model import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable import androidx.lifecycle.LiveData import com.vitorpamplona.amethyst.service.Bech32 import com.vitorpamplona.amethyst.service.NostrSingleUserDataSource import com.vitorpamplona.amethyst.service.checkNotInMainThread import com.vitorpamplona.amethyst.service.model.BookmarkListEvent import com.vitorpamplona.amethyst.service.model.ContactListEvent import com.vitorpamplona.amethyst.service.model.LnZapEvent import com.vitorpamplona.amethyst.service.model.MetadataEvent import com.vitorpamplona.amethyst.service.model.ReportEvent import com.vitorpamplona.amethyst.service.relays.EOSETime import com.vitorpamplona.amethyst.service.relays.Relay import com.vitorpamplona.amethyst.service.toNpub import com.vitorpamplona.amethyst.ui.actions.ImmutableListOfLists import com.vitorpamplona.amethyst.ui.actions.toImmutableListOfLists import com.vitorpamplona.amethyst.ui.components.BundledUpdate import com.vitorpamplona.amethyst.ui.note.toShortenHex import fr.acinq.secp256k1.Hex import kotlinx.coroutines.Dispatchers import java.math.BigDecimal import java.util.regex.Pattern val lnurlpPattern = Pattern.compile("(?i:http|https):\\/\\/((.+)\\/)*\\.well-known\\/lnurlp\\/(.*)") @Stable class User(val pubkeyHex: String) { var info: UserMetadata? = null var latestContactList: ContactListEvent? = null var latestBookmarkList: BookmarkListEvent? = null var reports = mapOf<User, Set<Note>>() private set var latestEOSEs: Map<String, EOSETime> = emptyMap() var zaps = mapOf<Note, Note?>() private set var relaysBeingUsed = mapOf<String, RelayInfo>() private set var privateChatrooms = mapOf<User, Chatroom>() private set fun pubkey() = Hex.decode(pubkeyHex) fun pubkeyNpub() = pubkey().toNpub() fun pubkeyDisplayHex() = pubkeyNpub().toShortenHex() fun toNostrUri() = "nostr:${pubkeyNpub()}" override fun toString(): String = pubkeyHex fun toBestDisplayName(): String { return bestDisplayName() ?: bestUsername() ?: pubkeyDisplayHex() } fun bestUsername(): String? { return info?.name?.ifBlank { null } ?: info?.username?.ifBlank { null } } fun bestDisplayName(): String? { return info?.displayName?.ifBlank { null } ?: info?.display_name?.ifBlank { null } } fun nip05(): String? { return info?.nip05?.ifBlank { null } } fun profilePicture(): String? { if (info?.picture.isNullOrBlank()) info?.picture = null return info?.picture } fun updateBookmark(event: BookmarkListEvent) { if (event.id == latestBookmarkList?.id) return latestBookmarkList = event liveSet?.bookmarks?.invalidateData() } fun updateContactList(event: ContactListEvent) { if (event.id == latestContactList?.id) return val oldContactListEvent = latestContactList latestContactList = event // Update following of the current user liveSet?.follows?.invalidateData() // Update Followers of the past user list // Update Followers of the new contact list (oldContactListEvent)?.unverifiedFollowKeySet()?.forEach { LocalCache.users[it]?.liveSet?.followers?.invalidateData() } (latestContactList)?.unverifiedFollowKeySet()?.forEach { LocalCache.users[it]?.liveSet?.followers?.invalidateData() } liveSet?.relays?.invalidateData() } fun addReport(note: Note) { val author = note.author ?: return if (author !in reports.keys) { reports = reports + Pair(author, setOf(note)) liveSet?.reports?.invalidateData() } else if (reports[author]?.contains(note) == false) { reports = reports + Pair(author, (reports[author] ?: emptySet()) + note) liveSet?.reports?.invalidateData() } } fun removeReport(deleteNote: Note) { val author = deleteNote.author ?: return if (author in reports.keys && reports[author]?.contains(deleteNote) == true) { reports[author]?.let { reports = reports + Pair(author, it.minus(deleteNote)) liveSet?.reports?.invalidateData() } } } fun addZap(zapRequest: Note, zap: Note?) { if (zapRequest !in zaps.keys) { zaps = zaps + Pair(zapRequest, zap) liveSet?.zaps?.invalidateData() } else if (zapRequest in zaps.keys && zaps[zapRequest] == null) { zaps = zaps + Pair(zapRequest, zap) liveSet?.zaps?.invalidateData() } } fun removeZap(zapRequestOrZapEvent: Note) { if (zapRequestOrZapEvent in zaps.keys) { zaps = zaps.minus(zapRequestOrZapEvent) liveSet?.zaps?.invalidateData() } else if (zapRequestOrZapEvent in zaps.values) { zaps = zaps.filter { it.value != zapRequestOrZapEvent } liveSet?.zaps?.invalidateData() } } fun zappedAmount(): BigDecimal { return zaps.mapNotNull { it.value?.event } .filterIsInstance<LnZapEvent>() .mapNotNull { it.amount }.sumOf { it } } fun reportsBy(user: User): Set<Note> { return reports[user] ?: emptySet() } fun reportAuthorsBy(users: Set<HexKey>): List<User> { return reports.keys.filter { it.pubkeyHex in users } } fun countReportAuthorsBy(users: Set<HexKey>): Int { return reports.keys.count { it.pubkeyHex in users } } fun reportsBy(users: Set<HexKey>): List<Note> { return reportAuthorsBy(users).mapNotNull { reports[it] }.flatten() } @Synchronized private fun getOrCreatePrivateChatroomSync(user: User): Chatroom { checkNotInMainThread() return privateChatrooms[user] ?: run { val privateChatroom = Chatroom() privateChatrooms = privateChatrooms + Pair(user, privateChatroom) privateChatroom } } private fun getOrCreatePrivateChatroom(user: User): Chatroom { return privateChatrooms[user] ?: getOrCreatePrivateChatroomSync(user) } fun addMessage(user: User, msg: Note) { val privateChatroom = getOrCreatePrivateChatroom(user) if (msg !in privateChatroom.roomMessages) { privateChatroom.addMessageSync(msg) liveSet?.messages?.invalidateData() } } fun removeMessage(user: User, msg: Note) { checkNotInMainThread() val privateChatroom = getOrCreatePrivateChatroom(user) if (msg in privateChatroom.roomMessages) { privateChatroom.removeMessageSync(msg) liveSet?.messages?.invalidateData() } } fun addRelayBeingUsed(relay: Relay, eventTime: Long) { val here = relaysBeingUsed[relay.url] if (here == null) { relaysBeingUsed = relaysBeingUsed + Pair(relay.url, RelayInfo(relay.url, eventTime, 1)) } else { if (eventTime > here.lastEvent) { here.lastEvent = eventTime } here.counter++ } liveSet?.relayInfo?.invalidateData() } fun updateUserInfo(newUserInfo: UserMetadata, latestMetadata: MetadataEvent) { info = newUserInfo info?.latestMetadata = latestMetadata info?.updatedMetadataAt = latestMetadata.createdAt info?.tags = latestMetadata.tags.toImmutableListOfLists() if (newUserInfo.lud16.isNullOrBlank() && newUserInfo.lud06?.lowercase()?.startsWith("lnurl") == true) { try { val url = String(Bech32.decodeBytes(newUserInfo.lud06!!, false).second) val matcher = lnurlpPattern.matcher(url) while (matcher.find()) { val domain = matcher.group(2) val username = matcher.group(3) info?.lud16 = "$username@$domain" } } catch (t: Throwable) { // Doesn't create errors. } } liveSet?.metadata?.invalidateData() } fun isFollowing(user: User): Boolean { return latestContactList?.isTaggedUser(user.pubkeyHex) ?: false } fun isFollowingHashtag(tag: String): Boolean { return latestContactList?.isTaggedHash(tag) ?: false } fun isFollowingHashtagCached(tag: String): Boolean { return latestContactList?.verifiedFollowTagSet?.let { return tag.lowercase() in it } ?: false } fun isFollowingGeohashCached(geoTag: String): Boolean { return latestContactList?.verifiedFollowGeohashSet?.let { return geoTag.lowercase() in it } ?: false } fun isFollowingCached(user: User): Boolean { return latestContactList?.verifiedFollowKeySet?.let { return user.pubkeyHex in it } ?: false } fun isFollowingCached(userHex: String): Boolean { return latestContactList?.verifiedFollowKeySet?.let { return userHex in it } ?: false } fun transientFollowCount(): Int? { return latestContactList?.unverifiedFollowKeySet()?.size } suspend fun transientFollowerCount(): Int { return LocalCache.users.values.count { it.latestContactList?.isTaggedUser(pubkeyHex) ?: false } } fun cachedFollowingKeySet(): Set<HexKey> { return latestContactList?.verifiedFollowKeySet ?: emptySet() } fun cachedFollowingTagSet(): Set<HexKey> { return latestContactList?.verifiedFollowTagSet ?: emptySet() } fun cachedFollowingGeohashSet(): Set<HexKey> { return latestContactList?.verifiedFollowGeohashSet ?: emptySet() } fun cachedFollowingCommunitiesSet(): Set<HexKey> { return latestContactList?.verifiedFollowCommunitySet ?: emptySet() } fun cachedFollowCount(): Int? { return latestContactList?.verifiedFollowKeySet?.size } suspend fun cachedFollowerCount(): Int { return LocalCache.users.values.count { it.latestContactList?.isTaggedUser(pubkeyHex) ?: false } } fun hasSentMessagesTo(user: User?): Boolean { val messagesToUser = privateChatrooms[user] ?: return false return messagesToUser.roomMessages.any { this.pubkeyHex == it.author?.pubkeyHex } } fun hasReport(loggedIn: User, type: ReportEvent.ReportType): Boolean { return reports[loggedIn]?.firstOrNull() { it.event is ReportEvent && (it.event as ReportEvent).reportedAuthor().any { it.reportType == type } } != null } fun anyNameStartsWith(username: String): Boolean { return info?.anyNameStartsWith(username) ?: false } var liveSet: UserLiveSet? = null fun live(): UserLiveSet { if (liveSet == null) { liveSet = UserLiveSet(this) } return liveSet!! } fun clearLive() { if (liveSet != null && liveSet?.isInUse() == false) { liveSet = null } } } class UserLiveSet(u: User) { // UI Observers line up here. val follows: UserLiveData = UserLiveData(u) val followers: UserLiveData = UserLiveData(u) val reports: UserLiveData = UserLiveData(u) val messages: UserLiveData = UserLiveData(u) val relays: UserLiveData = UserLiveData(u) val relayInfo: UserLiveData = UserLiveData(u) val metadata: UserLiveData = UserLiveData(u) val zaps: UserLiveData = UserLiveData(u) val bookmarks: UserLiveData = UserLiveData(u) fun isInUse(): Boolean { return follows.hasObservers() || followers.hasObservers() || reports.hasObservers() || messages.hasObservers() || relays.hasObservers() || relayInfo.hasObservers() || metadata.hasObservers() || zaps.hasObservers() || bookmarks.hasObservers() } } @Immutable data class RelayInfo( val url: String, var lastEvent: Long, var counter: Long ) class Chatroom() { var roomMessages: Set<Note> = setOf() @Synchronized fun addMessageSync(msg: Note) { checkNotInMainThread() if (msg !in roomMessages) { roomMessages = roomMessages + msg } } @Synchronized fun removeMessageSync(msg: Note) { checkNotInMainThread() if (msg !in roomMessages) { roomMessages = roomMessages + msg } } fun pruneMessagesToTheLatestOnly(): Set<Note> { val sorted = roomMessages.sortedWith(compareBy({ it.createdAt() }, { it.idHex })).reversed() val toKeep = if ((sorted.firstOrNull()?.createdAt() ?: 0) > TimeUtils.oneWeekAgo()) { // Recent messages, keep last 100 sorted.take(100).toSet() } else { // Old messages, keep the last one. sorted.take(1).toSet() } + sorted.filter { it.liveSet?.isInUse() ?: false } val toRemove = roomMessages.minus(toKeep) roomMessages = toKeep return toRemove } } @Stable class UserMetadata { var name: String? = null var username: String? = null var display_name: String? = null var displayName: String? = null var picture: String? = null var banner: String? = null var website: String? = null var about: String? = null var nip05: String? = null var nip05Verified: Boolean = false var nip05LastVerificationTime: Long? = 0 var domain: String? = null var lud06: String? = null var lud16: String? = null var publish: String? = null var iris: String? = null var main_relay: String? = null var twitter: String? = null var updatedMetadataAt: Long = 0 var latestMetadata: MetadataEvent? = null var tags: ImmutableListOfLists<String>? = null fun anyName(): String? { return display_name ?: displayName ?: name ?: username } fun anyNameStartsWith(prefix: String): Boolean { return listOfNotNull(name, username, display_name, displayName, nip05, lud06, lud16) .any { it.contains(prefix, true) } } fun lnAddress(): String? { return (lud16?.trim() ?: lud06?.trim())?.ifBlank { null } } fun bestUsername(): String? { return name?.ifBlank { null } ?: username?.ifBlank { null } } fun bestDisplayName(): String? { return displayName?.ifBlank { null } ?: display_name?.ifBlank { null } } fun nip05(): String? { return nip05?.ifBlank { null } } fun profilePicture(): String? { if (picture.isNullOrBlank()) picture = null return picture } } class UserLiveData(val user: User) : LiveData<UserState>(UserState(user)) { // Refreshes observers in batches. private val bundler = BundledUpdate(500, Dispatchers.IO) fun invalidateData() { checkNotInMainThread() bundler.invalidate() { checkNotInMainThread() if (hasActiveObservers()) { postValue(UserState(user)) } } } override fun onActive() { super.onActive() NostrSingleUserDataSource.add(user) } override fun onInactive() { super.onInactive() NostrSingleUserDataSource.remove(user) } } @Immutable class UserState(val user: User)
133
null
88
870
a23c8c5c044d2eff461f9af9f64a4d8510dbe3e7
15,479
amethyst
MIT License
src/jvmTest/kotlin/mahjongutils/yaku/TestYaku.kt
ssttkkl
547,654,890
false
null
package mahjongutils.yaku import mahjongutils.models.* import mahjongutils.models.hand.ChitoiHoraHandPattern import mahjongutils.models.hand.RegularHandPattern import mahjongutils.models.hand.RegularHoraHandPattern import mahjongutils.yaku.Yakus.Chanta import mahjongutils.yaku.Yakus.Chinitsu import mahjongutils.yaku.Yakus.Chitoi import mahjongutils.yaku.Yakus.Chun import mahjongutils.yaku.Yakus.Haku import mahjongutils.yaku.Yakus.Hatsu import mahjongutils.yaku.Yakus.Honitsu import mahjongutils.yaku.Yakus.Honroto import mahjongutils.yaku.Yakus.Ipe import mahjongutils.yaku.Yakus.Ittsu import mahjongutils.yaku.Yakus.Junchan import mahjongutils.yaku.Yakus.Pinhu import mahjongutils.yaku.Yakus.RoundWind import mahjongutils.yaku.Yakus.Ryanpe import mahjongutils.yaku.Yakus.Sananko import mahjongutils.yaku.Yakus.Sandoko import mahjongutils.yaku.Yakus.Sankantsu import mahjongutils.yaku.Yakus.Sanshoku import mahjongutils.yaku.Yakus.SelfWind import mahjongutils.yaku.Yakus.Tanyao import mahjongutils.yaku.Yakus.Toitoi import mahjongutils.yaku.Yakus.Tsumo import kotlin.test.Test internal class TestYaku { @Test fun testChitoi_Honroto_Tsumo() { val pattern = ChitoiHoraHandPattern( pairs = Tile.parseTiles("19m19s123z").toSet(), agari = Tile.get("3z"), tsumo = true ) tester(pattern, setOf(Chitoi, Honroto, Tsumo)) } @Test fun testChitoi_Chinitsu_Tsumo_Tanyao() { val pattern = ChitoiHoraHandPattern( pairs = Tile.parseTiles("2345678s").toSet(), agari = Tile.get("2s"), tsumo = true ) tester(pattern, setOf(Chitoi, Chinitsu, Tsumo, Tanyao)) } @Test fun testToitoi_Honroto_Honitsu() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("4z"), menzenMentsu = listOf(Mentsu("111s"), Mentsu("999s")), furo = listOf(Furo("111z"), Furo("222z")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("4z"), agariTatsu = null, tsumo = false ) tester(pattern, setOf(Toitoi, Honitsu, Honroto)) } @Test fun testIttsu_Chinitsu() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("3s"), menzenMentsu = listOf(Mentsu("789s"), Mentsu("999s")), furo = listOf(Furo("123s"), Furo("456s")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("3s"), agariTatsu = null, tsumo = false ) tester(pattern, setOf(Ittsu, Chinitsu)) } @Test fun testTanyao_Ryanpe() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("2s"), menzenMentsu = listOf(Mentsu("345s"), Mentsu("345s"), Mentsu("345p"), Mentsu("345p")), furo = emptyList(), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("4s"), agariTatsu = Tatsu("35s"), tsumo = false ) tester(pattern, setOf(Tanyao, Ryanpe)) } @Test fun testTanyao_Ipe_Pinhu() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("2s"), menzenMentsu = listOf(Mentsu("345s"), Mentsu("345s"), Mentsu("567p"), Mentsu("678m")), furo = emptyList(), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("5s"), agariTatsu = Tatsu("34s"), tsumo = false ) tester(pattern, setOf(Tanyao, Ipe, Pinhu)) } @Test fun testTanyao_Sanshoku() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("2s"), menzenMentsu = listOf(Mentsu("345m"), Mentsu("345p"), Mentsu("678m")), furo = listOf(Furo("345s")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("5m"), agariTatsu = Tatsu("34m"), tsumo = false ) tester(pattern, setOf(Tanyao, Sanshoku)) } @Test fun testSelfWind_RoundWind_Haku() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("2s"), menzenMentsu = listOf(Mentsu("345p"), Mentsu("678m")), furo = listOf(Furo("111z"), Furo("555z")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("5p"), agariTatsu = Tatsu("34p"), tsumo = false, selfWind = Wind.East, roundWind = Wind.East ) tester(pattern, setOf(SelfWind, RoundWind, Haku)) } @Test fun testHatsu_Chun_Shosangen() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("5z"), menzenMentsu = listOf(Mentsu("345p"), Mentsu("678m")), furo = listOf(Furo("666z"), Furo("777z")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("5p"), agariTatsu = Tatsu("34p"), tsumo = false, selfWind = Wind.East, roundWind = Wind.East ) tester(pattern, setOf(Hatsu, Chun, Yakus.Shosangen)) } @Test fun testToitoi_Sananko() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("2s"), menzenMentsu = listOf(Mentsu("555s"), Mentsu("111m"), Mentsu("222m")), furo = listOf(Furo("333s")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("2m"), agariTatsu = Tatsu("22m"), tsumo = true, ) tester(pattern, setOf(Toitoi, Sananko)) } @Test fun testToitoi_Sananko_2() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("2s"), menzenMentsu = listOf(Mentsu("333s"), Mentsu("555s"), Mentsu("111m"), Mentsu("222m")), furo = emptyList(), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("2m"), agariTatsu = Tatsu("22m"), tsumo = false, ) tester(pattern, setOf(Toitoi, Sananko)) } @Test fun testChanta() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("9p"), menzenMentsu = listOf(Mentsu("789s"), Mentsu("111m"), Mentsu("123m")), furo = listOf(Furo("111z")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("1m"), agariTatsu = Tatsu("23m"), tsumo = false, ) tester(pattern, setOf(Chanta)) } @Test fun testJunchan() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("9p"), menzenMentsu = listOf(Mentsu("789s"), Mentsu("111m"), Mentsu("123m")), furo = listOf(Furo("111p")), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("1m"), agariTatsu = Tatsu("23m"), tsumo = false, ) tester(pattern, setOf(Junchan)) } @Test fun testSananko_Sandoko() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("9p"), menzenMentsu = listOf(Mentsu("456m"), Mentsu("111p")), furo = listOf(Furo("1111m", true), Furo("1111s", true)), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("4m"), agariTatsu = Tatsu("56m"), tsumo = false, ) tester(pattern, setOf(Sananko, Sandoko)) } @Test fun testSandoko_Sankantsu() { val pattern = RegularHoraHandPattern( RegularHandPattern( k = 4, jyantou = Tile.get("9p"), menzenMentsu = listOf(Mentsu("456m")), furo = listOf(Furo("1111p", false), Furo("1111m", true), Furo("1111s", true)), tatsu = emptyList(), remaining = emptyList() ), agari = Tile.get("4m"), agariTatsu = Tatsu("56m"), tsumo = false, ) tester(pattern, setOf(Sandoko, Sankantsu)) } }
1
Kotlin
0
9
571cebf84a5bf04337f162234e2f610954f99e8c
9,381
mahjong-utils
MIT License
src/test/kotlin/StoreTest.kt
Cotel
121,170,191
false
null
import com.cotel.duck.* import io.kotlintest.matchers.shouldBe import io.kotlintest.specs.StringSpec import java.time.Duration import kotlin.concurrent.thread class StoreTest : StringSpec({ "Store should notify subscriptors on state change" { var timesCalled = 0 val subscriptor = object : Subscriptor { override val store: Store = testStore override fun onStateChanged() { timesCalled++ } } testStore.subscribe(subscriptor) subscriptor.store.dispatch(CounterActions.Increment) subscriptor.store.dispatch(CounterActions.Decrement) subscriptor.store.dispatch(CounterActions.Increment) subscriptor.store.dispatch(CounterActions.Reset) timesCalled shouldBe 4 } "Store reducers should update if they share actions" { testStore.dispatch(CounterActions.Increment) testStore.dispatch(CounterActions.Increment) testStore.dispatch(CounterActions.IncrementBy(2)) testStore.dispatch(CounterActions.Decrement) testStore.state["counter"] shouldBe 3 testStore.state["word"] shouldBe "aaa" } "Store middleware can modify actions" { val enhancedTestStore = Store(setOf( CounterReducer() )) val middleware = PayloadIncrementMiddleware(PayloadIncrementMiddleware(BaseMiddleware(enhancedTestStore))) enhancedTestStore.setMiddleWareChain(middleware) enhancedTestStore.dispatch(CounterActions.Increment) enhancedTestStore.state["counter"] shouldBe 3 } "Store middlewares can dispatch asynchronous actions" { val enhancedTestStore = Store(setOf( CounterReducer() )) val middleware = PauseMiddleware(BaseMiddleware(enhancedTestStore)) enhancedTestStore.setMiddleWareChain(middleware) enhancedTestStore.dispatch(CounterActions.Increment) enhancedTestStore.state["counter"] shouldBe 0 Thread.sleep(Duration.ofSeconds(4).toMillis()) enhancedTestStore.state["counter"] shouldBe 1 } }) sealed class CounterActions : Action { object Increment : CounterActions() class IncrementBy(override val payload: Int) : CounterActions(), PayloadAction<Int> object Decrement : CounterActions() object Reset : CounterActions() } class CounterReducer : Reducer<Int, CounterActions> { override val identifier: String = "counter" override val initialState: Int get() = 0 override fun reduce(state: Int, action: CounterActions): Int = when (action) { CounterActions.Increment -> state + 1 is CounterActions.IncrementBy -> state + action.payload CounterActions.Decrement -> state - 1 CounterActions.Reset -> 0 } } class StringReducer : Reducer<String, CounterActions> { override val identifier: String = "word" override val initialState: String get() = "" override fun reduce(state: String, action: CounterActions): String = when (action) { CounterActions.Increment -> state + "a" is CounterActions.IncrementBy -> state + "a".repeat(action.payload) CounterActions.Decrement -> state.drop(1) CounterActions.Reset -> "" } } class PayloadIncrementMiddleware(override val next: Dispatcher) : Middleware { override fun dispatch(action: Action) { when (action) { CounterActions.Increment -> next.dispatch(CounterActions.IncrementBy(2)) is CounterActions.IncrementBy -> next.dispatch(CounterActions.IncrementBy(action.payload + 1)) else -> next.dispatch(action) } } } class PauseMiddleware(override val next: Dispatcher) : Middleware { override fun dispatch(action: Action) { next.dispatch(CounterActions.IncrementBy(0)) thread(start = true) { Thread.sleep(Duration.ofSeconds(3).toMillis()) next.dispatch(action) } } } val testStore = Store(setOf( CounterReducer(), StringReducer() ))
0
Kotlin
0
3
60cdb1bf883dd3cc1c110288679793208a0a2dfb
4,056
Duck
MIT License
halley-retrofit/src/main/kotlin/com/infinum/halley/retrofit/converters/options/HalleyOptionsFactory.kt
infinum
515,133,770
false
{"Kotlin": 133597, "Groovy": 1211}
package com.infinum.halley.retrofit.converters.options import com.infinum.halley.core.serializers.link.models.templated.params.Arguments import com.infinum.halley.core.typealiases.HalleyKeyedMap import com.infinum.halley.core.typealiases.HalleyMap import com.infinum.halley.retrofit.annotations.HalArgumentEntry import com.infinum.halley.retrofit.annotations.HalQueryArgument import com.infinum.halley.retrofit.annotations.HalTag import com.infinum.halley.retrofit.annotations.HalTemplateArgument import com.infinum.halley.retrofit.cache.HalleyOptions import com.infinum.halley.retrofit.cache.HalleyOptionsCache internal object HalleyOptionsFactory { private val commonFactory: OptionFactory<Arguments.Common?, HalArgumentEntry, HalleyMap> = HalleyCommonArgumentsFactory() private val queryFactory: OptionFactory<Arguments.Query?, HalQueryArgument, HalleyKeyedMap> = HalleyQueryArgumentsFactory() private val templateFactory: OptionFactory<Arguments.Template?, HalTemplateArgument, HalleyKeyedMap> = HalleyTemplateArgumentsFactory() fun setAnnotations(annotations: Array<out Annotation>): String { val tag = (annotations.find { it.annotationClass == HalTag::class } as? HalTag) ?.value ?: throw NullPointerException("HalTag cannot be null or empty") val common: Arguments.Common? = commonFactory(tag, annotations) val query: Arguments.Query? = queryFactory(tag, annotations) val template: Arguments.Template? = templateFactory(tag, annotations) // populating the cache with the final values of the options if (common != null && query != null && template != null) { val options = HalleyOptions( common = common, query = query, template = template ) HalleyOptionsCache.put(tag, options) } return tag } }
0
Kotlin
0
0
a00e0c6853779b714c453eaf4e95e964d187ea9c
1,913
android-halley
Apache License 2.0
src/main/kotlin/icu/windea/pls/localisation/codeInsight/completion/ParadoxLocalisationCompletionContributor.kt
DragonKnightOfBreeze
328,104,626
false
null
package icu.windea.pls.localisation.codeInsight.completion import com.intellij.codeInsight.completion.* import com.intellij.patterns.PlatformPatterns.* import icu.windea.pls.* import icu.windea.pls.core.* import icu.windea.pls.localisation.psi.* import icu.windea.pls.localisation.psi.ParadoxLocalisationElementTypes.* class ParadoxLocalisationCompletionContributor : CompletionContributor() { init { //当用户可能正在输入一个locale的名字时提示 val localePattern = or(psiElement(LOCALE_TOKEN), psiElement(PROPERTY_KEY_TOKEN)) extend(localePattern, ParadoxLocalisationLocaleCompletionProvider()) //当用户可能正在输入一个propertyReference的名字时提示 val propertyReferencePattern = psiElement(PROPERTY_REFERENCE_TOKEN) extend(propertyReferencePattern, ParadoxLocalisationPropertyReferenceCompletionProvider()) //当用户可能正在输入一个icon的名字时提示 val iconPattern = psiElement(ICON_TOKEN) extend(iconPattern, ParadoxLocalisationIconCompletionProvider()) //当用户可能正在输入一个color的ID时提示(因为colorId只有一个字符,这里需要特殊处理) val colorPattern = psiElement().atStartOf(psiElement().afterLeaf("§")) extend(colorPattern, ParadoxLocalisationColorCompletionProvider()) //当用户可能正在输入一个conceptName时提示 val conceptNamePattern = psiElement(CONCEPT_NAME_TOKEN) extend(conceptNamePattern, ParadoxLocalisationConceptCompletionProvider()) //当用户可能正在输入一个scriptedVariableReference的名字时提示 val scriptedVariableReferencePattern = psiElement().withElementType(SCRIPTED_VARIABLE_REFERENCE_TOKEN) extend(scriptedVariableReferencePattern, ParadoxScriptedVariableCompletionProvider()) //当用户可能正在输入一个localisationExpression时提示 val expressionPattern = psiElement().withElementType(ParadoxLocalisationTokenSets.EXPRESSION_TOKENS) extend(expressionPattern, ParadoxLocalisationExpressionCompletionProvider()) //当用户可能正在输入一个localisation的名字时提示 val localisationNamePattern = psiElement(PROPERTY_KEY_TOKEN) extend(CompletionType.BASIC, localisationNamePattern, ParadoxLocalisationNameCompletionProvider()) } override fun beforeCompletion(context: CompletionInitializationContext) { context.dummyIdentifier = PlsConstants.dummyIdentifier } @Suppress("RedundantOverride") override fun fillCompletionVariants(parameters: CompletionParameters, result: CompletionResultSet) { super.fillCompletionVariants(parameters, result) } }
12
null
5
41
99e8660a23f19642c7164c6d6fcafd25b5af40ee
2,523
Paradox-Language-Support
MIT License
app-desktop/src/main/kotlin/com/scurab/kuproxy/desktop/Texts.kt
jbruchanov
359,263,583
false
null
package com.scurab.kuproxy.desktop import androidx.compose.ui.text.AnnotatedString import com.scurab.kuproxy.desktop.ext.ans interface Texts { val domains: AnnotatedString val port: AnnotatedString val ok: AnnotatedString val cancel: AnnotatedString val proxy: AnnotatedString val passthrough: AnnotatedString val replay: AnnotatedString val record: AnnotatedString val request: AnnotatedString val response: AnnotatedString } object EnTexts : Texts { override val domains: AnnotatedString = "Domains".ans override val port: AnnotatedString = "Port".ans override val ok: AnnotatedString = "OK".ans override val cancel: AnnotatedString = "Cancel".ans override val proxy: AnnotatedString = "Proxy".ans override val passthrough: AnnotatedString = "Passthrough".ans override val replay: AnnotatedString = "Replay".ans override val record: AnnotatedString = "Record".ans override val request: AnnotatedString = "Request".ans override val response: AnnotatedString = "Response".ans }
0
Kotlin
0
1
2e10d85e7e318850679be3a21fe4406645f88811
1,061
kuproxy
Apache License 2.0
src/main/kotlin/me/nobaboy/nobaaddons/util/data/DungeonFloor.kt
nobaboy
867,566,026
false
{"Kotlin": 147079}
package me.nobaboy.nobaaddons.api.data enum class FloorType(val floor: Int) { NONE(-1), E0(0), F1(1), M1(1), F2(2), M2(2), F3(3), M3(3), F4(4), M4(4), F5(5), M5(5), F6(6), M6(6), F7(7), M7(7) }
1
Kotlin
1
1
cebdef91337207fe8289c978e2cc878fc3bfd63f
266
NobaAddons-old
The Unlicense
platform/lang-impl/src/com/intellij/model/presentation/impl/DefaultSymbolPresentation.kt
hieuprogrammer
284,920,751
false
null
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.model.presentation.impl import com.intellij.model.presentation.SymbolPresentation import javax.swing.Icon internal class DefaultSymbolPresentation( private val icon: Icon?, private val typeString: String, private val shortNameString: String, private val longNameString: String? = shortNameString ) : SymbolPresentation { override fun getIcon(): Icon? = icon override fun getShortNameString(): String = shortNameString override fun getShortDescription(): String = "$typeString '$shortNameString'" override fun getLongDescription(): String = "$typeString '$longNameString'" }
1
null
1
2
dc846ecb926c9d9589c1ed8a40fdb20e47874db9
754
intellij-community
Apache License 2.0
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/ChannelAvatar.kt
GetStream
177,873,527
false
null
/* * Copyright (c) 2014-2022 Stream.io Inc. All rights reserved. * * Licensed under the Stream License; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://github.com/GetStream/stream-chat-android/blob/main/LICENSE * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.getstream.chat.android.compose.ui.components.avatar import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Shape import androidx.compose.ui.text.TextStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import io.getstream.chat.android.compose.previewdata.PreviewChannelData import io.getstream.chat.android.compose.previewdata.PreviewUserData import io.getstream.chat.android.compose.state.OnlineIndicatorAlignment import io.getstream.chat.android.compose.ui.theme.ChatTheme import io.getstream.chat.android.models.Channel import io.getstream.chat.android.models.User import io.getstream.chat.android.ui.common.utils.extensions.initials /** * Represents the [Channel] avatar that's shown when browsing channels or when you open the Messages screen. * * Based on the state of the [Channel] and the number of members, it shows different types of images. * * @param channel The channel whose data we need to show. * @param currentUser The current user, used to determine avatar data. * @param modifier Modifier for styling. * @param shape The shape of the avatar. * @param textStyle The [TextStyle] that will be used for the initials. * @param groupAvatarTextStyle The [TextStyle] that will be used for the initials in sectioned avatar. * @param showOnlineIndicator If we show online indicator or not. * @param onlineIndicatorAlignment The alignment of online indicator. * @param onlineIndicator Custom composable that allows to replace the default online indicator. * @param contentDescription The description to use for the avatar. * @param onClick The handler when the user clicks on the avatar. */ @Composable public fun ChannelAvatar( channel: Channel, currentUser: User?, modifier: Modifier = Modifier, shape: Shape = ChatTheme.shapes.avatar, textStyle: TextStyle = ChatTheme.typography.title3Bold, groupAvatarTextStyle: TextStyle = ChatTheme.typography.captionBold, showOnlineIndicator: Boolean = true, onlineIndicatorAlignment: OnlineIndicatorAlignment = OnlineIndicatorAlignment.TopEnd, onlineIndicator: @Composable BoxScope.() -> Unit = { DefaultOnlineIndicator(onlineIndicatorAlignment) }, contentDescription: String? = null, onClick: (() -> Unit)? = null, ) { val members = channel.members val memberCount = members.size when { /** * If the channel has an image we load that as a priority. */ channel.image.isNotEmpty() -> { Avatar( modifier = modifier, imageUrl = channel.image, initials = channel.initials, textStyle = textStyle, shape = shape, contentDescription = contentDescription, onClick = onClick, ) } /** * If the channel has one member we show the member's image or initials. */ memberCount == 1 -> { val user = members.first().user UserAvatar( modifier = modifier, user = user, shape = shape, contentDescription = user.name, showOnlineIndicator = showOnlineIndicator, onlineIndicatorAlignment = onlineIndicatorAlignment, onlineIndicator = onlineIndicator, onClick = onClick, ) } /** * If the channel has two members and one of the is the current user - we show the other * member's image or initials. */ memberCount == 2 && members.any { it.user.id == currentUser?.id } -> { val user = members.first { it.user.id != currentUser?.id }.user UserAvatar( modifier = modifier, user = user, shape = shape, contentDescription = user.name, showOnlineIndicator = showOnlineIndicator, onlineIndicatorAlignment = onlineIndicatorAlignment, onlineIndicator = onlineIndicator, onClick = onClick, ) } /** * If the channel has more than two members - we load a matrix of their images or initials. */ else -> { val users = members.filter { it.user.id != currentUser?.id }.map { it.user } GroupAvatar( users = users, modifier = modifier, shape = shape, textStyle = groupAvatarTextStyle, onClick = onClick, ) } } } /** * Preview of [ChannelAvatar] for a channel with an avatar image. * * Should show a channel image. */ @Preview(showBackground = true, name = "ChannelAvatar Preview (With image)") @Composable private fun ChannelWithImageAvatarPreview() { ChannelAvatarPreview(PreviewChannelData.channelWithImage) } /** * Preview of [ChannelAvatar] for a direct conversation with an online user. * * Should show a user avatar with an online indicator. */ @Preview(showBackground = true, name = "ChannelAvatar Preview (Online user)") @Composable private fun ChannelAvatarForDirectChannelWithOnlineUserPreview() { ChannelAvatarPreview(PreviewChannelData.channelWithOnlineUser) } /** * Preview of [ChannelAvatar] for a direct conversation with only one user. * * Should show a user avatar with an online indicator. */ @Preview(showBackground = true, name = "ChannelAvatar Preview (Only one user)") @Composable private fun ChannelAvatarForDirectChannelWithOneUserPreview() { ChannelAvatarPreview(PreviewChannelData.channelWithOneUser) } /** * Preview of [ChannelAvatar] for a channel without image and with few members. * * Should show an avatar with 2 sections that represent the avatars of the first * 2 members of the channel. */ @Preview(showBackground = true, name = "ChannelAvatar Preview (Few members)") @Composable private fun ChannelAvatarForChannelWithFewMembersPreview() { ChannelAvatarPreview(PreviewChannelData.channelWithFewMembers) } /** * Preview of [ChannelAvatar] for a channel without image and with many members. * * Should show an avatar with 4 sections that represent the avatars of the first * 4 members of the channel. */ @Preview(showBackground = true, name = "ChannelAvatar Preview (Many members)") @Composable private fun ChannelAvatarForChannelWithManyMembersPreview() { ChannelAvatarPreview(PreviewChannelData.channelWithManyMembers) } /** * Shows [ChannelAvatar] preview for the provided parameters. * * @param channel The channel used to show the preview. */ @Composable private fun ChannelAvatarPreview(channel: Channel) { ChatTheme { ChannelAvatar( channel = channel, currentUser = PreviewUserData.user1, modifier = Modifier.size(36.dp), ) } }
37
null
273
1,451
8e46f46a68810d8086c48a88f0fff29faa2629eb
7,669
stream-chat-android
FSF All Permissive License
src/me/anno/ecs/systems/Updatable.kt
AntonioNoack
456,513,348
false
{"Kotlin": 10912545, "C": 236426, "Java": 6754, "Lua": 4496, "C++": 3070, "GLSL": 2698}
package me.anno.ecs.systems import me.anno.ecs.Component interface Updatable { /** * will be called once per frame, once per instance-class, and shall then iterate over all instances * */ fun update(instances: Collection<Component>) }
0
Kotlin
3
24
013af4d92e0f89a83958008fbe1d1fdd9a10e992
254
RemsEngine
Apache License 2.0
SygicStart/src/main/java/com/sygic/sdk/example/dependencyinjection/ViewModelModule.kt
Sygic
433,540,119
false
{"Kotlin": 124860}
package com.sygic.sdk.example.dependencyinjection import com.sygic.sdk.map.data.SimpleCameraDataModel import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.android.components.ViewModelComponent import dagger.hilt.android.scopes.ViewModelScoped @Module @InstallIn(ViewModelComponent::class) object ViewModelModule { @ViewModelScoped @Provides fun provideSimpleCameraDataModel(): SimpleCameraDataModel { return SimpleCameraDataModel() } }
0
Kotlin
0
1
9f079fb20a106f756d3bbd01dba09468a4a0965d
502
sygic-sdk-examples-android
MIT License
platform/vcs-tests/testSrc/com/intellij/openapi/vcs/BasePartiallyExcludedChangesTest.kt
ingokegel
284,920,751
false
null
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs import com.intellij.openapi.util.Disposer import com.intellij.openapi.vcs.changes.ui.PartiallyExcludedFilesStateHolder import com.intellij.openapi.vcs.ex.ExclusionState import com.intellij.openapi.vcs.ex.PartialLocalLineStatusTracker import com.intellij.openapi.vcs.impl.PartialChangesUtil abstract class BasePartiallyExcludedChangesTest : BaseLineStatusTrackerManagerTest() { private lateinit var stateHolder: MyStateHolder override fun setUp() { super.setUp() stateHolder = MyStateHolder() stateHolder.updateExclusionStates() } protected inner class MyStateHolder : PartiallyExcludedFilesStateHolder<FilePath>(getProject()) { val paths = HashSet<FilePath>() init { Disposer.register(testRootDisposable, this) } override val trackableElements: Sequence<FilePath> get() = paths.asSequence() override fun getChangeListId(element: FilePath): String = DEFAULT.asListNameToId() override fun findElementFor(tracker: PartialLocalLineStatusTracker, changeListId: String): FilePath? { return paths.find { it.virtualFile == tracker.virtualFile } } override fun findTrackerFor(element: FilePath): PartialLocalLineStatusTracker? { val file = element.virtualFile ?: return null return PartialChangesUtil.getPartialTracker(getProject(), file) } fun toggleElements(elements: Collection<FilePath>) { val hasExcluded = elements.any { getExclusionState(it) != ExclusionState.ALL_INCLUDED } if (hasExcluded) includeElements(elements) else excludeElements(elements) } fun waitExclusionStateUpdate() { myUpdateQueue.flush() } } protected fun setHolderPaths(vararg paths: String) { stateHolder.paths.clear() stateHolder.paths.addAll(paths.toFilePaths()) } protected fun waitExclusionStateUpdate() { stateHolder.waitExclusionStateUpdate() } protected fun toggle(vararg paths: String) { assertContainsElements(stateHolder.paths, paths.toFilePaths()) stateHolder.toggleElements(paths.toFilePaths()) } protected fun include(vararg paths: String) { assertContainsElements(stateHolder.paths, paths.toFilePaths()) stateHolder.includeElements(paths.toFilePaths()) } protected fun exclude(vararg paths: String) { assertContainsElements(stateHolder.paths, paths.toFilePaths()) stateHolder.excludeElements(paths.toFilePaths()) } protected fun assertIncluded(vararg paths: String) { val expected = paths.toFilePaths().toSet() val actual = stateHolder.getIncludedSet() assertSameElements(actual.map { it.name }, expected.map { it.name }) assertSameElements(actual, expected) } protected fun PartialLocalLineStatusTracker.assertExcluded(index: Int, expected: Boolean) { val range = this.getRanges()!![index] assertEquals(expected, range.isExcludedFromCommit) } protected fun String.assertExcludedState(holderState: ExclusionState, trackerState: ExclusionState = holderState) { val actual = stateHolder.getExclusionState(this.toFilePath) assertEquals(holderState, actual) (toFilePath.virtualFile?.tracker as? PartialLocalLineStatusTracker)?.assertExcludedState(trackerState, DEFAULT) } protected fun PartialLocalLineStatusTracker.exclude(index: Int, isExcluded: Boolean) { val ranges = getRanges()!! this.setExcludedFromCommit(ranges[index], isExcluded) waitExclusionStateUpdate() } protected fun PartialLocalLineStatusTracker.moveTo(index: Int, changelistName: String) { val ranges = getRanges()!! this.moveToChangelist(ranges[index], changelistName.asListNameToList()) waitExclusionStateUpdate() } }
284
null
5162
2
dc846ecb926c9d9589c1ed8a40fdb20e47874db9
3,814
intellij-community
Apache License 2.0
build-tools/agp-gradle-core/src/main/java/com/android/build/gradle/internal/utils/SdkUtils.kt
RivanParmar
526,653,590
false
null
/* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.build.gradle.internal.utils import com.android.build.api.variant.impl.AndroidVersionImpl import com.android.builder.core.DefaultApiVersion import com.android.sdklib.AndroidVersion import java.util.regex.Pattern data class CompileData( val apiLevel: Int? = null, val codeName: String? = null, val sdkExtension: Int? = null, val vendorName: String? = null, val addonName: String? = null ) { fun isAddon() = vendorName != null && addonName != null } fun parseTargetHash(targetHash : String): CompileData { val apiMatcher = API_PATTERN.matcher(targetHash) if (apiMatcher.matches()) { return CompileData( apiLevel = apiMatcher.group(1).toInt(), sdkExtension = apiMatcher.group(3)?.toIntOrNull() ) } val previewMatcher = FULL_PREVIEW_PATTERN.matcher(targetHash) if (previewMatcher.matches()) { return CompileData(codeName = previewMatcher.group(1)) } val addonMatcher = ADDON_PATTERN.matcher(targetHash) if (addonMatcher.matches()) { return CompileData( vendorName = addonMatcher.group(1), addonName = addonMatcher.group(2), apiLevel = addonMatcher.group(3).toInt() ) } throw RuntimeException( """ Unsupported value: $targetHash. Format must be one of: - android-31 - android-31-ext2 - android-T - vendorName:addonName:31 """.trimIndent() ) } fun validatePreviewTargetValue(value: String): String? = if (AndroidVersion.PREVIEW_PATTERN.matcher(value).matches()) { value } else null internal fun createTargetSdkVersion(targetSdk: Int?, targetSdkPreview: String?) = if (targetSdk != null || targetSdkPreview != null) { val apiVersion = targetSdk?.let { DefaultApiVersion(it) } ?: DefaultApiVersion(targetSdkPreview!!) apiVersion.run { AndroidVersionImpl(apiLevel, codename) } } else null private val API_PATTERN: Pattern = Pattern.compile("^android-([0-9]+)(-ext(\\d+))?$") private val FULL_PREVIEW_PATTERN: Pattern = Pattern.compile("^android-([A-Z][0-9A-Za-z_]*)$") private val ADDON_PATTERN: Pattern = Pattern.compile("^(.+):(.+):(\\d+)$")
0
null
2
17
8fb2bb1433e734aa9901184b76bc4089a02d76ca
2,934
androlabs
Apache License 2.0
src/main/kotlin/com/github/durun/nitron/app/metrics/MetricsCommand.kt
Durun
212,494,212
false
null
package com.github.durun.nitron.app.metrics import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.arguments.argument import com.github.ajalt.clikt.parameters.arguments.multiple import com.github.ajalt.clikt.parameters.types.path import com.github.durun.nitron.core.MD5 import com.github.durun.nitron.core.toMD5 import com.github.durun.nitron.inout.database.SQLiteDatabase import com.github.durun.nitron.inout.model.metrics.ChangesTable import com.github.durun.nitron.inout.model.metrics.CodesTable import com.github.durun.nitron.inout.model.metrics.GlobalPatternsTable import com.github.durun.nitron.inout.model.metrics.RevisionsTable import com.github.durun.nitron.util.Log import com.github.durun.nitron.util.LogLevel import com.github.durun.nitron.util.logger import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking import org.jetbrains.exposed.sql.* import org.jetbrains.exposed.sql.transactions.transaction import java.nio.file.Path class MetricsCommand : CliktCommand(name = "metrics") { private val dbFiles: List<Path> by argument(name = "DATABASE", help = "Database file") .path(mustBeReadable = true) .multiple() private val log by logger() override fun run() { LogLevel = Log.Level.VERBOSE dbFiles.forEach { dbFile -> val db = SQLiteDatabase.connect(dbFile) processOneDb(db) log.info { "Done: $dbFile" } } } private fun processOneDb(db: Database) { val patterns: MutableMap<Pair<MD5?, MD5?>, Pattern> = mutableMapOf() val revisions: MutableMap<String, Revision> = mutableMapOf() val changes = transaction(db) { val c1 = CodesTable.alias("c1") val c2 = CodesTable.alias("c2") ChangesTable .innerJoin(c1, onColumn = { beforeHash }, otherColumn = { c1[CodesTable.hash] }) .innerJoin(c2, onColumn = { ChangesTable.afterHash }, otherColumn = { c2[CodesTable.hash] }) .innerJoin(RevisionsTable, onColumn = { ChangesTable.revision }, otherColumn = { id }) .selectAll() .map { val hashPair = it[ChangesTable.beforeHash]?.toMD5() to it[ChangesTable.afterHash]?.toMD5() val revisionId = it[ChangesTable.revision] Change( software = it[ChangesTable.software], filePath = it[ChangesTable.filepath], pattern = patterns.computeIfAbsent(hashPair) { _ -> Pattern( hash = hashPair, blob = it[ChangesTable.beforeHash] to it[ChangesTable.afterHash], text = it[c1[CodesTable.text]] to it[c2[CodesTable.text]] ) }, revision = revisions.computeIfAbsent(revisionId) { _ -> Revision( id = revisionId, author = runCatching { it[RevisionsTable.author] }.getOrDefault("null"), message = runCatching { it[RevisionsTable.message] }.getOrDefault("null") ) } ) } } //val patterns = changes.map { it.pattern }.distinct() log.debug { "nPatterns: ${patterns.size}" } val softwares = changes.groupBy { it.software } log.debug { "Softwares: ${softwares.keys}" } val metricses = runBlocking(Dispatchers.Default) { patterns.values.mapIndexed { i, pattern -> async { val supportingChanges = changes.filter { it.pattern.hash == pattern.hash } val sup = supportingChanges.count() val left = changes.count { it.pattern.hash.first == pattern.hash.first } // idf val projects = softwares.count { (_, changeList) -> changeList.any { it.pattern.hash == pattern.hash } } val files = supportingChanges .distinctBy { it.filePath } .count() // bugfix words val bugfixWords = supportingChanges.count { change -> bugfixKeywords.any { change.revision.message.contains(it, ignoreCase = true) } } // count test file val testFiles = supportingChanges.count { change -> isTestPath(change.filePath) } if (i % 1000 == 0) log.info { "Calc done: $i / ${patterns.size}" } Metrics( pattern, support = sup, confidence = sup.toDouble() / left, projects = projects, files = files, authors = supportingChanges.distinctBy { it.revision.author }.count(), bugfixWords = bugfixWords.toDouble() / sup, testFiles = testFiles.toDouble() / sup, ) } }.map { it.await() } } log.info { "Calc done." } log.info { "Writing to DB." } transaction(db) { SchemaUtils.drop(GlobalPatternsTable) SchemaUtils.createMissingTablesAndColumns(GlobalPatternsTable) } transaction(db) { metricses.forEach { metrics -> GlobalPatternsTable.insert { it[beforeHash] = metrics.pattern.blob.first it[afterHash] = metrics.pattern.blob.second it[support] = metrics.support it[confidence] = metrics.confidence it[projects] = metrics.projects it[files] = metrics.files it[authors] = metrics.authors it[bugfixWords] = metrics.bugfixWords it[testFiles] = metrics.testFiles } } } } companion object { private val bugfixKeywords = listOf( "fix", "bug", "error", "fault", "issue", "mistake", "incorrect", "defect", "flaw" ) private fun isTestPath(path: String): Boolean { if (path.contains("Test")) return true val names = path.split('/') val fileName = names.lastOrNull()?.split('.')?.firstOrNull() ?: "" val dirNames = names.dropLast(1) if (fileName.startsWith("test")) return true if (dirNames.any { it.startsWith("test") }) return true return false } } } private data class Revision( val id: String, val author: String, val message: String ) private data class Change( val software: String, val filePath: String, val pattern: Pattern, val revision: Revision )
7
Kotlin
0
0
0e2f522025e156d74ce2345b1004d6bc684a7763
7,271
nitron
MIT License
basick/src/main/java/com/mozhimen/basick/utilk/java/util/UtilKTimeUnit.kt
mozhimen
353,952,154
false
{"Kotlin": 1551026, "Java": 3916, "AIDL": 964}
package com.mozhimen.kotlin.utilk.java.util import java.util.concurrent.TimeUnit /** * @ClassName UtilKTimeUnit * @Description TODO * @Author Mozhimen & <NAME> * @Date 2023/8/11 15:43 * @Version 1.0 */ fun Long.longSecond2longMillis(): Long = UtilKTimeUnit.longSecond2longMillis(this) fun Long.longMinute2longMillis(): Long = UtilKTimeUnit.longMinute2longMillis(this) fun Long.longHour2longMillis(): Long = UtilKTimeUnit.longHour2longMillis(this) object UtilKTimeUnit { @JvmStatic fun longSecond2longMillis(second: Long): Long = TimeUnit.SECONDS.toMillis(second) @JvmStatic fun longMinute2longMillis(second: Long): Long = TimeUnit.MINUTES.toMillis(second) @JvmStatic fun longHour2longMillis(second: Long): Long = TimeUnit.HOURS.toMillis(second) }
1
Kotlin
15
118
3e9cda57ac87f84134e768cc3756411d5bbd143f
820
SwiftKit
Apache License 2.0
finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/WebhookServiceImpl.kt
Finch-API
581,317,330
false
null
// File generated from our OpenAPI spec by Stainless. package com.tryfinch.api.services.blocking import com.fasterxml.jackson.core.JsonProcessingException import com.google.common.collect.ListMultimap import com.tryfinch.api.core.ClientOptions import com.tryfinch.api.core.JsonValue import com.tryfinch.api.core.http.HttpResponse.Handler import com.tryfinch.api.errors.FinchError import com.tryfinch.api.errors.FinchException import com.tryfinch.api.services.errorHandler import java.security.MessageDigest import java.time.Duration import java.time.Instant import java.util.Base64 import javax.crypto.Mac import javax.crypto.spec.SecretKeySpec class WebhookServiceImpl constructor( private val clientOptions: ClientOptions, ) : WebhookService { private val errorHandler: Handler<FinchError> = errorHandler(clientOptions.jsonMapper) override fun unwrap( payload: String, headers: ListMultimap<String, String>, secret: String? ): JsonValue { verifySignature(payload, headers, secret) return try { clientOptions.jsonMapper.readValue(payload, JsonValue::class.java) } catch (e: JsonProcessingException) { throw FinchException("Invalid event payload", e) } } override fun verifySignature( payload: String, headers: ListMultimap<String, String>, secret: String? ) { val webhookSecret = secret ?: clientOptions.webhookSecret ?: throw FinchException( "The webhook secret must either be set using the env var, FINCH_WEBHOOK_SECRET, on the client class, or passed to this method" ) val parsedSecret = try { Base64.getDecoder().decode(webhookSecret) } catch (e: RuntimeException) { throw FinchException("Invalid webhook secret") } val eventId = headers.get("finch-event-id").getOrNull(0) ?: throw FinchException("Could not find finch-event-id header") val msgSignture = headers.get("finch-signature").getOrNull(0) ?: throw FinchException("Could not find finch-signature header") val msgTimestamp = headers.get("finch-timestamp").getOrNull(0) ?: throw FinchException("Could not find finch-timestamp header") val timestamp = try { Instant.ofEpochSecond(msgTimestamp.toLong()) } catch (e: RuntimeException) { throw FinchException("Invalid timestamp header: $msgTimestamp", e) } val now = Instant.now(clientOptions.clock) if (timestamp.isBefore(now.minus(Duration.ofMinutes(5)))) { throw FinchException("Webhook timestamp too old") } if (timestamp.isAfter(now.plus(Duration.ofMinutes(5)))) { throw FinchException("Webhook timestamp too new") } val mac = Mac.getInstance("HmacSHA256") mac.init(SecretKeySpec(parsedSecret, "HmacSHA256")) val expectedSignature = mac.doFinal("$eventId.${timestamp.epochSecond}.$payload".toByteArray()) msgSignture.splitToSequence(" ").forEach { val parts = it.split(",") if (parts.size != 2) { return@forEach } if (parts[0] != "v1") { return@forEach } if (MessageDigest.isEqual(Base64.getDecoder().decode(parts[1]), expectedSignature)) { return } } throw FinchException("None of the given webhook signatures match the expected signature") } }
1
null
0
4
871e0af8cccfd083c138202408e461a5036160b5
3,718
finch-api-java
Apache License 2.0
kotest-assertions/kotest-assertions-core/src/jvmMain/kotlin/io/kotest/matchers/future/matchers.kt
ca-r0-l
258,232,982
true
{"Kotlin": 2272378, "HTML": 423, "Java": 153}
package io.kotest.matchers.future import io.kotest.matchers.Matcher import io.kotest.matchers.MatcherResult import io.kotest.matchers.should import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNot import io.kotest.matchers.shouldNotBe import java.util.concurrent.CompletableFuture fun <T> CompletableFuture<T>.shouldBeCompletedExceptionally() = this shouldBe completedExceptionally<T>() fun <T> CompletableFuture<T>.shouldNotBeCompletedExceptionally() = this shouldNotBe completedExceptionally<T>() fun <T> completedExceptionally() = object : Matcher<CompletableFuture<T>> { override fun test(value: CompletableFuture<T>): MatcherResult = MatcherResult( value.isCompletedExceptionally, "Future should be completed exceptionally", "Future should not be completed exceptionally" ) } fun <T> CompletableFuture<T>.shouldBeCompleted() = this shouldBe completed<T>() fun <T> CompletableFuture<T>.shouldNotBeCompleted() = this shouldNotBe completed<T>() fun <T> completed() = object : Matcher<CompletableFuture<T>> { override fun test(value: CompletableFuture<T>): MatcherResult = MatcherResult( value.isDone, "Future should be completed", "Future should not be completed" ) } fun <T> CompletableFuture<T>.shouldBeCancelled() = this shouldBe cancelled<T>() fun <T> CompletableFuture<T>.shouldNotBeCancelled() = this shouldNotBe cancelled<T>() fun <T> cancelled() = object : Matcher<CompletableFuture<T>> { override fun test(value: CompletableFuture<T>): MatcherResult = MatcherResult( value.isCancelled, "Future should be completed", "Future should not be completed" ) }
0
null
0
1
e176cc3e14364d74ee593533b50eb9b08df1f5d1
1,716
kotest
Apache License 2.0
src/main/kotlin/net/jp/vss/sample/controller/tasks/CreateTaskApiParameter.kt
nemuzuka
184,200,566
false
null
package net.jp.vss.sample.controller.tasks import com.fasterxml.jackson.annotation.JsonProperty import net.jp.vss.sample.constrains.JsonStringConstrains import net.jp.vss.sample.usecase.tasks.CreateTaskUseCaseParameter import javax.validation.constraints.NotNull import javax.validation.constraints.Pattern import javax.validation.constraints.Size /** * CreateTaskController のパラメータ. * * data class の場合、既存の奴は `@field:NotNull` と指定する必要がある */ data class CreateTaskApiParameter( @field:NotNull @field:Pattern(regexp = "[a-zA-Z0-9][-a-zA-Z0-9_]{0,127}") @field:Size(max = 128) @field:JsonProperty("task_code") val taskCode: String? = null, @field:NotNull @field:Size(max = 256) @field:JsonProperty("title") val title: String? = null, @field:NotNull @field:JsonProperty("content") val content: String? = null, @field:JsonProperty("deadline") val deadline: Long? = null, @JsonStringConstrains // kotlin で作成したので field は不要 @field:JsonProperty("attributes") val attributes: String? = null ) { companion object { /** * 新規 Task 用パラメータ生成. * * @return 新規 Task 用パラメータ */ fun newTask(): CreateTaskApiParameter = CreateTaskApiParameter( taskCode = "", title = "", content = "", attributes = null, deadline = null) } /** * CreateTaskUseCaseParameter に変換. * * @param createUserCode 登録ユーザコード * @return 生成 CreateTaskUseCaseParameter */ fun toParameter(createUserCode: String): CreateTaskUseCaseParameter = CreateTaskUseCaseParameter( taskCode = taskCode!!, title = title!!, content = content!!, attributes = attributes, deadline = deadline, createUserCode = createUserCode) }
18
Kotlin
0
0
ef8ed4626d2cd1dbbd3455534fedf67940a32361
1,836
spring-kotlin-sample
Apache License 2.0
src/main/kotlin/com/maxpilotto/kon/JsonParser.kt
maxpilotto
252,405,233
false
null
/* * Copyright 2020 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.maxpilotto.kon import com.maxpilotto.kon.extensions.* import com.maxpilotto.kon.protocols.Json import com.maxpilotto.kon.util.JsonException import java.io.File import java.io.InputStream import java.io.Reader import java.net.URL import java.net.URLConnection import kotlin.concurrent.thread /** * Json parsing utility * * This utility is meant to be an alternative to the [JsonObject] and [JsonArray] constructors * which can only parse from strings * * The [nextObject] and [nextArray] are the only public methods, which can be used to * parse the content into a [JsonObject] or [JsonArray] */ class JsonParser { //TODO Add option for detailed errors using the IndexPath class private var reader: Reader private var previous = END private var eof = false private var usePrevious = false /** * Creates a parser with the content of the given [file] */ constructor(file: File) : this(file.reader()) /** * Creates a parser with the content of the given [inputStream] */ constructor(inputStream: InputStream) : this(inputStream.reader()) /** * Creates a parse with the content of the given [string] */ constructor(string: String) : this(string.reader()) /** * Creates a parse with the content of the given [reader] */ constructor(reader: Reader) { this.reader = reader } /** * Returns the next value as a [JsonObject] * * A json object must be surrounded by curly brackets */ fun nextObject(): JsonObject { val result = JsonObject() var key: String? if (next() != '{') { throw JsonException("A JSON object must begin with '{'") } loop@ while (true) { // Key when (next()) { END -> { throw JsonException("A JSON object must end with '}'") } '}' -> { return result } else -> { back() key = nextValue().toString() } } // Key separator if (next() != ':') { throw JsonException("Expected ':' after a key") } // Value associated with the key, if the key is not a duplicate if (result.has(key)) { throw JsonException("Duplicate key: $key") } else { result[key] = nextValue() } when (next()) { ';', ',' -> { if (next() == '}') { return result } back() } '}' -> return result else -> throw JsonException("Expected a ',' or '}'") } } } /** * Returns the next value as a [JsonArray] * * A json array must be surrounded by square brackets */ fun nextArray(): JsonArray { val result = JsonArray() var c = next() // Unexpected start of array if (c != '[') { throw JsonException("A JSON array must start with '['") } c = next() // Unexpected end of array if (c == END) { throw JsonException("Expected a ',' or ']'") } // Array is not empty if (c != ']') { back() loop@ while (true) { if (next() == ',') { back() result.add(JsonValue.NULL) } else { back() result.add(nextValue()) } when (next()) { END -> throw JsonException( "Expected a ',' or ']'" ) ',' -> { c = next() if (c == END) { throw JsonException("Expected a ',' or ']'") } if (c == ']') { break@loop } back() } ']' -> break@loop else -> throw JsonException("Expected a ',' or ']'") } } } return result } /** * Returns the next value, this is a generic [Json], which could be a [JsonObject], [JsonArray] or [JsonValue] */ fun nextValue(): JsonValue { var c = next() return when (c) { '"' -> { //TODO Add single quotes JsonValue(nextString()) } '{' -> { back() JsonValue(nextObject()) } '[' -> { back() JsonValue(nextArray()) } else -> { val value = StringBuilder().apply { while (c >= SPACE && c.notInside(",:]}/\\\"[{;=#")) { append(c) c = next(false) } if (!eof) { back() } }.toString().trim() if (value.isEmpty()) { throw JsonException("Missing value") } JsonValue(parseValue(value)) } } } /** * Returns the next value as an escaped character * * Supported escaped characters * + t (tab) * + b (backspace) * + n (line feed) * + r (carriage return) * + " (double quote) * + ' (single quote) * + \ (backslash) * + / (slash) * + f (form feed) * + uXXXX (unicode character */ private fun nextEscaped(): Char { return when (val next = next(false)) { 't' -> '\t' 'b' -> '\b' 'n' -> '\n' 'r' -> '\r' 'f' -> '\u000C' '"', '\'', '\\', '/' -> next 'u' -> { try { next(4).toInt(16).toChar() } catch (e: Exception) { throw JsonException("Illegal escape", e) } } else -> throw JsonException("Illegal escape") } } /** * Returns the next value as a String * * A string must be surrounded by two double quotes */ private fun nextString(): String { //TODO Add configuration that parses strings with single quotes return StringBuilder().run { loop@ while (true) { when (val c = next(false)) { END -> throw JsonException( "Missing string closing character" ) '\r', '\n' -> throw JsonException("Unexpected line break inside string") '\\' -> append(nextEscaped()) '"' -> break@loop else -> append(c) } } toString() } } /** * Parses the given string [value] * * This will return a value, wrapped with in a [JsonValue], which will be a number, boolean or null value */ private fun parseValue(value: String): Any? { return when { value.equals("true", true) -> true value.equals("false", true) -> false value.equals("null", true) -> null value[0] in '0'..'9' || value[0] == '-' -> { if (isDecimalNotation(value)) { value.toDouble() } else { value.toLong() } } else -> value } } /** * Returns whether or not the given [value] is a decimal number or not */ private fun isDecimalNotation(value: String): Boolean { return value.indexOf('.') > -1 || value.indexOf('e') > -1 || value.indexOf('E') > -1 || value == "-0" } /** * Returns if there's more characters to read or not */ private fun hasNext(): Boolean { return !eof || usePrevious } /** * Returns the next character in the [reader] * * If [clean] is set to false, this method will return any character from the [reader], * otherwise it will return a clean character * * By default it will return a clean character */ private fun next(clean: Boolean = true): Char { val next: Char if (clean) { while (true) { val c = next(false) if (c == END || c > SPACE) { next = c break } } } else { if (usePrevious) { next = previous usePrevious = false } else { next = reader.read().toChar() } if (next == END) { eof = true } } previous = next return next } /** * Returns the next [n] characters */ private fun next(n: Int): String { return CharArray(n) { if (hasNext()) { next(true) } else { throw JsonException("Substring bounds error") } }.toString() } /** * Backs up one character. This provides a sort of lookahead capability, * so that you can test for a character before attempting to * parse the next character or identifier */ private fun back() { usePrevious = true eof = false } companion object { private const val SPACE = 32.toChar() private const val END = 0.toChar() } }
0
Kotlin
0
0
249fef928201305a18fe9826fc446e1d7493eb2d
10,550
kon
Apache License 2.0
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/TestRegistrationStateProcessor.kt
corona-warn-app
268,027,139
false
null
package de.rki.coronawarnapp.submission import android.content.Context import com.google.android.material.dialog.MaterialAlertDialogBuilder import de.rki.coronawarnapp.R import de.rki.coronawarnapp.bugreporting.censors.submission.PcrQrCodeCensor import de.rki.coronawarnapp.bugreporting.ui.toErrorDialogBuilder import de.rki.coronawarnapp.coronatest.TestRegistrationRequest import de.rki.coronawarnapp.coronatest.errors.AlreadyRedeemedException import de.rki.coronawarnapp.coronatest.qrcode.CoronaTestQRCode import de.rki.coronawarnapp.coronatest.type.BaseCoronaTest import de.rki.coronawarnapp.datadonation.analytics.modules.keysubmission.AnalyticsKeySubmissionCollector import de.rki.coronawarnapp.exception.ExceptionCategory import de.rki.coronawarnapp.exception.http.BadRequestException import de.rki.coronawarnapp.exception.http.CwaClientError import de.rki.coronawarnapp.exception.http.CwaServerError import de.rki.coronawarnapp.exception.http.CwaWebException import de.rki.coronawarnapp.exception.reporting.report import de.rki.coronawarnapp.familytest.core.repository.FamilyTestRepository import de.rki.coronawarnapp.util.toJavaTime import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock import javax.inject.Inject class TestRegistrationStateProcessor @Inject constructor( private val submissionRepository: SubmissionRepository, private val familyTestRepository: FamilyTestRepository, private val analyticsKeySubmissionCollector: AnalyticsKeySubmissionCollector, ) { private val mutex = Mutex() sealed class State { object Idle : State() object Working : State() data class TestRegistered(val test: BaseCoronaTest) : State() data class Error(val exception: Exception) : State() { fun getDialogBuilder(context: Context, comingFromTan: Boolean = false): MaterialAlertDialogBuilder { val builder = MaterialAlertDialogBuilder(context).apply { setCancelable(true) } return when (exception) { is AlreadyRedeemedException -> builder.apply { if (comingFromTan) { setTitle(R.string.submission_error_dialog_web_test_paired_title_tan) setMessage(R.string.submission_error_dialog_web_test_paired_body_tan) } else { setTitle(R.string.submission_error_dialog_web_tan_redeemed_title) setMessage(R.string.submission_error_dialog_web_tan_redeemed_body) } setPositiveButton(android.R.string.ok) { _, _ -> /* dismiss */ } } is BadRequestException -> builder.apply { if (comingFromTan) { setTitle(R.string.submission_error_dialog_web_test_paired_title_tan) setMessage(R.string.submission_error_dialog_web_test_paired_body_tan) } else { setTitle(R.string.submission_qr_code_scan_invalid_dialog_headline) setMessage(R.string.submission_qr_code_scan_invalid_dialog_body) } setPositiveButton(android.R.string.ok) { _, _ -> /* dismiss */ } } is CwaClientError, is CwaServerError -> builder.apply { setTitle(R.string.submission_error_dialog_web_generic_error_title) setMessage(R.string.submission_error_dialog_web_generic_network_error_body) setPositiveButton(android.R.string.ok) { _, _ -> /* dismiss */ } } is CwaWebException -> builder.apply { setTitle(R.string.submission_error_dialog_web_generic_error_title) setMessage(R.string.submission_error_dialog_web_generic_error_body) setPositiveButton(android.R.string.ok) { _, _ -> /* dismiss */ } } else -> exception.toErrorDialogBuilder(context) } } } } private val stateInternal = MutableStateFlow<State>(State.Idle) val state: Flow<State> = stateInternal suspend fun startTestRegistration( request: TestRegistrationRequest, isSubmissionConsentGiven: Boolean, allowTestReplacement: Boolean, ): BaseCoronaTest? = mutex.withLock { return try { stateInternal.value = State.Working PcrQrCodeCensor.dateOfBirth = request.dateOfBirth?.toJavaTime() val coronaTest = with(submissionRepository) { if (allowTestReplacement) tryReplaceTest(request) else registerTest(request) } if (isSubmissionConsentGiven) { submissionRepository.giveConsentToSubmission(type = coronaTest.type) if (request is CoronaTestQRCode) { analyticsKeySubmissionCollector.reportAdvancedConsentGiven(request.type) } } stateInternal.value = State.TestRegistered(test = coronaTest) coronaTest } catch (err: Exception) { stateInternal.value = State.Error(exception = err) if (err !is CwaWebException && err !is AlreadyRedeemedException) { err.report(ExceptionCategory.INTERNAL) } null } } suspend fun startFamilyTestRegistration( request: CoronaTestQRCode, personName: String ): BaseCoronaTest? = mutex.withLock { return try { stateInternal.value = State.Working PcrQrCodeCensor.dateOfBirth = request.dateOfBirth?.toJavaTime() val coronaTest = familyTestRepository.registerTest(request, personName) stateInternal.value = State.TestRegistered(test = coronaTest) coronaTest } catch (err: Exception) { stateInternal.value = State.Error(exception = err) if (err !is CwaWebException && err !is AlreadyRedeemedException) { err.report(ExceptionCategory.INTERNAL) } null } } }
2
null
514
2,495
d3833a212bd4c84e38a1fad23b282836d70ab8d5
6,589
cwa-app-android
Apache License 2.0
shared/src/commonMain/kotlin/com/flepper/therapeutic/data/usecases/GetTeamMembersUseCase.kt
develNerd
526,878,724
false
{"Kotlin": 296821, "Ruby": 1782, "Swift": 345}
package com.flepper.therapeutic.data.usecases import com.flepper.therapeutic.data.FlowResult import com.flepper.therapeutic.data.models.Filter import com.flepper.therapeutic.data.models.TeamMembersItem import com.flepper.therapeutic.data.models.WorldWideEvent import com.flepper.therapeutic.data.models.appointments.SearchAvailabilityRequest import com.flepper.therapeutic.data.models.appointments.availabletimeresponse.AvailableTeamMemberTime import com.flepper.therapeutic.data.models.customer.CustomerResponse import com.flepper.therapeutic.data.repositories.AppointmentsRepository import com.flepper.therapeutic.data.repositories.EventsRepository import com.flepper.therapeutic.data.reposositoryimpl.FlowList import kotlinx.coroutines.CoroutineScope class GetTeamMembersUseCase(coroutineScope: CoroutineScope, private val appointmentsRepository: AppointmentsRepository) : BaseUseCaseDispatcher<Unit, FlowResult<List<TeamMembersItem>>>(coroutineScope) { override suspend fun dispatchInBackground( request: Unit, coroutineScope: CoroutineScope ) = appointmentsRepository.getTeamMembers() } class SaveTeamMemberLocalUseCase(coroutineScope: CoroutineScope,private val appointmentsRepository: AppointmentsRepository) : BaseUseCaseDispatcher<List<TeamMembersItem>, Unit>(coroutineScope) { override suspend fun dispatchInBackground( request: List<TeamMembersItem>, coroutineScope: CoroutineScope ) = appointmentsRepository.saveTeamMembersLocal(request) } class GetTeamMembersLocalUseCase(coroutineScope: CoroutineScope,private val appointmentsRepository: AppointmentsRepository) : BaseUseCaseDispatcher<Unit, FlowList<TeamMembersItem>>(coroutineScope) { override suspend fun dispatchInBackground( request: Unit, coroutineScope: CoroutineScope ) = appointmentsRepository.getTeamMembersLocal() } class GetAvailableTimeUseCase(coroutineScope: CoroutineScope, private val appointmentsRepository: AppointmentsRepository) : BaseUseCaseDispatcher<SearchAvailabilityRequest, FlowResult<List<AvailableTeamMemberTime>>>(coroutineScope) { override suspend fun dispatchInBackground( request: SearchAvailabilityRequest, coroutineScope: CoroutineScope ) = appointmentsRepository.getTeamAvailableTimes(request) }
0
Kotlin
0
1
e2b1e12e9fef20a89c96b72b18cd6ab613c16af3
2,315
Therapeutic
Apache License 2.0
app/src/main/java/com/looper/vic/fragment/ChatFragment.kt
iamlooper
662,663,860
false
{"Kotlin": 104881}
package com.looper.vic.fragment import android.Manifest import android.content.Context import android.os.Bundle import android.text.Editable import android.text.TextWatcher import android.util.Base64 import android.view.LayoutInflater import android.view.Menu import android.view.MenuInflater import android.view.MenuItem import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts.OpenMultipleDocuments import androidx.appcompat.app.AppCompatActivity import androidx.core.view.MenuHost import androidx.core.view.MenuProvider import androidx.core.widget.NestedScrollView import androidx.fragment.app.Fragment import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver import androidx.lifecycle.lifecycleScope import androidx.navigation.NavController import androidx.navigation.NavDestination import androidx.navigation.NavOptions import androidx.navigation.findNavController import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.button.MaterialButton import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.textfield.TextInputEditText import com.google.gson.Gson import com.looper.android.support.util.DialogUtils import com.looper.android.support.util.PermissionUtils import com.looper.android.support.util.SharedPreferencesUtils import com.looper.android.support.util.SpeechUtils import com.looper.android.support.util.SystemServiceUtils import com.looper.vic.BuildConfig import com.looper.vic.MyApp import com.looper.vic.R import com.looper.vic.adapter.ChatAdapter import com.looper.vic.adapter.ChatFilesAdapter import com.looper.vic.model.Chat import com.looper.vic.model.ChatRequest import com.looper.vic.model.ChatResponse import com.looper.vic.model.ChatThread import com.looper.vic.util.ChatUtils import com.looper.vic.util.HashUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import okhttp3.CertificatePinner import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.OkHttpClient import okhttp3.Request import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.Response import okhttp3.sse.EventSource import okhttp3.sse.EventSourceListener import okhttp3.sse.EventSources import java.io.BufferedInputStream import java.io.File import java.net.SocketTimeoutException import java.security.KeyStore import java.security.MessageDigest import java.security.cert.CertificateFactory import java.security.cert.X509Certificate import java.util.concurrent.TimeUnit import javax.net.ssl.SSLContext import javax.net.ssl.TrustManagerFactory import javax.net.ssl.X509TrustManager class ChatFragment : Fragment(), NavController.OnDestinationChangedListener, MenuProvider { // Declare and initialize variables. private val fileSelector = registerForActivityResult(OpenMultipleDocuments()) { chatFilesAdapter.addFiles(it) } private val userCancelledResponse: String = MyApp.getAppContext()!!.getString(R.string.user_cancelled_response) private val networkErrorResponse: String = MyApp.getAppContext()!!.getString(R.string.network_error_response) private val unexpectedErrorResponse: String = MyApp.getAppContext()!!.getString(R.string.unexpected_error_response) private var chatId: Int = -1 private var toolType: String? = null private var fragmentMenu: Menu? = null private var apiRequestCall: EventSource? = null private lateinit var navController: NavController private lateinit var sharedPreferencesUtils: SharedPreferencesUtils private lateinit var speechUtils: SpeechUtils private lateinit var scrollViewNewChat: NestedScrollView private lateinit var recyclerView: RecyclerView private lateinit var recyclerViewLayoutManager: RecyclerView.LayoutManager private lateinit var recyclerViewFiles: RecyclerView private lateinit var queryInputBox: TextInputEditText private lateinit var querySendButton: MaterialButton private lateinit var queryStopButton: MaterialButton private lateinit var querySpeakButton: MaterialButton private lateinit var queryAddFilesButton: MaterialButton private lateinit var fabArrowDown: FloatingActionButton private lateinit var chatAdapter: ChatAdapter private lateinit var chatFilesAdapter: ChatFilesAdapter private lateinit var chatThread: ChatThread private lateinit var requestAudioPermission: () -> Unit override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { return inflater.inflate(R.layout.fragment_chat, container, false) } override fun onDestroyView() { navController.removeOnDestinationChangedListener(this) super.onDestroyView() } override fun onDestroy() { cancelApiRequest() speechUtils.destroy() if (chatAdapter.getThreadsOfChat().isNotEmpty()) { val thread = chatAdapter.getThreadsOfChat().last() cancelQuery(thread, userCancelledResponse) } super.onDestroy() } override fun onPause() { speechUtils.stopTextToSpeech() super.onPause() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Initialize variables. requestAudioPermission = PermissionUtils.requestPermission( activity = (requireActivity() as AppCompatActivity), context = requireContext(), permission = Manifest.permission.RECORD_AUDIO, onPermissionGranted = { getVoiceInput() } ) speechUtils = SpeechUtils(requireContext()) // Determine chat id. val cid = arguments?.getInt("chatId", -1) ?: -1 chatId = if (cid != -1) { cid } else { ChatUtils.generateNewChatId().also { // Put the generated chat id in the arguments to prevent chat resets from device changes. if (arguments == null) { arguments = Bundle() } arguments?.putInt("chatId", it) } } // Determine tool type. toolType = arguments?.getString("tool") if (toolType == null) { toolType = MyApp.chatDao().getToolType(chatId) } else { val chat = MyApp.chatDao().getChat(chatId) if (chat != null) { chat.tool = toolType MyApp.chatDao().updateChat(chat) } else { val newChat = Chat( chatId = chatId, chatTitle = "", tool = toolType, ) MyApp.chatDao().insertChat(newChat) } } // Initialize ChatAdapter. chatAdapter = ChatAdapter( activity as AppCompatActivity, chatId, speechUtils ) } override fun onContextItemSelected(item: MenuItem): Boolean { val position = item.intent!!.getIntExtra("position", -1) val viewId = item.intent!!.getIntExtra("viewId", -1) chatThread = chatAdapter.getCurrentThread(position) return when (item.itemId) { R.id.copy_clipboard -> { when (viewId) { R.id.layout_user -> { SystemServiceUtils.copyToClipboard( requireContext(), chatThread.userContent ) } R.id.layout_ai -> { SystemServiceUtils.copyToClipboard( requireContext(), chatThread.aiContent ) } } true } R.id.select_text -> { when (viewId) { R.id.layout_user -> { navController.navigate( R.id.fragment_select_text, Bundle().apply { putString("text", chatThread.userContent) }) } R.id.layout_ai -> { navController.navigate( R.id.fragment_select_text, Bundle().apply { putString("text", chatThread.aiContent) }) } } true } R.id.regenerate_response -> { cancelApiRequest() // Make the thread pending and clear previous AI response. chatThread.isPending = true chatThread.isCancelled = false chatThread.aiContent = "" MyApp.chatDao().updateThread(chatThread) chatAdapter.notifyItemChanged(chatAdapter.getThreadIndexById(chatThread.id)) // Show recycler view and scroll to the thread. scrollViewNewChat.visibility = View.GONE recyclerView.visibility = View.VISIBLE recyclerViewLayoutManager.scrollToPosition(chatAdapter.getThreadIndexById(chatThread.id)) // Show stop button. querySpeakButton.visibility = View.GONE querySendButton.visibility = View.INVISIBLE queryStopButton.visibility = View.VISIBLE // Process AI response. processAIResponse(chatThread) true } R.id.speak -> { speechUtils.speak(chatThread.aiContent) true } else -> super.onContextItemSelected(item) } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) // Setup MenuProvider. val menuHost: MenuHost = requireActivity() menuHost.addMenuProvider(this, viewLifecycleOwner, Lifecycle.State.RESUMED) // Set the chat title. ChatUtils.setChatTitle(activity as AppCompatActivity?, chatId, toolType, null) // Initialize variables. navController = view.findNavController() navController.addOnDestinationChangedListener(this) sharedPreferencesUtils = SharedPreferencesUtils(requireContext()) chatFilesAdapter = ChatFilesAdapter(requireContext()) scrollViewNewChat = view.findViewById(R.id.scroll_view_new_chat) recyclerView = view.findViewById(R.id.recycler_view_chat) recyclerViewFiles = view.findViewById(R.id.recycler_view_chat_files) queryInputBox = view.findViewById(R.id.edit_text_input_box) querySendButton = view.findViewById(R.id.button_send_query) queryStopButton = view.findViewById(R.id.button_stop_query) querySpeakButton = view.findViewById(R.id.button_speak) queryAddFilesButton = view.findViewById(R.id.button_add_files) fabArrowDown = view.findViewById(R.id.fab_arrow_down) // Set up RecyclerView. recyclerView.adapter = chatAdapter recyclerViewLayoutManager = LinearLayoutManager(context) recyclerView.layoutManager = recyclerViewLayoutManager recyclerView.addItemDecoration( DividerItemDecoration( context, DividerItemDecoration.VERTICAL ) ) recyclerViewFiles.adapter = chatFilesAdapter // Add scroll listener to show/hide arrow down FAB. recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { super.onScrolled(recyclerView, dx, dy) if (!recyclerView.canScrollVertically(1)) { // 1 for down direction. fabArrowDown.hide() } else { fabArrowDown.show() } } }) // Show stop button if there is a pending query. if (chatAdapter.getThreadsOfChat().isNotEmpty()) { if (chatAdapter.getThreadsOfChat().last().isPending) { querySpeakButton.visibility = View.GONE querySendButton.visibility = View.INVISIBLE queryStopButton.visibility = View.VISIBLE } } // Open the keyboard when the fragment starts. SystemServiceUtils.showKeyboard(queryInputBox, requireActivity()) // Set a text listener to hide/show speak button. queryInputBox.addTextChangedListener(object : TextWatcher { override fun afterTextChanged(s: Editable?) { querySpeakButton.visibility = if (s?.trim()?.isNotEmpty() == true) { View.GONE } else { View.VISIBLE } } override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {} }) querySendButton.setOnClickListener { processUserQuery(false) } queryStopButton.setOnClickListener { cancelQuery(chatThread, userCancelledResponse) } querySpeakButton.setOnClickListener { requestAudioPermission() } queryAddFilesButton.setOnClickListener { fileSelector.launch(arrayOf("*/*")) } fabArrowDown.setOnClickListener { val lastPosition = chatAdapter.itemCount - 1 if (lastPosition >= 0) { recyclerView.smoothScrollToPosition(lastPosition) } } } override fun onResume() { super.onResume() if (chatAdapter.hasConversation()) { // Show menu items. fragmentMenu?.findItem(R.id.new_chat)?.isVisible = true fragmentMenu?.findItem(R.id.edit_chat_title)?.isVisible = true fragmentMenu?.findItem(R.id.delete_chat)?.isVisible = true // Show recycler view. scrollViewNewChat.visibility = View.GONE recyclerView.visibility = View.VISIBLE // Set the chat title as it resets. ChatUtils.setChatTitle(activity as AppCompatActivity?, chatId, toolType, null) } if (toolType != null) { // Show menu items if there is a tool is selected. fragmentMenu?.findItem(R.id.new_chat)?.isVisible = true fragmentMenu?.findItem(R.id.edit_chat_title)?.isVisible = true fragmentMenu?.findItem(R.id.delete_chat)?.isVisible = true } } override fun onDestinationChanged( controller: NavController, destination: NavDestination, arguments: Bundle? ) { val handle = controller.currentBackStackEntry?.savedStateHandle val data = handle?.get<String?>("voice_text") ?: return handle.remove<String?>("voice_text") queryInputBox.setText(data) processUserQuery(true) } override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) { menuInflater.inflate(R.menu.fragment_chat_menu, menu) // Show menu items if there is a conversation or a tool is selected. if (chatAdapter.hasConversation() || toolType != null) { menu.findItem(R.id.new_chat)?.isVisible = true menu.findItem(R.id.edit_chat_title)?.isVisible = true menu.findItem(R.id.delete_chat)?.isVisible = true } // Store a reference for future use. fragmentMenu = menu } override fun onMenuItemSelected(menuItem: MenuItem): Boolean { return when (menuItem.itemId) { R.id.delete_chat -> { deleteConversation() true } R.id.edit_chat_title -> { displayEditChatTitleDialog() true } R.id.new_chat -> { newConversation() true } else -> false } } private fun processUserQuery(voice: Boolean) { // Get user query. val userQuery = queryInputBox.text.toString().trim() if (userQuery.isNotBlank()) { // Clear the input box. queryInputBox.text?.clear() // Hide keyboard. SystemServiceUtils.hideKeyboard(requireActivity()) // Show recycler view. scrollViewNewChat.visibility = View.GONE recyclerView.visibility = View.VISIBLE // Show stop button. querySpeakButton.visibility = View.GONE querySendButton.visibility = View.INVISIBLE queryStopButton.visibility = View.VISIBLE // Create a new ChatThread, add it to the ChatAdapter, and notify change. val thread = ChatThread( chatId = chatId, userContent = userQuery, aiContent = "", isPending = true, isVoiceInput = voice, ) chatAdapter.addThread(thread) chatThread = chatAdapter.getThreadsOfChat().last() // Scroll to the new thread. recyclerViewLayoutManager.scrollToPosition(chatAdapter.itemCount - 1) // Show menu items if there is a conversation. if (chatAdapter.hasConversation()) { fragmentMenu?.findItem(R.id.new_chat)?.isVisible = true fragmentMenu?.findItem(R.id.edit_chat_title)?.isVisible = true fragmentMenu?.findItem(R.id.delete_chat)?.isVisible = true } // Process AI response. processAIResponse(chatThread) } } private fun processAIResponse(thread: ChatThread) { // Initialize variables. val userQuery = thread.userContent val timestamp = System.currentTimeMillis() / 1000 val signatureHash = HashUtils.generateSignHash( userQuery.take(10), timestamp, BuildConfig.apiKey ) // Prepare local files. val fileNames: MutableList<String> = mutableListOf() val filesList: MutableList<Map<String, String>> = mutableListOf() val files: List<File> if (chatFilesAdapter.itemCount > 0) { files = chatFilesAdapter.saveFiles() for (file in files) { fileNames.add(file.name) val fileBytes = file.readBytes() val base64EncodedFileBytes = Base64.encodeToString(fileBytes, Base64.DEFAULT) filesList.add( mapOf( "filename" to file.name, "file_bytes" to base64EncodedFileBytes ) ) } chatFilesAdapter.clearUriList() } else { files = chatFilesAdapter.getFiles(thread) for (file in files) { fileNames.add(file.name) val fileBytes = file.readBytes() val base64EncodedFileBytes = Base64.encodeToString(fileBytes, Base64.DEFAULT) filesList.add( mapOf( "filename" to file.name, "file_bytes" to base64EncodedFileBytes ) ) } } // Update the thread with names of local files. if (fileNames.isNotEmpty()) { chatAdapter.updateThreadWithLocalFiles(thread, fileNames) } // Prepare request data. val jsonRequestData = ChatRequest( time = timestamp.toInt(), sign = signatureHash, query = userQuery, history = chatAdapter.getChatHistory(thread), persona = sharedPreferencesUtils.get("ai_persona", "assistant"), style = sharedPreferencesUtils.get("ai_style", "balanced"), web_search = sharedPreferencesUtils.get( "ai_web_search", false ), tool = toolType, custom_instructions = sharedPreferencesUtils.get( "pref_custom_instructions", "" ), stream = true, files = filesList ) // Prepare json. val json = Gson().toJson(jsonRequestData) // Get response from API. getAIResponse(json, thread) } private fun getAIResponse( json: String, thread: ChatThread ) { // Build okhttp client. val client = createCustomOkHttpClient(requireContext(), BuildConfig.apiBase) // Build request body. val requestBody = json.toRequestBody("application/json".toMediaTypeOrNull()) // Build request. val request = Request.Builder() .url("https://" + BuildConfig.apiBase + "/lumi-ai/v1/chat") .post(requestBody) .build() // Create EventSource listener. val eventSourceListener = object : EventSourceListener() { override fun onOpen(eventSource: EventSource, response: Response) { // No operation. } override fun onEvent( eventSource: EventSource, id: String?, type: String?, data: String ) { // Remove the b' and the trailing ' to get the actual byte representation in string form. val trimmedBase64String = data.removePrefix("b'").removeSuffix("'") // Decode the base64 string to bytes. val decodedBytes = Base64.decode(trimmedBase64String, Base64.DEFAULT) // Convert bytes to string using UTF-8 encoding. val decodedString = String(decodedBytes, Charsets.UTF_8) // Process the JSON data. val fixedLine = decodedString.replace("}{", "}\n{").split("\n") fixedLine.forEach { part -> try { val jsonData = Gson().fromJson(part, ChatResponse::class.java) activity?.runOnUiThread { // Update the thread with files. jsonData.files?.let { files -> chatAdapter.updateThreadWithAIFiles(thread, files) } // Update the thread with response part. jsonData.chunk?.let { chunk -> chatAdapter.updateThreadWithResponsePart(thread, chunk) } jsonData.title?.let { chunk -> activity?.runOnUiThread { // Set the chat title. ChatUtils.setChatTitle( activity as AppCompatActivity?, chatId, toolType, chunk ) } } } } catch (e: Exception) { activity?.runOnUiThread { cancelQuery(thread, unexpectedErrorResponse) } } } } override fun onClosed(eventSource: EventSource) { // Speak if it is a voice input. if (thread.isVoiceInput && !thread.isCancelled) { lifecycleScope.launch(Dispatchers.Main) { speechUtils.speak(thread.aiContent) } } // Hide stop button and show send button. activity?.runOnUiThread { querySpeakButton.visibility = View.VISIBLE querySendButton.visibility = View.VISIBLE queryStopButton.visibility = View.INVISIBLE } } override fun onFailure( eventSource: EventSource, t: Throwable?, response: Response? ) { activity?.runOnUiThread { when (t) { is SocketTimeoutException -> { cancelQuery(thread, networkErrorResponse) } else -> { cancelQuery(thread, unexpectedErrorResponse) } } } } } // Create EventSource. apiRequestCall = EventSources.createFactory(client).newEventSource(request, eventSourceListener) } private fun cancelQuery(thread: ChatThread, cancelResponse: String) { // Set pending to true if response is streaming. if (apiRequestCall != null) { thread.isPending = true } // Don't cancel when there's no pending query. if (!thread.isPending) { return } // Hide stop button and show send button. (querySpeakButton as MaterialButton?)?.visibility = View.VISIBLE (querySendButton as MaterialButton?)?.visibility = View.VISIBLE (queryStopButton as MaterialButton?)?.visibility = View.INVISIBLE // Cancel api request. cancelApiRequest() // Update conversation status. (chatAdapter as ChatAdapter?)?.cancelPendingQuery(thread, cancelResponse) // Set the chat title. ChatUtils.setChatTitle(activity as AppCompatActivity?, chatId, toolType, null) } private fun newConversation() { // Cancel pending query. if (chatAdapter.getThreadsOfChat().isNotEmpty()) { val thread = chatAdapter.getThreadsOfChat().last() chatAdapter.cancelPendingQuery(thread, userCancelledResponse) } // Change visibility of views accordingly. scrollViewNewChat.visibility = View.VISIBLE fabArrowDown.visibility = View.GONE recyclerView.visibility = View.GONE // Show a toast message. Toast.makeText( context, getString(R.string.chat_toast_new_conversation), Toast.LENGTH_SHORT ).show() // Navigate back to chat fragment. navController.navigate( R.id.fragment_chat, null, NavOptions.Builder() .setPopUpTo(R.id.fragment_chat, true) .build() ) } private fun deleteConversation() { // Don't delete conversation if there is no conversation already. if (chatAdapter.hasConversation()) { DialogUtils.displayActionConfirmDialog( context = requireContext(), title = getString(R.string.delete_chat), onPositiveAction = { // Cancel pending query. if (chatAdapter.getThreadsOfChat().isNotEmpty()) { val thread = chatAdapter.getThreadsOfChat().last() chatAdapter.cancelPendingQuery(thread, userCancelledResponse) } // Delete conversation. chatAdapter.deleteConversation() // Change visibility of views accordingly. scrollViewNewChat.visibility = View.VISIBLE fabArrowDown.visibility = View.GONE recyclerView.visibility = View.GONE // Show a toast message. Toast.makeText( context, getString(R.string.chat_toast_delete_conversation), Toast.LENGTH_SHORT ).show() // Navigate back to chat fragment. navController.navigate( R.id.fragment_chat, null, NavOptions.Builder() .setPopUpTo(R.id.fragment_chat, true) .build() ) } ) } else { // Show a toast message. Toast.makeText( context, getString(R.string.chat_toast_delete_conversation_not_found), Toast.LENGTH_SHORT ).show() } } private fun displayEditChatTitleDialog() { DialogUtils.displayEditTextDialog( context = requireContext(), title = getString(R.string.edit_chat_title), initialInput = ChatUtils.getChatTitle(chatId, false), onPositiveAction = { input -> // Set the new chat title. val newChatTitle = input.text.toString().trim() if (newChatTitle.isNotEmpty()) { ChatUtils.setChatTitle( activity as AppCompatActivity?, chatId, toolType, newChatTitle ) } } ) } private fun cancelApiRequest() { apiRequestCall?.cancel() apiRequestCall = null } private fun getVoiceInput() { // Create a VoiceInputFragment instance and show it. val voiceInputFragment = VoiceInputFragment() voiceInputFragment.show(parentFragmentManager, VoiceInputFragment.TAG) // Observe the lifecycle of the VoiceInputFragment. voiceInputFragment.lifecycle.addObserver(LifecycleEventObserver { _, event -> if (event == Lifecycle.Event.ON_DESTROY) { onDestinationChanged(navController, navController.currentDestination!!, null) } }) } private fun createCustomOkHttpClient(context: Context, hostname: String): OkHttpClient { val certificateInputStream = context.assets.open("cert.pem") // Create a KeyStore containing our trusted CAs val keyStoreType = KeyStore.getDefaultType() val keyStore = KeyStore.getInstance(keyStoreType).apply { load(null, null) } val certificate: X509Certificate certificateInputStream.use { certStream -> val certificateFactory = CertificateFactory.getInstance("X.509") certificate = certificateFactory.generateCertificate(BufferedInputStream(certStream)) as X509Certificate keyStore.setCertificateEntry("ca", certificate) } // Create a TrustManager that trusts the CAs in our KeyStore val tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm() val trustManagerFactory = TrustManagerFactory.getInstance(tmfAlgorithm).apply { init(keyStore) } // Create an SSLContext that uses our TrustManager val sslContext = SSLContext.getInstance("TLS").apply { init(null, trustManagerFactory.trustManagers, null) } // Generate the certificate pin val publicKey = certificate.publicKey.encoded val messageDigest = MessageDigest.getInstance("SHA-256") val publicKeyHash = messageDigest.digest(publicKey) val publicKeyBase64 = Base64.encodeToString(publicKeyHash, Base64.NO_WRAP) val pin = "sha256/$publicKeyBase64" // Create a CertificatePinner with the generated pin val certificatePinner = CertificatePinner.Builder() .add(hostname, pin) .build() return OkHttpClient.Builder() .connectTimeout(30, TimeUnit.SECONDS) .readTimeout(100, TimeUnit.SECONDS) .writeTimeout(100, TimeUnit.SECONDS) .sslSocketFactory(sslContext.socketFactory, trustManagerFactory.trustManagers[0] as X509TrustManager) .hostnameVerifier { serverHostname, _ -> serverHostname == hostname } .certificatePinner(certificatePinner) .build() } }
0
Kotlin
6
129
379d7143ed0e55bfb7fe5b6e83a7bf5177421898
32,339
Lumi-AI
MIT License
src/main/kotlin/day06/boats.kt
cdome
726,684,118
false
{"Kotlin": 17211}
package day06 import java.io.File import kotlin.math.ceil import kotlin.math.sqrt fun main() { races() singleRace() } private fun races() { val file = File("src/main/resources/day06-boats").readLines() val times = file[0].split(":")[1].trim().split(" ").filter { it.isNotBlank() }.map { it.toLong() } val distances = file[1].split(":")[1].trim().split(" ").filter { it.isNotBlank() }.map { it.toLong() } times.indices .map { possibilities(times[it], distances[it]) } .reduce(Int::times) .let { println("Multiple races possibilities: $it") } } private fun singleRace() { val file = File("src/main/resources/day06-boats").readLines() val time = file[0].split(":")[1].replace(" ", "").toLong() val distance = file[1].split(":")[1].replace(" ", "").toLong() println("Single race possibilities: ${possibilities(time, distance)}") } private fun possibilities(t: Long, d: Long): Int { val base = (t - sqrt(t * t - 4 * d.toDouble())) / 2 val lowerLimit = if (base == ceil(base)) base + 1 else ceil(base) return (t - 2 * lowerLimit + 1).toInt() }
0
Kotlin
0
0
459a6541af5839ce4437dba20019b7d75b626ecd
1,119
aoc23
The Unlicense
applovin/BIDApplovinInterstitial.kt
bidapphub
708,849,825
false
{"Kotlin": 165299, "Java": 14704}
package io.bidapp.networks.applovin import android.app.Activity import android.util.Log import com.applovin.adview.AppLovinInterstitialAd import com.applovin.adview.AppLovinInterstitialAdDialog import com.applovin.sdk.* import io.bidapp.sdk.BIDLog import io.bidapp.sdk.protocols.BIDFullscreenAdapterDelegateProtocol import io.bidapp.sdk.protocols.BIDFullscreenAdapterProtocol @PublishedApi internal class BIDApplovinInterstitial( val adapter: BIDFullscreenAdapterProtocol? = null, val adTag: String? = null ) : BIDFullscreenAdapterDelegateProtocol { val TAG = "interstitial Applovin" private var currentAd: AppLovinAd? = null var sdk: AppLovinSdk? = null var interstitialAdDialog: AppLovinInterstitialAdDialog? = null private val appLovinAdLoadListener = object : AppLovinAdLoadListener { override fun adReceived(p0: AppLovinAd?) { BIDLog.d(TAG, "adReceived") currentAd = p0 adapter?.onAdLoaded() } override fun failedToReceiveAd(p0: Int) { BIDLog.d(TAG, "failedToReceiveAd errorCode $p0") adapter?.onAdFailedToLoadWithError("Error Failed To ReceiveAd : $p0") } } private val appLovinAdDisplayListener = object : AppLovinAdDisplayListener { override fun adDisplayed(p0: AppLovinAd?) { BIDLog.d(TAG, "adDisplayed") adapter?.onDisplay() } override fun adHidden(p0: AppLovinAd?) { BIDLog.d(TAG, "adHidden") adapter?.onHide() } } private val appLovinAdClickListener = object : AppLovinAdClickListener { override fun adClicked(p0: AppLovinAd?) { BIDLog.d(TAG, "adClicked") adapter?.onClick() } } private val appLovinAdVideoPlaybackListener = object : AppLovinAdVideoPlaybackListener { override fun videoPlaybackBegan(p0: AppLovinAd?) { BIDLog.d(TAG, "adClicked video playback began") } override fun videoPlaybackEnded(p0: AppLovinAd?, p1: Double, p2: Boolean) { BIDLog.d(TAG, "video play back endedad") } } fun init() { interstitialAdDialog?.setAdDisplayListener(appLovinAdDisplayListener) interstitialAdDialog?.setAdClickListener(appLovinAdClickListener) interstitialAdDialog?.setAdVideoPlaybackListener(appLovinAdVideoPlaybackListener) } override fun load(activity: Activity) { val load = runCatching { if (interstitialAdDialog == null) { sdk = AppLovinSdk.getInstance(activity) interstitialAdDialog = AppLovinInterstitialAd.create(sdk, activity) init() } AppLovinSdk.getInstance(activity).adService.loadNextAd( AppLovinAdSize.INTERSTITIAL, appLovinAdLoadListener ) } if (load.isFailure) adapter?.onAdFailedToLoadWithError("Error Failed To ReceiveAd") } override fun show(activity: Activity?) { BIDLog.d(TAG, "show") currentAd?.let { interstitialAdDialog?.showAndRender(it) } } override fun activityNeededForShow(): Boolean { return false } override fun readyToShow(): Boolean { return currentAd != null } override fun shouldWaitForAdToDisplay(): Boolean { return true } }
0
Kotlin
1
2
cdbb828a832e393c5e9fe2f6c1cf3dc12435237e
3,397
bidapp-ads-android
Apache License 2.0
sample/src/main/java/com/rbrooks/indefinitepagerindicatorsample/viewPagerSample/ViewPagerSampleFragment.kt
sagar-forks
123,182,756
false
null
package com.rbrooks.indefinitepagerindicatorsample.viewPagerSample import android.os.Bundle import android.support.v4.app.Fragment import android.support.v4.view.ViewPager import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import com.rbrooks.indefinitepagerindicator.IndefinitePagerIndicator import com.rbrooks.indefinitepagerindicatorsample.R import com.rbrooks.indefinitepagerindicatorsample.util.OnPagerNumberChangeListener class ViewPagerSampleFragment : Fragment(), OnPagerNumberChangeListener, View.OnClickListener { private lateinit var viewPager: ViewPager private lateinit var pagerIndicator: IndefinitePagerIndicator private lateinit var previousButton: Button private lateinit var nextButton: Button private var pagerAdapter: ViewPagerAdapter? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val view = inflater.inflate(R.layout.fragment_view_pager_sample, container, false) bindViews(view) setupViews() return view } private fun bindViews(view: View) { viewPager = view.findViewById(R.id.viewpager) pagerIndicator = view.findViewById(R.id.viewpager_pager_indicator) previousButton = view.findViewById(R.id.viewpager_previous_button) nextButton = view.findViewById(R.id.viewpager_next_button) } private fun setupViews() { pagerAdapter = ViewPagerAdapter(context) viewPager.adapter = pagerAdapter pagerIndicator.attachToViewPager(viewPager) previousButton.setOnClickListener(this) nextButton.setOnClickListener(this) } override fun onPagerNumberChanged() { pagerAdapter?.notifyDataSetChanged() } override fun onClick(v: View?) { when (v?.id) { R.id.viewpager_previous_button -> { if (viewPager.currentItem == 0) { viewPager.currentItem = viewPager.adapter.count - 1 } else { viewPager.currentItem = viewPager.currentItem - 1 } } R.id.viewpager_next_button -> { if (viewPager.currentItem == viewPager.adapter.count - 1) { viewPager.currentItem = 0 } else { viewPager.currentItem = viewPager.currentItem + 1 } } } } }
0
Kotlin
0
0
d30593b9c6d67bb4b734d68385ab7bb02c0796f7
2,489
Android-Indefinite-Pager-Indicator
MIT License
app/src/main/java/com/gmail/uli153/rickmortyandulises/domain/models/EpisodeModel.kt
ulisescervera
650,700,267
false
null
package com.gmail.uli153.rickmortyandulises.domain.models data class EpisodeModel( val id: Long, val name: String, val date: String, val characters: List<Long> )
0
Kotlin
0
0
220685ee51ae3741b9be5bf5c240034bbbc50001
178
rickmortyandulises
MIT License
src/main/kotlin/com/github/googee/laravelbuilder/file/FileManager.kt
GooGee
521,073,094
false
{"Kotlin": 25065}
package com.github.googee.laravelbuilder.file import com.google.common.io.CharStreams import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager import java.io.File import java.io.FileInputStream import java.io.InputStreamReader import java.io.PrintWriter import java.nio.file.Files import java.nio.file.Paths class FileManager(val project: Project) { companion object { const val FolderName = "laravel-builder" fun getFullPath(file: String, project: Project): String { return project.basePath + File.separator + file } fun getVF(file: String): VirtualFile? { return VirtualFileManager.getInstance().refreshAndFindFileByNioPath(Paths.get(file)) } fun isFile(file: String): Boolean { return File(file).isFile } fun makeFolder(file: String) { val path = Paths.get(file) Files.createDirectories(path.parent) } fun move(file: String, destination: String) { val old = File(file) val new = File(destination) makeFolder(destination) old.renameTo(new) } fun read(file: String): String { val stream = FileInputStream(file) return read(stream) } fun read(file: File): String { val stream = FileInputStream(file) return read(stream) } fun read(stream: FileInputStream): String { val reader = InputStreamReader(stream, "UTF-8") return CharStreams.toString(reader) } fun write(file: String, text: String) { val path = Paths.get(file) Files.createDirectories(path.parent) val writer = PrintWriter(path.toString()) writer.print(text) writer.flush() writer.close() LocalFileSystem.getInstance().refreshAndFindFileByPath(file) } fun refresh() { println("-- refresh --") LocalFileSystem.getInstance().refresh(true) } } fun getFullPath(file: String): String { return project.basePath + File.separator + file } fun getBuilderFile(file: String): String { return getFullPath(FolderName + File.separator + file) } }
0
Kotlin
0
2
871337f78a4a951ba1173032a27cb60b5ed8b06b
2,433
LaravelBuilder
Apache License 2.0
app/src/main/java/ly/android/material/code/tool/net/pojo/response/AliIconBean.kt
lumyuan
594,634,627
false
null
package ly.android.material.code.tool.net.pojo.response data class AliIconBean( val code: Int, val data: Maps? ) data class Maps( val icons: List<Icon>, val count: Int ) data class Icon( val id: Int, val name: String, val status: Int, val is_private: Int, val category_id: String, val slug: String, val unicode: String, val width: Int, val height: Int, val defs: String?, val path_attributes: String?, val fills: Int, val font_class: String, val user_id: Int, val repositorie_id: String, val created_at: String, val updated_at: String, val svg_hash: String, val svg_fill_hash: String, val fork_from: String?, val deleted_at: String?, val show_svg: String? )
1
Kotlin
0
15
0bd03e3b7ddd05591222db8ada5c9b9a7619a908
764
MaterialCodeTool
Apache License 2.0
korge/src/commonMain/kotlin/com/soywiz/korge3d/Skeleton3D.kt
korlibs
80,095,683
false
null
package com.soywiz.korge3d import com.soywiz.korge3d.internal.* import com.soywiz.korma.geom.* @Korge3DExperimental open class Joint3D constructor( val jid: String, val jname: String, val jsid: String, val jointParent: Joint3D? = null, initialMatrix: Matrix3D ) : Container3D() { init { this.transform.setMatrix(initialMatrix) this.name = jname this.id = jid if (jointParent != null) { this.parent = jointParent } } val poseMatrix = this.transform.globalMatrix.clone() val poseMatrixInv = poseMatrix.clone().invert() val childJoints = arrayListOf<Joint3D>() val descendants: List<Joint3D> get() = childJoints.flatMap { it.descendantsAndThis } val descendantsAndThis: List<Joint3D> get() = listOf(this) + descendants //val jointTransform = Transform3D() override fun render(ctx: RenderContext3D) { } override fun toString(): String = "Joint3D(id=$jid, name=$name, sid=$jsid)" } @Korge3DExperimental data class Bone3D constructor( val index: Int, val name: String, val invBindMatrix: Matrix3D ) @Korge3DExperimental data class Skin3D(val bindShapeMatrix: Matrix3D, val bones: List<Bone3D>) { val bindShapeMatrixInv = bindShapeMatrix.clone().invert() val matrices = Array(bones.size) { Matrix3D() } } @Korge3DExperimental class Skeleton3D(val skin: Skin3D, val headJoint: Joint3D) : View3D() { val allJoints = headJoint.descendantsAndThis val jointsByName = allJoints.associateBy { it.jname }.toFast() val jointsBySid = allJoints.associateBy { it.jsid }.toFast() override fun render(ctx: RenderContext3D) { } }
102
null
64
1,192
7fa8c9981d09c2ac3727799f3925363f1af82f45
1,560
korge
Apache License 2.0
kt/godot-library/src/main/kotlin/godot/gen/godot/RenderingServer.kt
utopia-rise
289,462,532
false
null
// 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.AABB import godot.core.Basis import godot.core.Callable import godot.core.Color import godot.core.Dictionary import godot.core.PackedByteArray import godot.core.PackedColorArray import godot.core.PackedFloat32Array import godot.core.PackedInt32Array import godot.core.PackedInt64Array import godot.core.PackedVector2Array import godot.core.PackedVector3Array import godot.core.Plane import godot.core.RID import godot.core.Rect2 import godot.core.StringName import godot.core.Transform2D import godot.core.Transform3D import godot.core.TypeManager import godot.core.VariantArray import godot.core.VariantType.ANY import godot.core.VariantType.ARRAY import godot.core.VariantType.BASIS import godot.core.VariantType.BOOL import godot.core.VariantType.CALLABLE import godot.core.VariantType.COLOR import godot.core.VariantType.DICTIONARY import godot.core.VariantType.DOUBLE import godot.core.VariantType.LONG import godot.core.VariantType.NIL import godot.core.VariantType.OBJECT import godot.core.VariantType.PACKED_BYTE_ARRAY import godot.core.VariantType.PACKED_COLOR_ARRAY import godot.core.VariantType.PACKED_FLOAT_32_ARRAY import godot.core.VariantType.PACKED_INT_32_ARRAY import godot.core.VariantType.PACKED_INT_64_ARRAY import godot.core.VariantType.PACKED_VECTOR2_ARRAY import godot.core.VariantType.PACKED_VECTOR3_ARRAY import godot.core.VariantType.RECT2 import godot.core.VariantType.STRING import godot.core.VariantType.STRING_NAME import godot.core.VariantType.TRANSFORM2D import godot.core.VariantType.TRANSFORM3D import godot.core.VariantType.VECTOR2 import godot.core.VariantType.VECTOR2I import godot.core.VariantType.VECTOR3 import godot.core.VariantType.VECTOR3I import godot.core.VariantType._RID import godot.core.Vector2 import godot.core.Vector2i import godot.core.Vector3 import godot.core.Vector3i import godot.core.memory.TransferContext import godot.signals.Signal0 import godot.signals.signal import godot.util.VoidPtr import kotlin.Any import kotlin.Boolean import kotlin.Double import kotlin.Float import kotlin.Int import kotlin.Long import kotlin.String import kotlin.Suppress import kotlin.Unit import kotlin.jvm.JvmInline import kotlin.jvm.JvmOverloads /** * The rendering server is the API backend for everything visible. The whole scene system mounts on * it to display. The rendering server is completely opaque: the internals are entirely * implementation-specific and cannot be accessed. * The rendering server can be used to bypass the scene/[Node] system entirely. This can improve * performance in cases where the scene system is the bottleneck, but won't improve performance * otherwise (for instance, if the GPU is already fully utilized). * Resources are created using the `*_create` functions. These functions return [RID]s which are not * references to the objects themselves, but opaque *pointers* towards these objects. * All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or * you can create one yourself with [viewportCreate]. When using a custom scenario or canvas, the * scenario or canvas needs to be attached to the viewport using [viewportSetScenario] or * [viewportAttachCanvas]. * **Scenarios:** In 3D, all visual objects must be associated with a scenario. The scenario is a * visual representation of the world. If accessing the rendering server from a running game, the * scenario can be accessed from the scene tree from any [Node3D] node with [Node3D.getWorld3d]. * Otherwise, a scenario can be created with [scenarioCreate]. * Similarly, in 2D, a canvas is needed to draw all canvas items. * **3D:** In 3D, all visible objects are comprised of a resource and an instance. A resource can be * a mesh, a particle system, a light, or any other 3D object. In order to be visible resources must be * attached to an instance using [instanceSetBase]. The instance must also be attached to the scenario * using [instanceSetScenario] in order to be visible. RenderingServer methods that don't have a prefix * are usually 3D-specific (but not always). * **2D:** In 2D, all visible objects are some form of canvas item. In order to be visible, a canvas * item needs to be the child of a canvas attached to a viewport, or it needs to be the child of * another canvas item that is eventually attached to the canvas. 2D-specific RenderingServer methods * generally start with `canvas_*`. * **Headless mode:** Starting the engine with the `--headless` * [url=$DOCS_URL/tutorials/editor/command_line_tutorial.html]command line argument[/url] disables all * rendering and window management functions. Most functions from [RenderingServer] will return dummy * values in this case. */ @GodotBaseType public object RenderingServer : Object() { /** * Marks an error that shows that the index array is empty. */ public final const val NO_INDEX_ARRAY: Long = -1 /** * Number of weights/bones per vertex. */ public final const val ARRAY_WEIGHTS_SIZE: Long = 4 /** * The minimum Z-layer for canvas items. */ public final const val CANVAS_ITEM_Z_MIN: Long = -4096 /** * The maximum Z-layer for canvas items. */ public final const val CANVAS_ITEM_Z_MAX: Long = 4096 /** * The maximum number of glow levels that can be used with the glow post-processing effect. */ public final const val MAX_GLOW_LEVELS: Long = 7 /** * *Deprecated.* This constant is unused internally. */ public final const val MAX_CURSORS: Long = 8 /** * The maximum number of directional lights that can be rendered at a given time in 2D. */ public final const val MAX_2D_DIRECTIONAL_LIGHTS: Long = 8 /** * The minimum renderpriority of all materials. */ public final const val MATERIAL_RENDER_PRIORITY_MIN: Long = -128 /** * The maximum renderpriority of all materials. */ public final const val MATERIAL_RENDER_PRIORITY_MAX: Long = 127 /** * The number of custom data arrays available ([ARRAY_CUSTOM0], [ARRAY_CUSTOM1], [ARRAY_CUSTOM2], * [ARRAY_CUSTOM3]). */ public final const val ARRAY_CUSTOM_COUNT: Long = 4 public final const val PARTICLES_EMIT_FLAG_POSITION: Long = 1 public final const val PARTICLES_EMIT_FLAG_ROTATION_SCALE: Long = 2 public final const val PARTICLES_EMIT_FLAG_VELOCITY: Long = 4 public final const val PARTICLES_EMIT_FLAG_COLOR: Long = 8 public final const val PARTICLES_EMIT_FLAG_CUSTOM: Long = 16 /** * Emitted at the beginning of the frame, before the RenderingServer updates all the Viewports. */ public val framePreDraw: Signal0 by signal() /** * Emitted at the end of the frame, after the RenderingServer has finished updating all the * Viewports. */ public val framePostDraw: Signal0 by signal() public override fun new(scriptIndex: Int): Boolean { getSingleton(ENGINECLASS_RENDERINGSERVER) return false } /** * Creates a 2-dimensional texture and adds it to the RenderingServer. It can be accessed with the * RID that is returned. This RID will be used in all `texture_2d_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [Texture2D]. * **Note:** Not to be confused with [RenderingDevice.textureCreate], which creates the graphics * API's own texture type as opposed to the Godot-specific [Texture2D] resource. */ public fun texture2dCreate(image: Image): RID { TransferContext.writeArguments(OBJECT to image) TransferContext.callMethod(rawPtr, MethodBindings.texture2dCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a 2-dimensional layered texture and adds it to the RenderingServer. It can be accessed * with the RID that is returned. This RID will be used in all `texture_2d_layered_*` RenderingServer * functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [TextureLayered]. */ public fun texture2dLayeredCreate(layers: VariantArray<Image>, layeredType: TextureLayeredType): RID { TransferContext.writeArguments(ARRAY to layers, LONG to layeredType.id) TransferContext.callMethod(rawPtr, MethodBindings.texture2dLayeredCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * **Note:** The equivalent resource is [Texture3D]. */ public fun texture3dCreate( format: Image.Format, width: Int, height: Int, depth: Int, mipmaps: Boolean, `data`: VariantArray<Image>, ): RID { TransferContext.writeArguments(LONG to format.id, LONG to width.toLong(), LONG to height.toLong(), LONG to depth.toLong(), BOOL to mipmaps, ARRAY to data) TransferContext.callMethod(rawPtr, MethodBindings.texture3dCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * *Deprecated.* ProxyTexture was removed in Godot 4, so this method does nothing when called and * always returns a null [RID]. */ public fun textureProxyCreate(base: RID): RID { TransferContext.writeArguments(_RID to base) TransferContext.callMethod(rawPtr, MethodBindings.textureProxyCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Updates the texture specified by the [texture] [RID] with the data in [image]. A [layer] must * also be specified, which should be `0` when updating a single-layer texture ([Texture2D]). * **Note:** The [image] must have the same width, height and format as the current [texture] * data. Otherwise, an error will be printed and the original texture won't be modified. If you need * to use different width, height or format, use [textureReplace] instead. */ public fun texture2dUpdate( texture: RID, image: Image, layer: Int, ): Unit { TransferContext.writeArguments(_RID to texture, OBJECT to image, LONG to layer.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.texture2dUpdatePtr, NIL) } /** * Updates the texture specified by the [texture] [RID]'s data with the data in [data]. All the * texture's layers must be replaced at once. * **Note:** The [texture] must have the same width, height, depth and format as the current * texture data. Otherwise, an error will be printed and the original texture won't be modified. If * you need to use different width, height, depth or format, use [textureReplace] instead. */ public fun texture3dUpdate(texture: RID, `data`: VariantArray<Image>): Unit { TransferContext.writeArguments(_RID to texture, ARRAY to data) TransferContext.callMethod(rawPtr, MethodBindings.texture3dUpdatePtr, NIL) } /** * *Deprecated.* ProxyTexture was removed in Godot 4, so this method cannot be used anymore. */ public fun textureProxyUpdate(texture: RID, proxyTo: RID): Unit { TransferContext.writeArguments(_RID to texture, _RID to proxyTo) TransferContext.callMethod(rawPtr, MethodBindings.textureProxyUpdatePtr, NIL) } /** * Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. * It can be accessed with the RID that is returned. This RID will be used in all * `texture_2d_layered_*` RenderingServer functions, although it does nothing when used. See also * [texture2dLayeredPlaceholderCreate] * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [PlaceholderTexture2D]. */ public fun texture2dPlaceholderCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.texture2dPlaceholderCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a placeholder for a 2-dimensional layered texture and adds it to the RenderingServer. * It can be accessed with the RID that is returned. This RID will be used in all * `texture_2d_layered_*` RenderingServer functions, although it does nothing when used. See also * [texture2dPlaceholderCreate]. * **Note:** The equivalent resource is [PlaceholderTextureLayered]. */ public fun texture2dLayeredPlaceholderCreate(layeredType: TextureLayeredType): RID { TransferContext.writeArguments(LONG to layeredType.id) TransferContext.callMethod(rawPtr, MethodBindings.texture2dLayeredPlaceholderCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a placeholder for a 3-dimensional texture and adds it to the RenderingServer. It can be * accessed with the RID that is returned. This RID will be used in all `texture_3d_*` * RenderingServer functions, although it does nothing when used. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [PlaceholderTexture3D]. */ public fun texture3dPlaceholderCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.texture3dPlaceholderCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns an [Image] instance from the given [texture] [RID]. * Example of getting the test texture from [getTestTexture] and applying it to a [Sprite2D] node: * [codeblock] * var texture_rid = RenderingServer.get_test_texture() * var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid)) * $Sprite2D.texture = texture * [/codeblock] */ public fun texture2dGet(texture: RID): Image? { TransferContext.writeArguments(_RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.texture2dGetPtr, OBJECT) return (TransferContext.readReturnValue(OBJECT, true) as Image?) } /** * Returns an [Image] instance from the given [texture] [RID] and [layer]. */ public fun texture2dLayerGet(texture: RID, layer: Int): Image? { TransferContext.writeArguments(_RID to texture, LONG to layer.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.texture2dLayerGetPtr, OBJECT) return (TransferContext.readReturnValue(OBJECT, true) as Image?) } /** * Returns 3D texture data as an array of [Image]s for the specified texture [RID]. */ public fun texture3dGet(texture: RID): VariantArray<Image> { TransferContext.writeArguments(_RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.texture3dGetPtr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<Image>) } /** * Replaces [texture]'s texture data by the texture specified by the [byTexture] RID, without * changing [texture]'s RID. */ public fun textureReplace(texture: RID, byTexture: RID): Unit { TransferContext.writeArguments(_RID to texture, _RID to byTexture) TransferContext.callMethod(rawPtr, MethodBindings.textureReplacePtr, NIL) } public fun textureSetSizeOverride( texture: RID, width: Int, height: Int, ): Unit { TransferContext.writeArguments(_RID to texture, LONG to width.toLong(), LONG to height.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.textureSetSizeOverridePtr, NIL) } public fun textureSetPath(texture: RID, path: String): Unit { TransferContext.writeArguments(_RID to texture, STRING to path) TransferContext.callMethod(rawPtr, MethodBindings.textureSetPathPtr, NIL) } public fun textureGetPath(texture: RID): String { TransferContext.writeArguments(_RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.textureGetPathPtr, STRING) return (TransferContext.readReturnValue(STRING, false) as String) } /** * Returns the [Image.Format] for the texture. */ public fun textureGetFormat(texture: RID): Image.Format { TransferContext.writeArguments(_RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.textureGetFormatPtr, LONG) return Image.Format.from(TransferContext.readReturnValue(LONG) as Long) } public fun textureSetForceRedrawIfVisible(texture: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to texture, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.textureSetForceRedrawIfVisiblePtr, NIL) } /** * Creates a new texture object based on a texture created directly on the [RenderingDevice]. If * the texture contains layers, [layerType] is used to define the layer type. */ @JvmOverloads public fun textureRdCreate(rdTexture: RID, layerType: TextureLayeredType = RenderingServer.TextureLayeredType.TEXTURE_LAYERED_2D_ARRAY): RID { TransferContext.writeArguments(_RID to rdTexture, LONG to layerType.id) TransferContext.callMethod(rawPtr, MethodBindings.textureRdCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns a texture [RID] that can be used with [RenderingDevice]. */ @JvmOverloads public fun textureGetRdTexture(texture: RID, srgb: Boolean = false): RID { TransferContext.writeArguments(_RID to texture, BOOL to srgb) TransferContext.callMethod(rawPtr, MethodBindings.textureGetRdTexturePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns the internal graphics handle for this texture object. For use when communicating with * third-party APIs mostly with GDExtension. * **Note:** This function returns a `uint64_t` which internally maps to a `GLuint` (OpenGL) or * `VkImage` (Vulkan). */ @JvmOverloads public fun textureGetNativeHandle(texture: RID, srgb: Boolean = false): Long { TransferContext.writeArguments(_RID to texture, BOOL to srgb) TransferContext.callMethod(rawPtr, MethodBindings.textureGetNativeHandlePtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } /** * Creates an empty shader and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `shader_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [Shader]. */ public fun shaderCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.shaderCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the shader's source code (which triggers recompilation after being changed). */ public fun shaderSetCode(shader: RID, code: String): Unit { TransferContext.writeArguments(_RID to shader, STRING to code) TransferContext.callMethod(rawPtr, MethodBindings.shaderSetCodePtr, NIL) } /** * Sets the path hint for the specified shader. This should generally match the [Shader] * resource's [Resource.resourcePath]. */ public fun shaderSetPathHint(shader: RID, path: String): Unit { TransferContext.writeArguments(_RID to shader, STRING to path) TransferContext.callMethod(rawPtr, MethodBindings.shaderSetPathHintPtr, NIL) } /** * Returns a shader's source code as a string. */ public fun shaderGetCode(shader: RID): String { TransferContext.writeArguments(_RID to shader) TransferContext.callMethod(rawPtr, MethodBindings.shaderGetCodePtr, STRING) return (TransferContext.readReturnValue(STRING, false) as String) } /** * Returns the parameters of a shader. */ public fun getShaderParameterList(shader: RID): VariantArray<Dictionary<Any?, Any?>> { TransferContext.writeArguments(_RID to shader) TransferContext.callMethod(rawPtr, MethodBindings.getShaderParameterListPtr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<Dictionary<Any?, Any?>>) } /** * Returns the default value for the specified shader uniform. This is usually the value written * in the shader source code. */ public fun shaderGetParameterDefault(shader: RID, name: StringName): Any? { TransferContext.writeArguments(_RID to shader, STRING_NAME to name) TransferContext.callMethod(rawPtr, MethodBindings.shaderGetParameterDefaultPtr, ANY) return (TransferContext.readReturnValue(ANY, true) as Any?) } /** * Sets a shader's default texture. Overwrites the texture given by name. * **Note:** If the sampler array is used use [index] to access the specified texture. */ @JvmOverloads public fun shaderSetDefaultTextureParameter( shader: RID, name: StringName, texture: RID, index: Int = 0, ): Unit { TransferContext.writeArguments(_RID to shader, STRING_NAME to name, _RID to texture, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.shaderSetDefaultTextureParameterPtr, NIL) } /** * Returns a default texture from a shader searched by name. * **Note:** If the sampler array is used use [index] to access the specified texture. */ @JvmOverloads public fun shaderGetDefaultTextureParameter( shader: RID, name: StringName, index: Int = 0, ): RID { TransferContext.writeArguments(_RID to shader, STRING_NAME to name, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.shaderGetDefaultTextureParameterPtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates an empty material and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `material_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [Material]. */ public fun materialCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.materialCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets a shader material's shader. */ public fun materialSetShader(shaderMaterial: RID, shader: RID): Unit { TransferContext.writeArguments(_RID to shaderMaterial, _RID to shader) TransferContext.callMethod(rawPtr, MethodBindings.materialSetShaderPtr, NIL) } /** * Sets a material's parameter. */ public fun materialSetParam( material: RID, parameter: StringName, `value`: Any?, ): Unit { TransferContext.writeArguments(_RID to material, STRING_NAME to parameter, ANY to value) TransferContext.callMethod(rawPtr, MethodBindings.materialSetParamPtr, NIL) } /** * Returns the value of a certain material's parameter. */ public fun materialGetParam(material: RID, parameter: StringName): Any? { TransferContext.writeArguments(_RID to material, STRING_NAME to parameter) TransferContext.callMethod(rawPtr, MethodBindings.materialGetParamPtr, ANY) return (TransferContext.readReturnValue(ANY, true) as Any?) } /** * Sets a material's render priority. */ public fun materialSetRenderPriority(material: RID, priority: Int): Unit { TransferContext.writeArguments(_RID to material, LONG to priority.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.materialSetRenderPriorityPtr, NIL) } /** * Sets an object's next material. */ public fun materialSetNextPass(material: RID, nextMaterial: RID): Unit { TransferContext.writeArguments(_RID to material, _RID to nextMaterial) TransferContext.callMethod(rawPtr, MethodBindings.materialSetNextPassPtr, NIL) } @JvmOverloads public fun meshCreateFromSurfaces(surfaces: VariantArray<Dictionary<Any?, Any?>>, blendShapeCount: Int = 0): RID { TransferContext.writeArguments(ARRAY to surfaces, LONG to blendShapeCount.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshCreateFromSurfacesPtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a new mesh and adds it to the RenderingServer. It can be accessed with the RID that is * returned. This RID will be used in all `mesh_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this mesh to an instance using [instanceSetBase] using the returned * RID. * **Note:** The equivalent resource is [Mesh]. */ public fun meshCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.meshCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns the offset of a given attribute by [arrayIndex] in the start of its respective buffer. */ public fun meshSurfaceGetFormatOffset( format: ArrayFormat, vertexCount: Int, arrayIndex: Int, ): Long { TransferContext.writeArguments(LONG to format.flag, LONG to vertexCount.toLong(), LONG to arrayIndex.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetFormatOffsetPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } /** * Returns the stride of the vertex positions for a mesh with given [format]. Note importantly * that vertex positions are stored consecutively and are not interleaved with the other attributes * in the vertex buffer (normals and tangents). */ public fun meshSurfaceGetFormatVertexStride(format: ArrayFormat, vertexCount: Int): Long { TransferContext.writeArguments(LONG to format.flag, LONG to vertexCount.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetFormatVertexStridePtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } /** * Returns the stride of the combined normals and tangents for a mesh with given [format]. Note * importantly that, while normals and tangents are in the vertex buffer with vertices, they are only * interleaved with each other and so have a different stride than vertex positions. */ public fun meshSurfaceGetFormatNormalTangentStride(format: ArrayFormat, vertexCount: Int): Long { TransferContext.writeArguments(LONG to format.flag, LONG to vertexCount.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetFormatNormalTangentStridePtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } /** * Returns the stride of the attribute buffer for a mesh with given [format]. */ public fun meshSurfaceGetFormatAttributeStride(format: ArrayFormat, vertexCount: Int): Long { TransferContext.writeArguments(LONG to format.flag, LONG to vertexCount.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetFormatAttributeStridePtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } /** * Returns the stride of the skin buffer for a mesh with given [format]. */ public fun meshSurfaceGetFormatSkinStride(format: ArrayFormat, vertexCount: Int): Long { TransferContext.writeArguments(LONG to format.flag, LONG to vertexCount.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetFormatSkinStridePtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } public fun meshAddSurface(mesh: RID, surface: Dictionary<Any?, Any?>): Unit { TransferContext.writeArguments(_RID to mesh, DICTIONARY to surface) TransferContext.callMethod(rawPtr, MethodBindings.meshAddSurfacePtr, NIL) } @JvmOverloads public fun meshAddSurfaceFromArrays( mesh: RID, primitive: PrimitiveType, arrays: VariantArray<Any?>, blendShapes: VariantArray<Any?> = godot.core.variantArrayOf(), lods: Dictionary<Any?, Any?> = Dictionary(), compressFormat: ArrayFormat = RenderingServer.ArrayFormat.ARRAY_FLAG_FORMAT_VERSION_1, ): Unit { TransferContext.writeArguments(_RID to mesh, LONG to primitive.id, ARRAY to arrays, ARRAY to blendShapes, DICTIONARY to lods, LONG to compressFormat.flag) TransferContext.callMethod(rawPtr, MethodBindings.meshAddSurfaceFromArraysPtr, NIL) } /** * Returns a mesh's blend shape count. */ public fun meshGetBlendShapeCount(mesh: RID): Int { TransferContext.writeArguments(_RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.meshGetBlendShapeCountPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long).toInt() } /** * Sets a mesh's blend shape mode. */ public fun meshSetBlendShapeMode(mesh: RID, mode: BlendShapeMode): Unit { TransferContext.writeArguments(_RID to mesh, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.meshSetBlendShapeModePtr, NIL) } /** * Returns a mesh's blend shape mode. */ public fun meshGetBlendShapeMode(mesh: RID): BlendShapeMode { TransferContext.writeArguments(_RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.meshGetBlendShapeModePtr, LONG) return RenderingServer.BlendShapeMode.from(TransferContext.readReturnValue(LONG) as Long) } /** * Sets a mesh's surface's material. */ public fun meshSurfaceSetMaterial( mesh: RID, surface: Int, material: RID, ): Unit { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong(), _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceSetMaterialPtr, NIL) } /** * Returns a mesh's surface's material. */ public fun meshSurfaceGetMaterial(mesh: RID, surface: Int): RID { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetMaterialPtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } public fun meshGetSurface(mesh: RID, surface: Int): Dictionary<Any?, Any?> { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshGetSurfacePtr, DICTIONARY) return (TransferContext.readReturnValue(DICTIONARY, false) as Dictionary<Any?, Any?>) } /** * Returns a mesh's surface's buffer arrays. */ public fun meshSurfaceGetArrays(mesh: RID, surface: Int): VariantArray<Any?> { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetArraysPtr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<Any?>) } /** * Returns a mesh's surface's arrays for blend shapes. */ public fun meshSurfaceGetBlendShapeArrays(mesh: RID, surface: Int): VariantArray<VariantArray<Any?>> { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceGetBlendShapeArraysPtr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<VariantArray<Any?>>) } /** * Returns a mesh's number of surfaces. */ public fun meshGetSurfaceCount(mesh: RID): Int { TransferContext.writeArguments(_RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.meshGetSurfaceCountPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long).toInt() } /** * Sets a mesh's custom aabb. */ public fun meshSetCustomAabb(mesh: RID, aabb: AABB): Unit { TransferContext.writeArguments(_RID to mesh, godot.core.VariantType.AABB to aabb) TransferContext.callMethod(rawPtr, MethodBindings.meshSetCustomAabbPtr, NIL) } /** * Returns a mesh's custom aabb. */ public fun meshGetCustomAabb(mesh: RID): AABB { TransferContext.writeArguments(_RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.meshGetCustomAabbPtr, godot.core.VariantType.AABB) return (TransferContext.readReturnValue(godot.core.VariantType.AABB, false) as AABB) } /** * Removes all surfaces from a mesh. */ public fun meshClear(mesh: RID): Unit { TransferContext.writeArguments(_RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.meshClearPtr, NIL) } public fun meshSurfaceUpdateVertexRegion( mesh: RID, surface: Int, offset: Int, `data`: PackedByteArray, ): Unit { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong(), LONG to offset.toLong(), PACKED_BYTE_ARRAY to data) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceUpdateVertexRegionPtr, NIL) } public fun meshSurfaceUpdateAttributeRegion( mesh: RID, surface: Int, offset: Int, `data`: PackedByteArray, ): Unit { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong(), LONG to offset.toLong(), PACKED_BYTE_ARRAY to data) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceUpdateAttributeRegionPtr, NIL) } public fun meshSurfaceUpdateSkinRegion( mesh: RID, surface: Int, offset: Int, `data`: PackedByteArray, ): Unit { TransferContext.writeArguments(_RID to mesh, LONG to surface.toLong(), LONG to offset.toLong(), PACKED_BYTE_ARRAY to data) TransferContext.callMethod(rawPtr, MethodBindings.meshSurfaceUpdateSkinRegionPtr, NIL) } public fun meshSetShadowMesh(mesh: RID, shadowMesh: RID): Unit { TransferContext.writeArguments(_RID to mesh, _RID to shadowMesh) TransferContext.callMethod(rawPtr, MethodBindings.meshSetShadowMeshPtr, NIL) } /** * Creates a new multimesh on the RenderingServer and returns an [RID] handle. This RID will be * used in all `multimesh_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this multimesh to an instance using [instanceSetBase] using the * returned RID. * **Note:** The equivalent resource is [MultiMesh]. */ public fun multimeshCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.multimeshCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } @JvmOverloads public fun multimeshAllocateData( multimesh: RID, instances: Int, transformFormat: MultimeshTransformFormat, colorFormat: Boolean = false, customDataFormat: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to multimesh, LONG to instances.toLong(), LONG to transformFormat.id, BOOL to colorFormat, BOOL to customDataFormat) TransferContext.callMethod(rawPtr, MethodBindings.multimeshAllocateDataPtr, NIL) } /** * Returns the number of instances allocated for this multimesh. */ public fun multimeshGetInstanceCount(multimesh: RID): Int { TransferContext.writeArguments(_RID to multimesh) TransferContext.callMethod(rawPtr, MethodBindings.multimeshGetInstanceCountPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long).toInt() } /** * Sets the mesh to be drawn by the multimesh. Equivalent to [MultiMesh.mesh]. */ public fun multimeshSetMesh(multimesh: RID, mesh: RID): Unit { TransferContext.writeArguments(_RID to multimesh, _RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.multimeshSetMeshPtr, NIL) } /** * Sets the [Transform3D] for this instance. Equivalent to [MultiMesh.setInstanceTransform]. */ public fun multimeshInstanceSetTransform( multimesh: RID, index: Int, transform: Transform3D, ): Unit { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong(), TRANSFORM3D to transform) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceSetTransformPtr, NIL) } /** * Sets the [Transform2D] for this instance. For use when multimesh is used in 2D. Equivalent to * [MultiMesh.setInstanceTransform2d]. */ public fun multimeshInstanceSetTransform2d( multimesh: RID, index: Int, transform: Transform2D, ): Unit { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong(), TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceSetTransform2dPtr, NIL) } /** * Sets the color by which this instance will be modulated. Equivalent to * [MultiMesh.setInstanceColor]. */ public fun multimeshInstanceSetColor( multimesh: RID, index: Int, color: Color, ): Unit { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong(), COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceSetColorPtr, NIL) } /** * Sets the custom data for this instance. Custom data is passed as a [Color], but is interpreted * as a `vec4` in the shader. Equivalent to [MultiMesh.setInstanceCustomData]. */ public fun multimeshInstanceSetCustomData( multimesh: RID, index: Int, customData: Color, ): Unit { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong(), COLOR to customData) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceSetCustomDataPtr, NIL) } /** * Returns the RID of the mesh that will be used in drawing this multimesh. */ public fun multimeshGetMesh(multimesh: RID): RID { TransferContext.writeArguments(_RID to multimesh) TransferContext.callMethod(rawPtr, MethodBindings.multimeshGetMeshPtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Calculates and returns the axis-aligned bounding box that encloses all instances within the * multimesh. */ public fun multimeshGetAabb(multimesh: RID): AABB { TransferContext.writeArguments(_RID to multimesh) TransferContext.callMethod(rawPtr, MethodBindings.multimeshGetAabbPtr, godot.core.VariantType.AABB) return (TransferContext.readReturnValue(godot.core.VariantType.AABB, false) as AABB) } /** * Returns the [Transform3D] of the specified instance. */ public fun multimeshInstanceGetTransform(multimesh: RID, index: Int): Transform3D { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceGetTransformPtr, TRANSFORM3D) return (TransferContext.readReturnValue(TRANSFORM3D, false) as Transform3D) } /** * Returns the [Transform2D] of the specified instance. For use when the multimesh is set to use * 2D transforms. */ public fun multimeshInstanceGetTransform2d(multimesh: RID, index: Int): Transform2D { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceGetTransform2dPtr, TRANSFORM2D) return (TransferContext.readReturnValue(TRANSFORM2D, false) as Transform2D) } /** * Returns the color by which the specified instance will be modulated. */ public fun multimeshInstanceGetColor(multimesh: RID, index: Int): Color { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceGetColorPtr, COLOR) return (TransferContext.readReturnValue(COLOR, false) as Color) } /** * Returns the custom data associated with the specified instance. */ public fun multimeshInstanceGetCustomData(multimesh: RID, index: Int): Color { TransferContext.writeArguments(_RID to multimesh, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.multimeshInstanceGetCustomDataPtr, COLOR) return (TransferContext.readReturnValue(COLOR, false) as Color) } /** * Sets the number of instances visible at a given time. If -1, all instances that have been * allocated are drawn. Equivalent to [MultiMesh.visibleInstanceCount]. */ public fun multimeshSetVisibleInstances(multimesh: RID, visible: Int): Unit { TransferContext.writeArguments(_RID to multimesh, LONG to visible.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.multimeshSetVisibleInstancesPtr, NIL) } /** * Returns the number of visible instances for this multimesh. */ public fun multimeshGetVisibleInstances(multimesh: RID): Int { TransferContext.writeArguments(_RID to multimesh) TransferContext.callMethod(rawPtr, MethodBindings.multimeshGetVisibleInstancesPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long).toInt() } /** * Set the entire data to use for drawing the [multimesh] at once to [buffer] (such as instance * transforms and colors). [buffer]'s size must match the number of instances multiplied by the * per-instance data size (which depends on the enabled MultiMesh fields). Otherwise, an error * message is printed and nothing is rendered. See also [multimeshGetBuffer]. * The per-instance data size and expected data order is: * [codeblock] * 2D: * - Position: 8 floats (8 floats for Transform2D) * - Position + Vertex color: 12 floats (8 floats for Transform2D, 4 floats for Color) * - Position + Custom data: 12 floats (8 floats for Transform2D, 4 floats of custom data) * - Position + Vertex color + Custom data: 16 floats (8 floats for Transform2D, 4 floats for * Color, 4 floats of custom data) * 3D: * - Position: 12 floats (12 floats for Transform3D) * - Position + Vertex color: 16 floats (12 floats for Transform3D, 4 floats for Color) * - Position + Custom data: 16 floats (12 floats for Transform3D, 4 floats of custom data) * - Position + Vertex color + Custom data: 20 floats (12 floats for Transform3D, 4 floats for * Color, 4 floats of custom data) * [/codeblock] */ public fun multimeshSetBuffer(multimesh: RID, buffer: PackedFloat32Array): Unit { TransferContext.writeArguments(_RID to multimesh, PACKED_FLOAT_32_ARRAY to buffer) TransferContext.callMethod(rawPtr, MethodBindings.multimeshSetBufferPtr, NIL) } /** * Returns the MultiMesh data (such as instance transforms, colors, etc). See [multimeshSetBuffer] * for a description of the returned data. * **Note:** If the buffer is in the engine's internal cache, it will have to be fetched from GPU * memory and possibly decompressed. This means [multimeshGetBuffer] is potentially a slow operation * and should be avoided whenever possible. */ public fun multimeshGetBuffer(multimesh: RID): PackedFloat32Array { TransferContext.writeArguments(_RID to multimesh) TransferContext.callMethod(rawPtr, MethodBindings.multimeshGetBufferPtr, PACKED_FLOAT_32_ARRAY) return (TransferContext.readReturnValue(PACKED_FLOAT_32_ARRAY, false) as PackedFloat32Array) } /** * Creates a skeleton and adds it to the RenderingServer. It can be accessed with the RID that is * returned. This RID will be used in all `skeleton_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. */ public fun skeletonCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.skeletonCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } @JvmOverloads public fun skeletonAllocateData( skeleton: RID, bones: Int, is2dSkeleton: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to skeleton, LONG to bones.toLong(), BOOL to is2dSkeleton) TransferContext.callMethod(rawPtr, MethodBindings.skeletonAllocateDataPtr, NIL) } /** * Returns the number of bones allocated for this skeleton. */ public fun skeletonGetBoneCount(skeleton: RID): Int { TransferContext.writeArguments(_RID to skeleton) TransferContext.callMethod(rawPtr, MethodBindings.skeletonGetBoneCountPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long).toInt() } /** * Sets the [Transform3D] for a specific bone of this skeleton. */ public fun skeletonBoneSetTransform( skeleton: RID, bone: Int, transform: Transform3D, ): Unit { TransferContext.writeArguments(_RID to skeleton, LONG to bone.toLong(), TRANSFORM3D to transform) TransferContext.callMethod(rawPtr, MethodBindings.skeletonBoneSetTransformPtr, NIL) } /** * Returns the [Transform3D] set for a specific bone of this skeleton. */ public fun skeletonBoneGetTransform(skeleton: RID, bone: Int): Transform3D { TransferContext.writeArguments(_RID to skeleton, LONG to bone.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.skeletonBoneGetTransformPtr, TRANSFORM3D) return (TransferContext.readReturnValue(TRANSFORM3D, false) as Transform3D) } /** * Sets the [Transform2D] for a specific bone of this skeleton. */ public fun skeletonBoneSetTransform2d( skeleton: RID, bone: Int, transform: Transform2D, ): Unit { TransferContext.writeArguments(_RID to skeleton, LONG to bone.toLong(), TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.skeletonBoneSetTransform2dPtr, NIL) } /** * Returns the [Transform2D] set for a specific bone of this skeleton. */ public fun skeletonBoneGetTransform2d(skeleton: RID, bone: Int): Transform2D { TransferContext.writeArguments(_RID to skeleton, LONG to bone.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.skeletonBoneGetTransform2dPtr, TRANSFORM2D) return (TransferContext.readReturnValue(TRANSFORM2D, false) as Transform2D) } public fun skeletonSetBaseTransform2d(skeleton: RID, baseTransform: Transform2D): Unit { TransferContext.writeArguments(_RID to skeleton, TRANSFORM2D to baseTransform) TransferContext.callMethod(rawPtr, MethodBindings.skeletonSetBaseTransform2dPtr, NIL) } /** * Creates a directional light and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID can be used in most `light_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this directional light to an instance using [instanceSetBase] using * the returned RID. * **Note:** The equivalent node is [DirectionalLight3D]. */ public fun directionalLightCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.directionalLightCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a new omni light and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID can be used in most `light_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this omni light to an instance using [instanceSetBase] using the * returned RID. * **Note:** The equivalent node is [OmniLight3D]. */ public fun omniLightCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.omniLightCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a spot light and adds it to the RenderingServer. It can be accessed with the RID that * is returned. This RID can be used in most `light_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this spot light to an instance using [instanceSetBase] using the * returned RID. */ public fun spotLightCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.spotLightCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the color of the light. Equivalent to [Light3D.lightColor]. */ public fun lightSetColor(light: RID, color: Color): Unit { TransferContext.writeArguments(_RID to light, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.lightSetColorPtr, NIL) } /** * Sets the specified 3D light parameter. See [LightParam] for options. Equivalent to * [Light3D.setParam]. */ public fun lightSetParam( light: RID, `param`: LightParam, `value`: Float, ): Unit { TransferContext.writeArguments(_RID to light, LONG to param.id, DOUBLE to value.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.lightSetParamPtr, NIL) } /** * If `true`, light will cast shadows. Equivalent to [Light3D.shadowEnabled]. */ public fun lightSetShadow(light: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to light, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.lightSetShadowPtr, NIL) } /** * Sets the projector texture to use for the specified 3D light. Equivalent to * [Light3D.lightProjector]. */ public fun lightSetProjector(light: RID, texture: RID): Unit { TransferContext.writeArguments(_RID to light, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.lightSetProjectorPtr, NIL) } /** * If `true`, the 3D light will subtract light instead of adding light. Equivalent to * [Light3D.lightNegative]. */ public fun lightSetNegative(light: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to light, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.lightSetNegativePtr, NIL) } /** * Sets the cull mask for this 3D light. Lights only affect objects in the selected layers. * Equivalent to [Light3D.lightCullMask]. */ public fun lightSetCullMask(light: RID, mask: Long): Unit { TransferContext.writeArguments(_RID to light, LONG to mask) TransferContext.callMethod(rawPtr, MethodBindings.lightSetCullMaskPtr, NIL) } /** * Sets the distance fade for this 3D light. This acts as a form of level of detail (LOD) and can * be used to improve performance. Equivalent to [Light3D.distanceFadeEnabled], * [Light3D.distanceFadeBegin], [Light3D.distanceFadeShadow], and [Light3D.distanceFadeLength]. */ public fun lightSetDistanceFade( decal: RID, enabled: Boolean, begin: Float, shadow: Float, length: Float, ): Unit { TransferContext.writeArguments(_RID to decal, BOOL to enabled, DOUBLE to begin.toDouble(), DOUBLE to shadow.toDouble(), DOUBLE to length.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.lightSetDistanceFadePtr, NIL) } /** * If `true`, reverses the backface culling of the mesh. This can be useful when you have a flat * mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the * mesh to use double-sided shadows with [instanceGeometrySetCastShadowsSetting]. Equivalent to * [Light3D.shadowReverseCullFace]. */ public fun lightSetReverseCullFaceMode(light: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to light, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.lightSetReverseCullFaceModePtr, NIL) } /** * Sets the bake mode to use for the specified 3D light. Equivalent to [Light3D.lightBakeMode]. */ public fun lightSetBakeMode(light: RID, bakeMode: LightBakeMode): Unit { TransferContext.writeArguments(_RID to light, LONG to bakeMode.id) TransferContext.callMethod(rawPtr, MethodBindings.lightSetBakeModePtr, NIL) } /** * Sets the maximum SDFGI cascade in which the 3D light's indirect lighting is rendered. Higher * values allow the light to be rendered in SDFGI further away from the camera. */ public fun lightSetMaxSdfgiCascade(light: RID, cascade: Long): Unit { TransferContext.writeArguments(_RID to light, LONG to cascade) TransferContext.callMethod(rawPtr, MethodBindings.lightSetMaxSdfgiCascadePtr, NIL) } /** * Sets whether to use a dual paraboloid or a cubemap for the shadow map. Dual paraboloid is * faster but may suffer from artifacts. Equivalent to [OmniLight3D.omniShadowMode]. */ public fun lightOmniSetShadowMode(light: RID, mode: LightOmniShadowMode): Unit { TransferContext.writeArguments(_RID to light, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.lightOmniSetShadowModePtr, NIL) } /** * Sets the shadow mode for this directional light. Equivalent to * [DirectionalLight3D.directionalShadowMode]. See [LightDirectionalShadowMode] for options. */ public fun lightDirectionalSetShadowMode(light: RID, mode: LightDirectionalShadowMode): Unit { TransferContext.writeArguments(_RID to light, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.lightDirectionalSetShadowModePtr, NIL) } /** * If `true`, this directional light will blend between shadow map splits resulting in a smoother * transition between them. Equivalent to [DirectionalLight3D.directionalShadowBlendSplits]. */ public fun lightDirectionalSetBlendSplits(light: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to light, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.lightDirectionalSetBlendSplitsPtr, NIL) } /** * If `true`, this light will not be used for anything except sky shaders. Use this for lights * that impact your sky shader that you may want to hide from affecting the rest of the scene. For * example, you may want to enable this when the sun in your sky shader falls below the horizon. */ public fun lightDirectionalSetSkyMode(light: RID, mode: LightDirectionalSkyMode): Unit { TransferContext.writeArguments(_RID to light, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.lightDirectionalSetSkyModePtr, NIL) } /** * Sets the texture filter mode to use when rendering light projectors. This parameter is global * and cannot be set on a per-light basis. */ public fun lightProjectorsSetFilter(filter: LightProjectorFilter): Unit { TransferContext.writeArguments(LONG to filter.id) TransferContext.callMethod(rawPtr, MethodBindings.lightProjectorsSetFilterPtr, NIL) } /** * Sets the filter quality for omni and spot light shadows in 3D. See also * [ProjectSettings.rendering/lightsAndShadows/positionalShadow/softShadowFilterQuality]. This * parameter is global and cannot be set on a per-viewport basis. */ public fun positionalSoftShadowFilterSetQuality(quality: ShadowQuality): Unit { TransferContext.writeArguments(LONG to quality.id) TransferContext.callMethod(rawPtr, MethodBindings.positionalSoftShadowFilterSetQualityPtr, NIL) } /** * Sets the filter [quality] for directional light shadows in 3D. See also * [ProjectSettings.rendering/lightsAndShadows/directionalShadow/softShadowFilterQuality]. This * parameter is global and cannot be set on a per-viewport basis. */ public fun directionalSoftShadowFilterSetQuality(quality: ShadowQuality): Unit { TransferContext.writeArguments(LONG to quality.id) TransferContext.callMethod(rawPtr, MethodBindings.directionalSoftShadowFilterSetQualityPtr, NIL) } /** * Sets the [size] of the directional light shadows in 3D. See also * [ProjectSettings.rendering/lightsAndShadows/directionalShadow/size]. This parameter is global and * cannot be set on a per-viewport basis. */ public fun directionalShadowAtlasSetSize(size: Int, is16bits: Boolean): Unit { TransferContext.writeArguments(LONG to size.toLong(), BOOL to is16bits) TransferContext.callMethod(rawPtr, MethodBindings.directionalShadowAtlasSetSizePtr, NIL) } /** * Creates a reflection probe and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `reflection_probe_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this reflection probe to an instance using [instanceSetBase] using * the returned RID. * **Note:** The equivalent node is [ReflectionProbe]. */ public fun reflectionProbeCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets how often the reflection probe updates. Can either be once or every frame. See * [ReflectionProbeUpdateMode] for options. */ public fun reflectionProbeSetUpdateMode(probe: RID, mode: ReflectionProbeUpdateMode): Unit { TransferContext.writeArguments(_RID to probe, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetUpdateModePtr, NIL) } /** * Sets the intensity of the reflection probe. Intensity modulates the strength of the reflection. * Equivalent to [ReflectionProbe.intensity]. */ public fun reflectionProbeSetIntensity(probe: RID, intensity: Float): Unit { TransferContext.writeArguments(_RID to probe, DOUBLE to intensity.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetIntensityPtr, NIL) } /** * Sets the reflection probe's ambient light mode. Equivalent to [ReflectionProbe.ambientMode]. */ public fun reflectionProbeSetAmbientMode(probe: RID, mode: ReflectionProbeAmbientMode): Unit { TransferContext.writeArguments(_RID to probe, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetAmbientModePtr, NIL) } /** * Sets the reflection probe's custom ambient light color. Equivalent to * [ReflectionProbe.ambientColor]. */ public fun reflectionProbeSetAmbientColor(probe: RID, color: Color): Unit { TransferContext.writeArguments(_RID to probe, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetAmbientColorPtr, NIL) } /** * Sets the reflection probe's custom ambient light energy. Equivalent to * [ReflectionProbe.ambientColorEnergy]. */ public fun reflectionProbeSetAmbientEnergy(probe: RID, energy: Float): Unit { TransferContext.writeArguments(_RID to probe, DOUBLE to energy.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetAmbientEnergyPtr, NIL) } /** * Sets the max distance away from the probe an object can be before it is culled. Equivalent to * [ReflectionProbe.maxDistance]. */ public fun reflectionProbeSetMaxDistance(probe: RID, distance: Float): Unit { TransferContext.writeArguments(_RID to probe, DOUBLE to distance.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetMaxDistancePtr, NIL) } /** * Sets the size of the area that the reflection probe will capture. Equivalent to * [ReflectionProbe.size]. */ public fun reflectionProbeSetSize(probe: RID, size: Vector3): Unit { TransferContext.writeArguments(_RID to probe, VECTOR3 to size) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetSizePtr, NIL) } /** * Sets the origin offset to be used when this reflection probe is in box project mode. Equivalent * to [ReflectionProbe.originOffset]. */ public fun reflectionProbeSetOriginOffset(probe: RID, offset: Vector3): Unit { TransferContext.writeArguments(_RID to probe, VECTOR3 to offset) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetOriginOffsetPtr, NIL) } /** * If `true`, reflections will ignore sky contribution. Equivalent to [ReflectionProbe.interior]. */ public fun reflectionProbeSetAsInterior(probe: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to probe, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetAsInteriorPtr, NIL) } /** * If `true`, uses box projection. This can make reflections look more correct in certain * situations. Equivalent to [ReflectionProbe.boxProjection]. */ public fun reflectionProbeSetEnableBoxProjection(probe: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to probe, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetEnableBoxProjectionPtr, NIL) } /** * If `true`, computes shadows in the reflection probe. This makes the reflection much slower to * compute. Equivalent to [ReflectionProbe.enableShadows]. */ public fun reflectionProbeSetEnableShadows(probe: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to probe, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetEnableShadowsPtr, NIL) } /** * Sets the render cull mask for this reflection probe. Only instances with a matching cull mask * will be rendered by this probe. Equivalent to [ReflectionProbe.cullMask]. */ public fun reflectionProbeSetCullMask(probe: RID, layers: Long): Unit { TransferContext.writeArguments(_RID to probe, LONG to layers) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetCullMaskPtr, NIL) } /** * Sets the resolution to use when rendering the specified reflection probe. The [resolution] is * specified for each cubemap face: for instance, specifying `512` will allocate 6 faces of 512×512 * each (plus mipmaps for roughness levels). */ public fun reflectionProbeSetResolution(probe: RID, resolution: Int): Unit { TransferContext.writeArguments(_RID to probe, LONG to resolution.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetResolutionPtr, NIL) } /** * Sets the mesh level of detail to use in the reflection probe rendering. Higher values will use * less detailed versions of meshes that have LOD variations generated, which can improve * performance. Equivalent to [ReflectionProbe.meshLodThreshold]. */ public fun reflectionProbeSetMeshLodThreshold(probe: RID, pixels: Float): Unit { TransferContext.writeArguments(_RID to probe, DOUBLE to pixels.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.reflectionProbeSetMeshLodThresholdPtr, NIL) } /** * Creates a decal and adds it to the RenderingServer. It can be accessed with the RID that is * returned. This RID will be used in all `decal_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this decal to an instance using [instanceSetBase] using the * returned RID. * **Note:** The equivalent node is [Decal]. */ public fun decalCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.decalCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the [size] of the decal specified by the [decal] RID. Equivalent to [Decal.size]. */ public fun decalSetSize(decal: RID, size: Vector3): Unit { TransferContext.writeArguments(_RID to decal, VECTOR3 to size) TransferContext.callMethod(rawPtr, MethodBindings.decalSetSizePtr, NIL) } /** * Sets the [texture] in the given texture [type] slot for the specified decal. Equivalent to * [Decal.setTexture]. */ public fun decalSetTexture( decal: RID, type: DecalTexture, texture: RID, ): Unit { TransferContext.writeArguments(_RID to decal, LONG to type.id, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.decalSetTexturePtr, NIL) } /** * Sets the emission [energy] in the decal specified by the [decal] RID. Equivalent to * [Decal.emissionEnergy]. */ public fun decalSetEmissionEnergy(decal: RID, energy: Float): Unit { TransferContext.writeArguments(_RID to decal, DOUBLE to energy.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.decalSetEmissionEnergyPtr, NIL) } /** * Sets the [albedoMix] in the decal specified by the [decal] RID. Equivalent to * [Decal.albedoMix]. */ public fun decalSetAlbedoMix(decal: RID, albedoMix: Float): Unit { TransferContext.writeArguments(_RID to decal, DOUBLE to albedoMix.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.decalSetAlbedoMixPtr, NIL) } /** * Sets the color multiplier in the decal specified by the [decal] RID to [color]. Equivalent to * [Decal.modulate]. */ public fun decalSetModulate(decal: RID, color: Color): Unit { TransferContext.writeArguments(_RID to decal, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.decalSetModulatePtr, NIL) } /** * Sets the cull [mask] in the decal specified by the [decal] RID. Equivalent to [Decal.cullMask]. */ public fun decalSetCullMask(decal: RID, mask: Long): Unit { TransferContext.writeArguments(_RID to decal, LONG to mask) TransferContext.callMethod(rawPtr, MethodBindings.decalSetCullMaskPtr, NIL) } /** * Sets the distance fade parameters in the decal specified by the [decal] RID. Equivalent to * [Decal.distanceFadeEnabled], [Decal.distanceFadeBegin] and [Decal.distanceFadeLength]. */ public fun decalSetDistanceFade( decal: RID, enabled: Boolean, begin: Float, length: Float, ): Unit { TransferContext.writeArguments(_RID to decal, BOOL to enabled, DOUBLE to begin.toDouble(), DOUBLE to length.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.decalSetDistanceFadePtr, NIL) } /** * Sets the upper fade ([above]) and lower fade ([below]) in the decal specified by the [decal] * RID. Equivalent to [Decal.upperFade] and [Decal.lowerFade]. */ public fun decalSetFade( decal: RID, above: Float, below: Float, ): Unit { TransferContext.writeArguments(_RID to decal, DOUBLE to above.toDouble(), DOUBLE to below.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.decalSetFadePtr, NIL) } /** * Sets the normal [fade] in the decal specified by the [decal] RID. Equivalent to * [Decal.normalFade]. */ public fun decalSetNormalFade(decal: RID, fade: Float): Unit { TransferContext.writeArguments(_RID to decal, DOUBLE to fade.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.decalSetNormalFadePtr, NIL) } /** * Sets the texture [filter] mode to use when rendering decals. This parameter is global and * cannot be set on a per-decal basis. */ public fun decalsSetFilter(filter: DecalFilter): Unit { TransferContext.writeArguments(LONG to filter.id) TransferContext.callMethod(rawPtr, MethodBindings.decalsSetFilterPtr, NIL) } /** * If [halfResolution] is `true`, renders [VoxelGI] and SDFGI ([Environment.sdfgiEnabled]) buffers * at halved resolution on each axis (e.g. 960×540 when the viewport size is 1920×1080). This * improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that * may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport * resolution increases. [LightmapGI] rendering is not affected by this setting. Equivalent to * [ProjectSettings.rendering/globalIllumination/gi/useHalfResolution]. */ public fun giSetUseHalfResolution(halfResolution: Boolean): Unit { TransferContext.writeArguments(BOOL to halfResolution) TransferContext.callMethod(rawPtr, MethodBindings.giSetUseHalfResolutionPtr, NIL) } /** * Creates a new voxel-based global illumination object and adds it to the RenderingServer. It can * be accessed with the RID that is returned. This RID will be used in all `voxel_gi_*` * RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [VoxelGI]. */ public fun voxelGiCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.voxelGiCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } public fun voxelGiAllocateData( voxelGi: RID, toCellXform: Transform3D, aabb: AABB, octreeSize: Vector3i, octreeCells: PackedByteArray, dataCells: PackedByteArray, distanceField: PackedByteArray, levelCounts: PackedInt32Array, ): Unit { TransferContext.writeArguments(_RID to voxelGi, TRANSFORM3D to toCellXform, godot.core.VariantType.AABB to aabb, VECTOR3I to octreeSize, PACKED_BYTE_ARRAY to octreeCells, PACKED_BYTE_ARRAY to dataCells, PACKED_BYTE_ARRAY to distanceField, PACKED_INT_32_ARRAY to levelCounts) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiAllocateDataPtr, NIL) } public fun voxelGiGetOctreeSize(voxelGi: RID): Vector3i { TransferContext.writeArguments(_RID to voxelGi) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiGetOctreeSizePtr, VECTOR3I) return (TransferContext.readReturnValue(VECTOR3I, false) as Vector3i) } public fun voxelGiGetOctreeCells(voxelGi: RID): PackedByteArray { TransferContext.writeArguments(_RID to voxelGi) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiGetOctreeCellsPtr, PACKED_BYTE_ARRAY) return (TransferContext.readReturnValue(PACKED_BYTE_ARRAY, false) as PackedByteArray) } public fun voxelGiGetDataCells(voxelGi: RID): PackedByteArray { TransferContext.writeArguments(_RID to voxelGi) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiGetDataCellsPtr, PACKED_BYTE_ARRAY) return (TransferContext.readReturnValue(PACKED_BYTE_ARRAY, false) as PackedByteArray) } public fun voxelGiGetDistanceField(voxelGi: RID): PackedByteArray { TransferContext.writeArguments(_RID to voxelGi) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiGetDistanceFieldPtr, PACKED_BYTE_ARRAY) return (TransferContext.readReturnValue(PACKED_BYTE_ARRAY, false) as PackedByteArray) } public fun voxelGiGetLevelCounts(voxelGi: RID): PackedInt32Array { TransferContext.writeArguments(_RID to voxelGi) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiGetLevelCountsPtr, PACKED_INT_32_ARRAY) return (TransferContext.readReturnValue(PACKED_INT_32_ARRAY, false) as PackedInt32Array) } public fun voxelGiGetToCellXform(voxelGi: RID): Transform3D { TransferContext.writeArguments(_RID to voxelGi) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiGetToCellXformPtr, TRANSFORM3D) return (TransferContext.readReturnValue(TRANSFORM3D, false) as Transform3D) } /** * Sets the [VoxelGIData.dynamicRange] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetDynamicRange(voxelGi: RID, range: Float): Unit { TransferContext.writeArguments(_RID to voxelGi, DOUBLE to range.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetDynamicRangePtr, NIL) } /** * Sets the [VoxelGIData.propagation] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetPropagation(voxelGi: RID, amount: Float): Unit { TransferContext.writeArguments(_RID to voxelGi, DOUBLE to amount.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetPropagationPtr, NIL) } /** * Sets the [VoxelGIData.energy] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetEnergy(voxelGi: RID, energy: Float): Unit { TransferContext.writeArguments(_RID to voxelGi, DOUBLE to energy.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetEnergyPtr, NIL) } /** * Used to inform the renderer what exposure normalization value was used while baking the voxel * gi. This value will be used and modulated at run time to ensure that the voxel gi maintains a * consistent level of exposure even if the scene-wide exposure normalization is changed at run time. * For more information see [cameraAttributesSetExposure]. */ public fun voxelGiSetBakedExposureNormalization(voxelGi: RID, bakedExposure: Float): Unit { TransferContext.writeArguments(_RID to voxelGi, DOUBLE to bakedExposure.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetBakedExposureNormalizationPtr, NIL) } /** * Sets the [VoxelGIData.bias] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetBias(voxelGi: RID, bias: Float): Unit { TransferContext.writeArguments(_RID to voxelGi, DOUBLE to bias.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetBiasPtr, NIL) } /** * Sets the [VoxelGIData.normalBias] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetNormalBias(voxelGi: RID, bias: Float): Unit { TransferContext.writeArguments(_RID to voxelGi, DOUBLE to bias.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetNormalBiasPtr, NIL) } /** * Sets the [VoxelGIData.interior] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetInterior(voxelGi: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to voxelGi, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetInteriorPtr, NIL) } /** * Sets the [VoxelGIData.useTwoBounces] value to use on the specified [voxelGi]'s [RID]. */ public fun voxelGiSetUseTwoBounces(voxelGi: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to voxelGi, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetUseTwoBouncesPtr, NIL) } /** * Sets the [ProjectSettings.rendering/globalIllumination/voxelGi/quality] value to use when * rendering. This parameter is global and cannot be set on a per-VoxelGI basis. */ public fun voxelGiSetQuality(quality: VoxelGIQuality): Unit { TransferContext.writeArguments(LONG to quality.id) TransferContext.callMethod(rawPtr, MethodBindings.voxelGiSetQualityPtr, NIL) } /** * Creates a new lightmap global illumination instance and adds it to the RenderingServer. It can * be accessed with the RID that is returned. This RID will be used in all `lightmap_*` * RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [LightmapGI]. */ public fun lightmapCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.lightmapCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Set the textures on the given [lightmap] GI instance to the texture array pointed to by the * [light] RID. If the lightmap texture was baked with [LightmapGI.directional] set to `true`, then * [usesSh] must also be `true`. */ public fun lightmapSetTextures( lightmap: RID, light: RID, usesSh: Boolean, ): Unit { TransferContext.writeArguments(_RID to lightmap, _RID to light, BOOL to usesSh) TransferContext.callMethod(rawPtr, MethodBindings.lightmapSetTexturesPtr, NIL) } public fun lightmapSetProbeBounds(lightmap: RID, bounds: AABB): Unit { TransferContext.writeArguments(_RID to lightmap, godot.core.VariantType.AABB to bounds) TransferContext.callMethod(rawPtr, MethodBindings.lightmapSetProbeBoundsPtr, NIL) } public fun lightmapSetProbeInterior(lightmap: RID, interior: Boolean): Unit { TransferContext.writeArguments(_RID to lightmap, BOOL to interior) TransferContext.callMethod(rawPtr, MethodBindings.lightmapSetProbeInteriorPtr, NIL) } public fun lightmapSetProbeCaptureData( lightmap: RID, points: PackedVector3Array, pointSh: PackedColorArray, tetrahedra: PackedInt32Array, bspTree: PackedInt32Array, ): Unit { TransferContext.writeArguments(_RID to lightmap, PACKED_VECTOR3_ARRAY to points, PACKED_COLOR_ARRAY to pointSh, PACKED_INT_32_ARRAY to tetrahedra, PACKED_INT_32_ARRAY to bspTree) TransferContext.callMethod(rawPtr, MethodBindings.lightmapSetProbeCaptureDataPtr, NIL) } public fun lightmapGetProbeCapturePoints(lightmap: RID): PackedVector3Array { TransferContext.writeArguments(_RID to lightmap) TransferContext.callMethod(rawPtr, MethodBindings.lightmapGetProbeCapturePointsPtr, PACKED_VECTOR3_ARRAY) return (TransferContext.readReturnValue(PACKED_VECTOR3_ARRAY, false) as PackedVector3Array) } public fun lightmapGetProbeCaptureSh(lightmap: RID): PackedColorArray { TransferContext.writeArguments(_RID to lightmap) TransferContext.callMethod(rawPtr, MethodBindings.lightmapGetProbeCaptureShPtr, PACKED_COLOR_ARRAY) return (TransferContext.readReturnValue(PACKED_COLOR_ARRAY, false) as PackedColorArray) } public fun lightmapGetProbeCaptureTetrahedra(lightmap: RID): PackedInt32Array { TransferContext.writeArguments(_RID to lightmap) TransferContext.callMethod(rawPtr, MethodBindings.lightmapGetProbeCaptureTetrahedraPtr, PACKED_INT_32_ARRAY) return (TransferContext.readReturnValue(PACKED_INT_32_ARRAY, false) as PackedInt32Array) } public fun lightmapGetProbeCaptureBspTree(lightmap: RID): PackedInt32Array { TransferContext.writeArguments(_RID to lightmap) TransferContext.callMethod(rawPtr, MethodBindings.lightmapGetProbeCaptureBspTreePtr, PACKED_INT_32_ARRAY) return (TransferContext.readReturnValue(PACKED_INT_32_ARRAY, false) as PackedInt32Array) } /** * Used to inform the renderer what exposure normalization value was used while baking the * lightmap. This value will be used and modulated at run time to ensure that the lightmap maintains * a consistent level of exposure even if the scene-wide exposure normalization is changed at run * time. For more information see [cameraAttributesSetExposure]. */ public fun lightmapSetBakedExposureNormalization(lightmap: RID, bakedExposure: Float): Unit { TransferContext.writeArguments(_RID to lightmap, DOUBLE to bakedExposure.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.lightmapSetBakedExposureNormalizationPtr, NIL) } public fun lightmapSetProbeCaptureUpdateSpeed(speed: Float): Unit { TransferContext.writeArguments(DOUBLE to speed.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.lightmapSetProbeCaptureUpdateSpeedPtr, NIL) } /** * Creates a GPU-based particle system and adds it to the RenderingServer. It can be accessed with * the RID that is returned. This RID will be used in all `particles_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach these particles to an instance using [instanceSetBase] using the * returned RID. * **Note:** The equivalent nodes are [GPUParticles2D] and [GPUParticles3D]. * **Note:** All `particles_*` methods only apply to GPU-based particles, not CPU-based particles. * [CPUParticles2D] and [CPUParticles3D] do not have equivalent RenderingServer functions available, * as these use [MultiMeshInstance2D] and [MultiMeshInstance3D] under the hood (see `multimesh_*` * methods). */ public fun particlesCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.particlesCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets whether the GPU particles specified by the [particles] RID should be rendered in 2D or 3D * according to [mode]. */ public fun particlesSetMode(particles: RID, mode: ParticlesMode): Unit { TransferContext.writeArguments(_RID to particles, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetModePtr, NIL) } /** * If `true`, particles will emit over time. Setting to false does not reset the particles, but * only stops their emission. Equivalent to [GPUParticles3D.emitting]. */ public fun particlesSetEmitting(particles: RID, emitting: Boolean): Unit { TransferContext.writeArguments(_RID to particles, BOOL to emitting) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetEmittingPtr, NIL) } /** * Returns `true` if particles are currently set to emitting. */ public fun particlesGetEmitting(particles: RID): Boolean { TransferContext.writeArguments(_RID to particles) TransferContext.callMethod(rawPtr, MethodBindings.particlesGetEmittingPtr, BOOL) return (TransferContext.readReturnValue(BOOL, false) as Boolean) } /** * Sets the number of particles to be drawn and allocates the memory for them. Equivalent to * [GPUParticles3D.amount]. */ public fun particlesSetAmount(particles: RID, amount: Int): Unit { TransferContext.writeArguments(_RID to particles, LONG to amount.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetAmountPtr, NIL) } /** * Sets the amount ratio for particles to be emitted. Equivalent to [GPUParticles3D.amountRatio]. */ public fun particlesSetAmountRatio(particles: RID, ratio: Float): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to ratio.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetAmountRatioPtr, NIL) } /** * Sets the lifetime of each particle in the system. Equivalent to [GPUParticles3D.lifetime]. */ public fun particlesSetLifetime(particles: RID, lifetime: Double): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to lifetime) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetLifetimePtr, NIL) } /** * If `true`, particles will emit once and then stop. Equivalent to [GPUParticles3D.oneShot]. */ public fun particlesSetOneShot(particles: RID, oneShot: Boolean): Unit { TransferContext.writeArguments(_RID to particles, BOOL to oneShot) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetOneShotPtr, NIL) } /** * Sets the preprocess time for the particles' animation. This lets you delay starting an * animation until after the particles have begun emitting. Equivalent to * [GPUParticles3D.preprocess]. */ public fun particlesSetPreProcessTime(particles: RID, time: Double): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to time) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetPreProcessTimePtr, NIL) } /** * Sets the explosiveness ratio. Equivalent to [GPUParticles3D.explosiveness]. */ public fun particlesSetExplosivenessRatio(particles: RID, ratio: Float): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to ratio.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetExplosivenessRatioPtr, NIL) } /** * Sets the emission randomness ratio. This randomizes the emission of particles within their * phase. Equivalent to [GPUParticles3D.randomness]. */ public fun particlesSetRandomnessRatio(particles: RID, ratio: Float): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to ratio.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetRandomnessRatioPtr, NIL) } /** * Sets the value that informs a [ParticleProcessMaterial] to rush all particles towards the end * of their lifetime. */ public fun particlesSetInterpToEnd(particles: RID, factor: Float): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to factor.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetInterpToEndPtr, NIL) } /** * Sets the velocity of a particle node, that will be used by * [ParticleProcessMaterial.inheritVelocityRatio]. */ public fun particlesSetEmitterVelocity(particles: RID, velocity: Vector3): Unit { TransferContext.writeArguments(_RID to particles, VECTOR3 to velocity) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetEmitterVelocityPtr, NIL) } /** * Sets a custom axis-aligned bounding box for the particle system. Equivalent to * [GPUParticles3D.visibilityAabb]. */ public fun particlesSetCustomAabb(particles: RID, aabb: AABB): Unit { TransferContext.writeArguments(_RID to particles, godot.core.VariantType.AABB to aabb) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetCustomAabbPtr, NIL) } /** * Sets the speed scale of the particle system. Equivalent to [GPUParticles3D.speedScale]. */ public fun particlesSetSpeedScale(particles: RID, scale: Double): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to scale) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetSpeedScalePtr, NIL) } /** * If `true`, particles use local coordinates. If `false` they use global coordinates. Equivalent * to [GPUParticles3D.localCoords]. */ public fun particlesSetUseLocalCoordinates(particles: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to particles, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetUseLocalCoordinatesPtr, NIL) } /** * Sets the material for processing the particles. * **Note:** This is not the material used to draw the materials. Equivalent to * [GPUParticles3D.processMaterial]. */ public fun particlesSetProcessMaterial(particles: RID, material: RID): Unit { TransferContext.writeArguments(_RID to particles, _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetProcessMaterialPtr, NIL) } /** * Sets the frame rate that the particle system rendering will be fixed to. Equivalent to * [GPUParticles3D.fixedFps]. */ public fun particlesSetFixedFps(particles: RID, fps: Int): Unit { TransferContext.writeArguments(_RID to particles, LONG to fps.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetFixedFpsPtr, NIL) } public fun particlesSetInterpolate(particles: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to particles, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetInterpolatePtr, NIL) } /** * If `true`, uses fractional delta which smooths the movement of the particles. Equivalent to * [GPUParticles3D.fractDelta]. */ public fun particlesSetFractionalDelta(particles: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to particles, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetFractionalDeltaPtr, NIL) } public fun particlesSetCollisionBaseSize(particles: RID, size: Float): Unit { TransferContext.writeArguments(_RID to particles, DOUBLE to size.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetCollisionBaseSizePtr, NIL) } public fun particlesSetTransformAlign(particles: RID, align: ParticlesTransformAlign): Unit { TransferContext.writeArguments(_RID to particles, LONG to align.id) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetTransformAlignPtr, NIL) } /** * If [enable] is `true`, enables trails for the [particles] with the specified [lengthSec] in * seconds. Equivalent to [GPUParticles3D.trailEnabled] and [GPUParticles3D.trailLifetime]. */ public fun particlesSetTrails( particles: RID, enable: Boolean, lengthSec: Float, ): Unit { TransferContext.writeArguments(_RID to particles, BOOL to enable, DOUBLE to lengthSec.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetTrailsPtr, NIL) } public fun particlesSetTrailBindPoses(particles: RID, bindPoses: VariantArray<Transform3D>): Unit { TransferContext.writeArguments(_RID to particles, ARRAY to bindPoses) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetTrailBindPosesPtr, NIL) } /** * Returns `true` if particles are not emitting and particles are set to inactive. */ public fun particlesIsInactive(particles: RID): Boolean { TransferContext.writeArguments(_RID to particles) TransferContext.callMethod(rawPtr, MethodBindings.particlesIsInactivePtr, BOOL) return (TransferContext.readReturnValue(BOOL, false) as Boolean) } /** * Add particle system to list of particle systems that need to be updated. Update will take place * on the next frame, or on the next call to [instancesCullAabb], [instancesCullConvex], or * [instancesCullRay]. */ public fun particlesRequestProcess(particles: RID): Unit { TransferContext.writeArguments(_RID to particles) TransferContext.callMethod(rawPtr, MethodBindings.particlesRequestProcessPtr, NIL) } /** * Reset the particles on the next update. Equivalent to [GPUParticles3D.restart]. */ public fun particlesRestart(particles: RID): Unit { TransferContext.writeArguments(_RID to particles) TransferContext.callMethod(rawPtr, MethodBindings.particlesRestartPtr, NIL) } public fun particlesSetSubemitter(particles: RID, subemitterParticles: RID): Unit { TransferContext.writeArguments(_RID to particles, _RID to subemitterParticles) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetSubemitterPtr, NIL) } /** * Manually emits particles from the [particles] instance. */ public fun particlesEmit( particles: RID, transform: Transform3D, velocity: Vector3, color: Color, custom: Color, emitFlags: Long, ): Unit { TransferContext.writeArguments(_RID to particles, TRANSFORM3D to transform, VECTOR3 to velocity, COLOR to color, COLOR to custom, LONG to emitFlags) TransferContext.callMethod(rawPtr, MethodBindings.particlesEmitPtr, NIL) } /** * Sets the draw order of the particles to one of the named enums from [ParticlesDrawOrder]. See * [ParticlesDrawOrder] for options. Equivalent to [GPUParticles3D.drawOrder]. */ public fun particlesSetDrawOrder(particles: RID, order: ParticlesDrawOrder): Unit { TransferContext.writeArguments(_RID to particles, LONG to order.id) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetDrawOrderPtr, NIL) } /** * Sets the number of draw passes to use. Equivalent to [GPUParticles3D.drawPasses]. */ public fun particlesSetDrawPasses(particles: RID, count: Int): Unit { TransferContext.writeArguments(_RID to particles, LONG to count.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetDrawPassesPtr, NIL) } /** * Sets the mesh to be used for the specified draw pass. Equivalent to [GPUParticles3D.drawPass1], * [GPUParticles3D.drawPass2], [GPUParticles3D.drawPass3], and [GPUParticles3D.drawPass4]. */ public fun particlesSetDrawPassMesh( particles: RID, pass: Int, mesh: RID, ): Unit { TransferContext.writeArguments(_RID to particles, LONG to pass.toLong(), _RID to mesh) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetDrawPassMeshPtr, NIL) } /** * Calculates and returns the axis-aligned bounding box that contains all the particles. * Equivalent to [GPUParticles3D.captureAabb]. */ public fun particlesGetCurrentAabb(particles: RID): AABB { TransferContext.writeArguments(_RID to particles) TransferContext.callMethod(rawPtr, MethodBindings.particlesGetCurrentAabbPtr, godot.core.VariantType.AABB) return (TransferContext.readReturnValue(godot.core.VariantType.AABB, false) as AABB) } /** * Sets the [Transform3D] that will be used by the particles when they first emit. */ public fun particlesSetEmissionTransform(particles: RID, transform: Transform3D): Unit { TransferContext.writeArguments(_RID to particles, TRANSFORM3D to transform) TransferContext.callMethod(rawPtr, MethodBindings.particlesSetEmissionTransformPtr, NIL) } /** * Creates a new 3D GPU particle collision or attractor and adds it to the RenderingServer. It can * be accessed with the RID that is returned. This RID can be used in most `particles_collision_*` * RenderingServer functions. * **Note:** The equivalent nodes are [GPUParticlesCollision3D] and [GPUParticlesAttractor3D]. */ public fun particlesCollisionCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the collision or attractor shape [type] for the 3D GPU particles collision or attractor * specified by the [particlesCollision] RID. */ public fun particlesCollisionSetCollisionType(particlesCollision: RID, type: ParticlesCollisionType): Unit { TransferContext.writeArguments(_RID to particlesCollision, LONG to type.id) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetCollisionTypePtr, NIL) } /** * Sets the cull [mask] for the 3D GPU particles collision or attractor specified by the * [particlesCollision] RID. Equivalent to [GPUParticlesCollision3D.cullMask] or * [GPUParticlesAttractor3D.cullMask] depending on the [particlesCollision] type. */ public fun particlesCollisionSetCullMask(particlesCollision: RID, mask: Long): Unit { TransferContext.writeArguments(_RID to particlesCollision, LONG to mask) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetCullMaskPtr, NIL) } /** * Sets the [radius] for the 3D GPU particles sphere collision or attractor specified by the * [particlesCollision] RID. Equivalent to [GPUParticlesCollisionSphere3D.radius] or * [GPUParticlesAttractorSphere3D.radius] depending on the [particlesCollision] type. */ public fun particlesCollisionSetSphereRadius(particlesCollision: RID, radius: Float): Unit { TransferContext.writeArguments(_RID to particlesCollision, DOUBLE to radius.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetSphereRadiusPtr, NIL) } /** * Sets the [extents] for the 3D GPU particles collision by the [particlesCollision] RID. * Equivalent to [GPUParticlesCollisionBox3D.size], [GPUParticlesCollisionSDF3D.size], * [GPUParticlesCollisionHeightField3D.size], [GPUParticlesAttractorBox3D.size] or * [GPUParticlesAttractorVectorField3D.size] depending on the [particlesCollision] type. */ public fun particlesCollisionSetBoxExtents(particlesCollision: RID, extents: Vector3): Unit { TransferContext.writeArguments(_RID to particlesCollision, VECTOR3 to extents) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetBoxExtentsPtr, NIL) } /** * Sets the [strength] for the 3D GPU particles attractor specified by the [particlesCollision] * RID. Only used for attractors, not colliders. Equivalent to [GPUParticlesAttractor3D.strength]. */ public fun particlesCollisionSetAttractorStrength(particlesCollision: RID, strength: Float): Unit { TransferContext.writeArguments(_RID to particlesCollision, DOUBLE to strength.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetAttractorStrengthPtr, NIL) } /** * Sets the directionality [amount] for the 3D GPU particles attractor specified by the * [particlesCollision] RID. Only used for attractors, not colliders. Equivalent to * [GPUParticlesAttractor3D.directionality]. */ public fun particlesCollisionSetAttractorDirectionality(particlesCollision: RID, amount: Float): Unit { TransferContext.writeArguments(_RID to particlesCollision, DOUBLE to amount.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetAttractorDirectionalityPtr, NIL) } /** * Sets the attenuation [curve] for the 3D GPU particles attractor specified by the * [particlesCollision] RID. Only used for attractors, not colliders. Equivalent to * [GPUParticlesAttractor3D.attenuation]. */ public fun particlesCollisionSetAttractorAttenuation(particlesCollision: RID, curve: Float): Unit { TransferContext.writeArguments(_RID to particlesCollision, DOUBLE to curve.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetAttractorAttenuationPtr, NIL) } /** * Sets the signed distance field [texture] for the 3D GPU particles collision specified by the * [particlesCollision] RID. Equivalent to [GPUParticlesCollisionSDF3D.texture] or * [GPUParticlesAttractorVectorField3D.texture] depending on the [particlesCollision] type. */ public fun particlesCollisionSetFieldTexture(particlesCollision: RID, texture: RID): Unit { TransferContext.writeArguments(_RID to particlesCollision, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetFieldTexturePtr, NIL) } /** * Requests an update for the 3D GPU particle collision heightfield. This may be automatically * called by the 3D GPU particle collision heightfield depending on its * [GPUParticlesCollisionHeightField3D.updateMode]. */ public fun particlesCollisionHeightFieldUpdate(particlesCollision: RID): Unit { TransferContext.writeArguments(_RID to particlesCollision) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionHeightFieldUpdatePtr, NIL) } /** * Sets the heightmap [resolution] for the 3D GPU particles heightfield collision specified by the * [particlesCollision] RID. Equivalent to [GPUParticlesCollisionHeightField3D.resolution]. */ public fun particlesCollisionSetHeightFieldResolution(particlesCollision: RID, resolution: ParticlesCollisionHeightfieldResolution): Unit { TransferContext.writeArguments(_RID to particlesCollision, LONG to resolution.id) TransferContext.callMethod(rawPtr, MethodBindings.particlesCollisionSetHeightFieldResolutionPtr, NIL) } /** * Creates a new fog volume and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `fog_volume_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [FogVolume]. */ public fun fogVolumeCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.fogVolumeCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the shape of the fog volume to either [RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], * [RenderingServer.FOG_VOLUME_SHAPE_CONE], [RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], * [RenderingServer.FOG_VOLUME_SHAPE_BOX] or [RenderingServer.FOG_VOLUME_SHAPE_WORLD]. */ public fun fogVolumeSetShape(fogVolume: RID, shape: FogVolumeShape): Unit { TransferContext.writeArguments(_RID to fogVolume, LONG to shape.id) TransferContext.callMethod(rawPtr, MethodBindings.fogVolumeSetShapePtr, NIL) } /** * Sets the size of the fog volume when shape is [RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], * [RenderingServer.FOG_VOLUME_SHAPE_CONE], [RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or * [RenderingServer.FOG_VOLUME_SHAPE_BOX]. */ public fun fogVolumeSetSize(fogVolume: RID, size: Vector3): Unit { TransferContext.writeArguments(_RID to fogVolume, VECTOR3 to size) TransferContext.callMethod(rawPtr, MethodBindings.fogVolumeSetSizePtr, NIL) } /** * Sets the [Material] of the fog volume. Can be either a [FogMaterial] or a custom * [ShaderMaterial]. */ public fun fogVolumeSetMaterial(fogVolume: RID, material: RID): Unit { TransferContext.writeArguments(_RID to fogVolume, _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.fogVolumeSetMaterialPtr, NIL) } /** * Creates a new 3D visibility notifier object and adds it to the RenderingServer. It can be * accessed with the RID that is returned. This RID will be used in all `visibility_notifier_*` * RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * To place in a scene, attach this mesh to an instance using [instanceSetBase] using the returned * RID. * **Note:** The equivalent node is [VisibleOnScreenNotifier3D]. */ public fun visibilityNotifierCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.visibilityNotifierCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } public fun visibilityNotifierSetAabb(notifier: RID, aabb: AABB): Unit { TransferContext.writeArguments(_RID to notifier, godot.core.VariantType.AABB to aabb) TransferContext.callMethod(rawPtr, MethodBindings.visibilityNotifierSetAabbPtr, NIL) } public fun visibilityNotifierSetCallbacks( notifier: RID, enterCallable: Callable, exitCallable: Callable, ): Unit { TransferContext.writeArguments(_RID to notifier, CALLABLE to enterCallable, CALLABLE to exitCallable) TransferContext.callMethod(rawPtr, MethodBindings.visibilityNotifierSetCallbacksPtr, NIL) } /** * Creates an occluder instance and adds it to the RenderingServer. It can be accessed with the * RID that is returned. This RID will be used in all `occluder_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [Occluder3D] (not to be confused with the * [OccluderInstance3D] node). */ public fun occluderCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.occluderCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the mesh data for the given occluder RID, which controls the shape of the occlusion * culling that will be performed. */ public fun occluderSetMesh( occluder: RID, vertices: PackedVector3Array, indices: PackedInt32Array, ): Unit { TransferContext.writeArguments(_RID to occluder, PACKED_VECTOR3_ARRAY to vertices, PACKED_INT_32_ARRAY to indices) TransferContext.callMethod(rawPtr, MethodBindings.occluderSetMeshPtr, NIL) } /** * Creates a 3D camera and adds it to the RenderingServer. It can be accessed with the RID that is * returned. This RID will be used in all `camera_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [Camera3D]. */ public fun cameraCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.cameraCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets camera to use perspective projection. Objects on the screen becomes smaller when they are * far away. */ public fun cameraSetPerspective( camera: RID, fovyDegrees: Float, zNear: Float, zFar: Float, ): Unit { TransferContext.writeArguments(_RID to camera, DOUBLE to fovyDegrees.toDouble(), DOUBLE to zNear.toDouble(), DOUBLE to zFar.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetPerspectivePtr, NIL) } /** * Sets camera to use orthogonal projection, also known as orthographic projection. Objects remain * the same size on the screen no matter how far away they are. */ public fun cameraSetOrthogonal( camera: RID, size: Float, zNear: Float, zFar: Float, ): Unit { TransferContext.writeArguments(_RID to camera, DOUBLE to size.toDouble(), DOUBLE to zNear.toDouble(), DOUBLE to zFar.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetOrthogonalPtr, NIL) } /** * Sets camera to use frustum projection. This mode allows adjusting the [offset] argument to * create "tilted frustum" effects. */ public fun cameraSetFrustum( camera: RID, size: Float, offset: Vector2, zNear: Float, zFar: Float, ): Unit { TransferContext.writeArguments(_RID to camera, DOUBLE to size.toDouble(), VECTOR2 to offset, DOUBLE to zNear.toDouble(), DOUBLE to zFar.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetFrustumPtr, NIL) } /** * Sets [Transform3D] of camera. */ public fun cameraSetTransform(camera: RID, transform: Transform3D): Unit { TransferContext.writeArguments(_RID to camera, TRANSFORM3D to transform) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetTransformPtr, NIL) } /** * Sets the cull mask associated with this camera. The cull mask describes which 3D layers are * rendered by this camera. Equivalent to [Camera3D.cullMask]. */ public fun cameraSetCullMask(camera: RID, layers: Long): Unit { TransferContext.writeArguments(_RID to camera, LONG to layers) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetCullMaskPtr, NIL) } /** * Sets the environment used by this camera. Equivalent to [Camera3D.environment]. */ public fun cameraSetEnvironment(camera: RID, env: RID): Unit { TransferContext.writeArguments(_RID to camera, _RID to env) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetEnvironmentPtr, NIL) } /** * Sets the camera_attributes created with [cameraAttributesCreate] to the given camera. */ public fun cameraSetCameraAttributes(camera: RID, effects: RID): Unit { TransferContext.writeArguments(_RID to camera, _RID to effects) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetCameraAttributesPtr, NIL) } /** * If `true`, preserves the horizontal aspect ratio which is equivalent to [Camera3D.KEEP_WIDTH]. * If `false`, preserves the vertical aspect ratio which is equivalent to [Camera3D.KEEP_HEIGHT]. */ public fun cameraSetUseVerticalAspect(camera: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to camera, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.cameraSetUseVerticalAspectPtr, NIL) } /** * Creates an empty viewport and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `viewport_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [Viewport]. */ public fun viewportCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.viewportCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * If `true`, the viewport uses augmented or virtual reality technologies. See [XRInterface]. */ public fun viewportSetUseXr(viewport: RID, useXr: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to useXr) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetUseXrPtr, NIL) } /** * Sets the viewport's width and height in pixels. */ public fun viewportSetSize( viewport: RID, width: Int, height: Int, ): Unit { TransferContext.writeArguments(_RID to viewport, LONG to width.toLong(), LONG to height.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetSizePtr, NIL) } /** * If `true`, sets the viewport active, else sets it inactive. */ public fun viewportSetActive(viewport: RID, active: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to active) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetActivePtr, NIL) } /** * Sets the viewport's parent to the viewport specified by the [parentViewport] RID. */ public fun viewportSetParentViewport(viewport: RID, parentViewport: RID): Unit { TransferContext.writeArguments(_RID to viewport, _RID to parentViewport) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetParentViewportPtr, NIL) } /** * Copies the viewport to a region of the screen specified by [rect]. If * [viewportSetRenderDirectToScreen] is `true`, then the viewport does not use a framebuffer and the * contents of the viewport are rendered directly to screen. However, note that the root viewport is * drawn last, therefore it will draw over the screen. Accordingly, you must set the root viewport to * an area that does not cover the area that you have attached this viewport to. * For example, you can set the root viewport to not render at all with the following code: * FIXME: The method seems to be non-existent. * * gdscript: * ```gdscript * func _ready(): * get_viewport().set_attach_to_screen_rect(Rect2()) * $Viewport.set_attach_to_screen_rect(Rect2(0, 0, 600, 600)) * ``` * * Using this can result in significant optimization, especially on lower-end devices. However, it * comes at the cost of having to manage your viewports manually. For further optimization, see * [viewportSetRenderDirectToScreen]. */ @JvmOverloads public fun viewportAttachToScreen( viewport: RID, rect: Rect2 = Rect2(0.0, 0.0, 0.0, 0.0), screen: Int = 0, ): Unit { TransferContext.writeArguments(_RID to viewport, RECT2 to rect, LONG to screen.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.viewportAttachToScreenPtr, NIL) } /** * If `true`, render the contents of the viewport directly to screen. This allows a low-level * optimization where you can skip drawing a viewport to the root viewport. While this optimization * can result in a significant increase in speed (especially on older devices), it comes at a cost of * usability. When this is enabled, you cannot read from the viewport or from the screen_texture. You * also lose the benefit of certain window settings, such as the various stretch modes. Another * consequence to be aware of is that in 2D the rendering happens in window coordinates, so if you * have a viewport that is double the size of the window, and you set this, then only the portion * that fits within the window will be drawn, no automatic scaling is possible, even if your game * scene is significantly larger than the window size. */ public fun viewportSetRenderDirectToScreen(viewport: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetRenderDirectToScreenPtr, NIL) } /** * Sets the rendering mask associated with this [Viewport]. Only [CanvasItem] nodes with a * matching rendering visibility layer will be rendered by this [Viewport]. */ public fun viewportSetCanvasCullMask(viewport: RID, canvasCullMask: Long): Unit { TransferContext.writeArguments(_RID to viewport, LONG to canvasCullMask) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetCanvasCullMaskPtr, NIL) } /** * Sets the 3D resolution scaling mode. Bilinear scaling renders at different resolution to either * undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is * an upscaling technology that produces high quality images at fast framerates by using a spatially * aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces * significantly higher image quality. FSR should be used where possible. */ public fun viewportSetScaling3dMode(viewport: RID, scaling3dMode: ViewportScaling3DMode): Unit { TransferContext.writeArguments(_RID to viewport, LONG to scaling3dMode.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetScaling3dModePtr, NIL) } /** * Scales the 3D render buffer based on the viewport size uses an image filter specified in * [ViewportScaling3DMode] to scale the output image to the full viewport size. Values lower than * `1.0` can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater * than `1.0` are only valid for bilinear mode and can be used to improve 3D rendering quality at a * high performance cost (supersampling). See also [ViewportMSAA] for multi-sample antialiasing, * which is significantly cheaper but only smoothens the edges of polygons. * When using FSR upscaling, AMD recommends exposing the following values as preset options to * users "Ultra Quality: 0.77", "Quality: 0.67", "Balanced: 0.59", "Performance: 0.5" instead of * exposing the entire scale. */ public fun viewportSetScaling3dScale(viewport: RID, scale: Float): Unit { TransferContext.writeArguments(_RID to viewport, DOUBLE to scale.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetScaling3dScalePtr, NIL) } /** * Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness * halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make * a visible difference. */ public fun viewportSetFsrSharpness(viewport: RID, sharpness: Float): Unit { TransferContext.writeArguments(_RID to viewport, DOUBLE to sharpness.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetFsrSharpnessPtr, NIL) } /** * Affects the final texture sharpness by reading from a lower or higher mipmap (also called * "texture LOD bias"). Negative values make mipmapped textures sharper but grainier when viewed at a * distance, while positive values make mipmapped textures blurrier (even when up close). To get * sharper textures at a distance without introducing too much graininess, set this between `-0.75` * and `0.0`. Enabling temporal antialiasing * ([ProjectSettings.rendering/antiAliasing/quality/useTaa]) can help reduce the graininess visible * when using negative mipmap bias. * **Note:** When the 3D scaling mode is set to FSR 1.0, this value is used to adjust the * automatic mipmap bias which is calculated internally based on the scale factor. The formula for * this is `-log2(1.0 / scale) + mipmap_bias`. */ public fun viewportSetTextureMipmapBias(viewport: RID, mipmapBias: Float): Unit { TransferContext.writeArguments(_RID to viewport, DOUBLE to mipmapBias.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetTextureMipmapBiasPtr, NIL) } /** * Sets when the viewport should be updated. See [ViewportUpdateMode] constants for options. */ public fun viewportSetUpdateMode(viewport: RID, updateMode: ViewportUpdateMode): Unit { TransferContext.writeArguments(_RID to viewport, LONG to updateMode.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetUpdateModePtr, NIL) } /** * Sets the clear mode of a viewport. See [ViewportClearMode] for options. */ public fun viewportSetClearMode(viewport: RID, clearMode: ViewportClearMode): Unit { TransferContext.writeArguments(_RID to viewport, LONG to clearMode.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetClearModePtr, NIL) } /** * Returns the render target for the viewport. */ public fun viewportGetRenderTarget(viewport: RID): RID { TransferContext.writeArguments(_RID to viewport) TransferContext.callMethod(rawPtr, MethodBindings.viewportGetRenderTargetPtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns the viewport's last rendered frame. */ public fun viewportGetTexture(viewport: RID): RID { TransferContext.writeArguments(_RID to viewport) TransferContext.callMethod(rawPtr, MethodBindings.viewportGetTexturePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * If `true`, the viewport's 3D elements are not rendered. */ public fun viewportSetDisable3d(viewport: RID, disable: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to disable) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetDisable3dPtr, NIL) } /** * If `true`, the viewport's canvas (i.e. 2D and GUI elements) is not rendered. */ public fun viewportSetDisable2d(viewport: RID, disable: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to disable) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetDisable2dPtr, NIL) } /** * Sets the viewport's environment mode which allows enabling or disabling rendering of 3D * environment over 2D canvas. When disabled, 2D will not be affected by the environment. When * enabled, 2D will be affected by the environment if the environment background mode is * [ENV_BG_CANVAS]. The default behavior is to inherit the setting from the viewport's parent. If the * topmost parent is also set to [VIEWPORT_ENVIRONMENT_INHERIT], then the behavior will be the same * as if it was set to [VIEWPORT_ENVIRONMENT_ENABLED]. */ public fun viewportSetEnvironmentMode(viewport: RID, mode: ViewportEnvironmentMode): Unit { TransferContext.writeArguments(_RID to viewport, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetEnvironmentModePtr, NIL) } /** * Sets a viewport's camera. */ public fun viewportAttachCamera(viewport: RID, camera: RID): Unit { TransferContext.writeArguments(_RID to viewport, _RID to camera) TransferContext.callMethod(rawPtr, MethodBindings.viewportAttachCameraPtr, NIL) } /** * Sets a viewport's scenario. The scenario contains information about environment information, * reflection atlas, etc. */ public fun viewportSetScenario(viewport: RID, scenario: RID): Unit { TransferContext.writeArguments(_RID to viewport, _RID to scenario) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetScenarioPtr, NIL) } /** * Sets a viewport's canvas. */ public fun viewportAttachCanvas(viewport: RID, canvas: RID): Unit { TransferContext.writeArguments(_RID to viewport, _RID to canvas) TransferContext.callMethod(rawPtr, MethodBindings.viewportAttachCanvasPtr, NIL) } /** * Detaches a viewport from a canvas and vice versa. */ public fun viewportRemoveCanvas(viewport: RID, canvas: RID): Unit { TransferContext.writeArguments(_RID to viewport, _RID to canvas) TransferContext.callMethod(rawPtr, MethodBindings.viewportRemoveCanvasPtr, NIL) } /** * If `true`, canvas item transforms (i.e. origin position) are snapped to the nearest pixel when * rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially * when [Camera2D] smoothing is enabled. Equivalent to * [ProjectSettings.rendering/2d/snap/snap2dTransformsToPixel]. */ public fun viewportSetSnap2dTransformsToPixel(viewport: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetSnap2dTransformsToPixelPtr, NIL) } /** * If `true`, canvas item vertices (i.e. polygon points) are snapped to the nearest pixel when * rendering. This can lead to a crisper appearance at the cost of less smooth movement, especially * when [Camera2D] smoothing is enabled. Equivalent to * [ProjectSettings.rendering/2d/snap/snap2dVerticesToPixel]. */ public fun viewportSetSnap2dVerticesToPixel(viewport: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetSnap2dVerticesToPixelPtr, NIL) } /** * Sets the default texture filtering mode for the specified [viewport] RID. See * [CanvasItemTextureFilter] for options. */ public fun viewportSetDefaultCanvasItemTextureFilter(viewport: RID, filter: CanvasItemTextureFilter): Unit { TransferContext.writeArguments(_RID to viewport, LONG to filter.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetDefaultCanvasItemTextureFilterPtr, NIL) } /** * Sets the default texture repeat mode for the specified [viewport] RID. See * [CanvasItemTextureRepeat] for options. */ public fun viewportSetDefaultCanvasItemTextureRepeat(viewport: RID, repeat: CanvasItemTextureRepeat): Unit { TransferContext.writeArguments(_RID to viewport, LONG to repeat.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetDefaultCanvasItemTextureRepeatPtr, NIL) } /** * Sets the transformation of a viewport's canvas. */ public fun viewportSetCanvasTransform( viewport: RID, canvas: RID, offset: Transform2D, ): Unit { TransferContext.writeArguments(_RID to viewport, _RID to canvas, TRANSFORM2D to offset) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetCanvasTransformPtr, NIL) } /** * Sets the stacking order for a viewport's canvas. * [layer] is the actual canvas layer, while [sublayer] specifies the stacking order of the canvas * among those in the same layer. */ public fun viewportSetCanvasStacking( viewport: RID, canvas: RID, layer: Int, sublayer: Int, ): Unit { TransferContext.writeArguments(_RID to viewport, _RID to canvas, LONG to layer.toLong(), LONG to sublayer.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetCanvasStackingPtr, NIL) } /** * If `true`, the viewport renders its background as transparent. */ public fun viewportSetTransparentBackground(viewport: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetTransparentBackgroundPtr, NIL) } /** * Sets the viewport's global transformation matrix. */ public fun viewportSetGlobalCanvasTransform(viewport: RID, transform: Transform2D): Unit { TransferContext.writeArguments(_RID to viewport, TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetGlobalCanvasTransformPtr, NIL) } /** * Sets the viewport's 2D signed distance field [ProjectSettings.rendering/2d/sdf/oversize] and * [ProjectSettings.rendering/2d/sdf/scale]. This is used when sampling the signed distance field in * [CanvasItem] shaders as well as [GPUParticles2D] collision. This is *not* used by SDFGI in 3D * rendering. */ public fun viewportSetSdfOversizeAndScale( viewport: RID, oversize: ViewportSDFOversize, scale: ViewportSDFScale, ): Unit { TransferContext.writeArguments(_RID to viewport, LONG to oversize.id, LONG to scale.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetSdfOversizeAndScalePtr, NIL) } /** * Sets the [size] of the shadow atlas's images (used for omni and spot lights) on the viewport * specified by the [viewport] RID. The value is rounded up to the nearest power of 2. If [use16Bits] * is `true`, use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having * less precision and may result in shadow acne, but can lead to performance improvements on some * devices. * **Note:** If this is set to `0`, no positional shadows will be visible at all. This can improve * performance significantly on low-end systems by reducing both the CPU and GPU load (as fewer draw * calls are needed to draw the scene without shadows). */ @JvmOverloads public fun viewportSetPositionalShadowAtlasSize( viewport: RID, size: Int, use16Bits: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to viewport, LONG to size.toLong(), BOOL to use16Bits) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetPositionalShadowAtlasSizePtr, NIL) } /** * Sets the number of subdivisions to use in the specified shadow atlas [quadrant] for omni and * spot shadows. See also [Viewport.setPositionalShadowAtlasQuadrantSubdiv]. */ public fun viewportSetPositionalShadowAtlasQuadrantSubdivision( viewport: RID, quadrant: Int, subdivision: Int, ): Unit { TransferContext.writeArguments(_RID to viewport, LONG to quadrant.toLong(), LONG to subdivision.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetPositionalShadowAtlasQuadrantSubdivisionPtr, NIL) } /** * Sets the multisample anti-aliasing mode for 3D on the specified [viewport] RID. See * [ViewportMSAA] for options. */ public fun viewportSetMsaa3d(viewport: RID, msaa: ViewportMSAA): Unit { TransferContext.writeArguments(_RID to viewport, LONG to msaa.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetMsaa3dPtr, NIL) } /** * Sets the multisample anti-aliasing mode for 2D/Canvas on the specified [viewport] RID. See * [ViewportMSAA] for options. */ public fun viewportSetMsaa2d(viewport: RID, msaa: ViewportMSAA): Unit { TransferContext.writeArguments(_RID to viewport, LONG to msaa.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetMsaa2dPtr, NIL) } /** * If `true`, 2D rendering will use a high dynamic range (HDR) format framebuffer matching the bit * depth of the 3D framebuffer. When using the Forward+ renderer this will be a `RGBA16` framebuffer, * while when using the Mobile renderer it will be a `RGB10_A2` framebuffer. Additionally, 2D * rendering will take place in linear color space and will be converted to sRGB space immediately * before blitting to the screen (if the Viewport is attached to the screen). Practically speaking, * this means that the end result of the Viewport will not be clamped into the `0-1` range and can be * used in 3D rendering without color space adjustments. This allows 2D rendering to take advantage * of effects requiring high dynamic range (e.g. 2D glow) as well as substantially improves the * appearance of effects requiring highly detailed gradients. This setting has the same effect as * [Viewport.useHdr2d]. * **Note:** This setting will have no effect when using the GL Compatibility renderer as the GL * Compatibility renderer always renders in low dynamic range for performance reasons. */ public fun viewportSetUseHdr2d(viewport: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetUseHdr2dPtr, NIL) } /** * Sets the viewport's screen-space antialiasing mode. */ public fun viewportSetScreenSpaceAa(viewport: RID, mode: ViewportScreenSpaceAA): Unit { TransferContext.writeArguments(_RID to viewport, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetScreenSpaceAaPtr, NIL) } /** * If `true`, use Temporal Anti-Aliasing. Equivalent to * [ProjectSettings.rendering/antiAliasing/quality/useTaa]. */ public fun viewportSetUseTaa(viewport: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetUseTaaPtr, NIL) } /** * If `true`, enables debanding on the specified viewport. Equivalent to * [ProjectSettings.rendering/antiAliasing/quality/useDebanding]. */ public fun viewportSetUseDebanding(viewport: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetUseDebandingPtr, NIL) } /** * If `true`, enables occlusion culling on the specified viewport. Equivalent to * [ProjectSettings.rendering/occlusionCulling/useOcclusionCulling]. */ public fun viewportSetUseOcclusionCulling(viewport: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetUseOcclusionCullingPtr, NIL) } /** * Sets the [ProjectSettings.rendering/occlusionCulling/occlusionRaysPerThread] to use for * occlusion culling. This parameter is global and cannot be set on a per-viewport basis. */ public fun viewportSetOcclusionRaysPerThread(raysPerThread: Int): Unit { TransferContext.writeArguments(LONG to raysPerThread.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetOcclusionRaysPerThreadPtr, NIL) } /** * Sets the [ProjectSettings.rendering/occlusionCulling/bvhBuildQuality] to use for occlusion * culling. This parameter is global and cannot be set on a per-viewport basis. */ public fun viewportSetOcclusionCullingBuildQuality(quality: ViewportOcclusionCullingBuildQuality): Unit { TransferContext.writeArguments(LONG to quality.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetOcclusionCullingBuildQualityPtr, NIL) } /** * Returns a statistic about the rendering engine which can be used for performance profiling. * This is separated into render pass [type]s, each of them having the same [info]s you can query * (different passes will return different values). See [RenderingServer.ViewportRenderInfoType] for * a list of render pass types and [RenderingServer.ViewportRenderInfo] for a list of information * that can be queried. * See also [getRenderingInfo], which returns global information across all viewports. * **Note:** Viewport rendering information is not available until at least 2 frames have been * rendered by the engine. If rendering information is not available, [viewportGetRenderInfo] returns * `0`. To print rendering information in `_ready()` successfully, use the following: * [codeblock] * func _ready(): * for _i in 2: * await get_tree().process_frame * * print( * RenderingServer.viewport_get_render_info(get_viewport().get_viewport_rid(), * RenderingServer.VIEWPORT_RENDER_INFO_TYPE_VISIBLE, * RenderingServer.VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME) * ) * [/codeblock] */ public fun viewportGetRenderInfo( viewport: RID, type: ViewportRenderInfoType, info: ViewportRenderInfo, ): Int { TransferContext.writeArguments(_RID to viewport, LONG to type.id, LONG to info.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportGetRenderInfoPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long).toInt() } /** * Sets the debug draw mode of a viewport. See [ViewportDebugDraw] for options. */ public fun viewportSetDebugDraw(viewport: RID, draw: ViewportDebugDraw): Unit { TransferContext.writeArguments(_RID to viewport, LONG to draw.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetDebugDrawPtr, NIL) } /** * Sets the measurement for the given [viewport] RID (obtained using [Viewport.getViewportRid]). * Once enabled, [viewportGetMeasuredRenderTimeCpu] and [viewportGetMeasuredRenderTimeGpu] will * return values greater than `0.0` when queried with the given [viewport]. */ public fun viewportSetMeasureRenderTime(viewport: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to viewport, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetMeasureRenderTimePtr, NIL) } /** * Returns the CPU time taken to render the last frame in milliseconds. This *only* includes time * spent in rendering-related operations; scripts' `_process` functions and other engine subsystems * are not included in this readout. To get a complete readout of CPU time spent to render the scene, * sum the render times of all viewports that are drawn every frame plus [getFrameSetupTimeCpu]. * Unlike [Engine.getFramesPerSecond], this method will accurately reflect CPU utilization even if * framerate is capped via V-Sync or [Engine.maxFps]. See also [viewportGetMeasuredRenderTimeGpu]. * **Note:** Requires measurements to be enabled on the specified [viewport] using * [viewportSetMeasureRenderTime]. Otherwise, this method returns `0.0`. */ public fun viewportGetMeasuredRenderTimeCpu(viewport: RID): Double { TransferContext.writeArguments(_RID to viewport) TransferContext.callMethod(rawPtr, MethodBindings.viewportGetMeasuredRenderTimeCpuPtr, DOUBLE) return (TransferContext.readReturnValue(DOUBLE, false) as Double) } /** * Returns the GPU time taken to render the last frame in milliseconds. To get a complete readout * of GPU time spent to render the scene, sum the render times of all viewports that are drawn every * frame. Unlike [Engine.getFramesPerSecond], this method accurately reflects GPU utilization even if * framerate is capped via V-Sync or [Engine.maxFps]. See also [viewportGetMeasuredRenderTimeGpu]. * **Note:** Requires measurements to be enabled on the specified [viewport] using * [viewportSetMeasureRenderTime]. Otherwise, this method returns `0.0`. * **Note:** When GPU utilization is low enough during a certain period of time, GPUs will * decrease their power state (which in turn decreases core and memory clock speeds). This can cause * the reported GPU time to increase if GPU utilization is kept low enough by a framerate cap * (compared to what it would be at the GPU's highest power state). Keep this in mind when * benchmarking using [viewportGetMeasuredRenderTimeGpu]. This behavior can be overridden in the * graphics driver settings at the cost of higher power usage. */ public fun viewportGetMeasuredRenderTimeGpu(viewport: RID): Double { TransferContext.writeArguments(_RID to viewport) TransferContext.callMethod(rawPtr, MethodBindings.viewportGetMeasuredRenderTimeGpuPtr, DOUBLE) return (TransferContext.readReturnValue(DOUBLE, false) as Double) } /** * Sets the Variable Rate Shading (VRS) mode for the viewport. If the GPU does not support VRS, * this property is ignored. Equivalent to [ProjectSettings.rendering/vrs/mode]. */ public fun viewportSetVrsMode(viewport: RID, mode: ViewportVRSMode): Unit { TransferContext.writeArguments(_RID to viewport, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetVrsModePtr, NIL) } /** * The texture to use when the VRS mode is set to [RenderingServer.VIEWPORT_VRS_TEXTURE]. * Equivalent to [ProjectSettings.rendering/vrs/texture]. */ public fun viewportSetVrsTexture(viewport: RID, texture: RID): Unit { TransferContext.writeArguments(_RID to viewport, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.viewportSetVrsTexturePtr, NIL) } /** * Creates an empty sky and adds it to the RenderingServer. It can be accessed with the RID that * is returned. This RID will be used in all `sky_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. */ public fun skyCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.skyCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the [radianceSize] of the sky specified by the [sky] RID (in pixels). Equivalent to * [Sky.radianceSize]. */ public fun skySetRadianceSize(sky: RID, radianceSize: Int): Unit { TransferContext.writeArguments(_RID to sky, LONG to radianceSize.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.skySetRadianceSizePtr, NIL) } /** * Sets the process [mode] of the sky specified by the [sky] RID. Equivalent to [Sky.processMode]. */ public fun skySetMode(sky: RID, mode: SkyMode): Unit { TransferContext.writeArguments(_RID to sky, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.skySetModePtr, NIL) } /** * Sets the material that the sky uses to render the background, ambient and reflection maps. */ public fun skySetMaterial(sky: RID, material: RID): Unit { TransferContext.writeArguments(_RID to sky, _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.skySetMaterialPtr, NIL) } /** * Generates and returns an [Image] containing the radiance map for the specified [sky] RID. This * supports built-in sky material and custom sky shaders. If [bakeIrradiance] is `true`, the * irradiance map is saved instead of the radiance map. The radiance map is used to render reflected * light, while the irradiance map is used to render ambient light. See also * [environmentBakePanorama]. * **Note:** The image is saved in linear color space without any tonemapping performed, which * means it will look too dark if viewed directly in an image editor. [energy] values above `1.0` can * be used to brighten the resulting image. * **Note:** [size] should be a 2:1 aspect ratio for the generated panorama to have square pixels. * For radiance maps, there is no point in using a height greater than [Sky.radianceSize], as it * won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no * point in going past a size of 128×64 pixels when saving an irradiance map. */ public fun skyBakePanorama( sky: RID, energy: Float, bakeIrradiance: Boolean, size: Vector2i, ): Image? { TransferContext.writeArguments(_RID to sky, DOUBLE to energy.toDouble(), BOOL to bakeIrradiance, VECTOR2I to size) TransferContext.callMethod(rawPtr, MethodBindings.skyBakePanoramaPtr, OBJECT) return (TransferContext.readReturnValue(OBJECT, true) as Image?) } /** * Creates an environment and adds it to the RenderingServer. It can be accessed with the RID that * is returned. This RID will be used in all `environment_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [Environment]. */ public fun environmentCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.environmentCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the environment's background mode. Equivalent to [Environment.backgroundMode]. */ public fun environmentSetBackground(env: RID, bg: EnvironmentBG): Unit { TransferContext.writeArguments(_RID to env, LONG to bg.id) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetBackgroundPtr, NIL) } /** * Sets the [Sky] to be used as the environment's background when using *BGMode* sky. Equivalent * to [Environment.sky]. */ public fun environmentSetSky(env: RID, sky: RID): Unit { TransferContext.writeArguments(_RID to env, _RID to sky) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSkyPtr, NIL) } /** * Sets a custom field of view for the background [Sky]. Equivalent to [Environment.skyCustomFov]. */ public fun environmentSetSkyCustomFov(env: RID, scale: Float): Unit { TransferContext.writeArguments(_RID to env, DOUBLE to scale.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSkyCustomFovPtr, NIL) } /** * Sets the rotation of the background [Sky] expressed as a [Basis]. Equivalent to * [Environment.skyRotation], where the rotation vector is used to construct the [Basis]. */ public fun environmentSetSkyOrientation(env: RID, orientation: Basis): Unit { TransferContext.writeArguments(_RID to env, BASIS to orientation) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSkyOrientationPtr, NIL) } /** * Color displayed for clear areas of the scene. Only effective if using the [ENV_BG_COLOR] * background mode. */ public fun environmentSetBgColor(env: RID, color: Color): Unit { TransferContext.writeArguments(_RID to env, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetBgColorPtr, NIL) } /** * Sets the intensity of the background color. */ public fun environmentSetBgEnergy( env: RID, multiplier: Float, exposureValue: Float, ): Unit { TransferContext.writeArguments(_RID to env, DOUBLE to multiplier.toDouble(), DOUBLE to exposureValue.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetBgEnergyPtr, NIL) } /** * Sets the maximum layer to use if using Canvas background mode. */ public fun environmentSetCanvasMaxLayer(env: RID, maxLayer: Int): Unit { TransferContext.writeArguments(_RID to env, LONG to maxLayer.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetCanvasMaxLayerPtr, NIL) } /** * Sets the values to be used for ambient light rendering. See [Environment] for more details. */ @JvmOverloads public fun environmentSetAmbientLight( env: RID, color: Color, ambient: EnvironmentAmbientSource = RenderingServer.EnvironmentAmbientSource.ENV_AMBIENT_SOURCE_BG, energy: Float = 1.0f, skyContibution: Float = 0.0f, reflectionSource: EnvironmentReflectionSource = RenderingServer.EnvironmentReflectionSource.ENV_REFLECTION_SOURCE_BG, ): Unit { TransferContext.writeArguments(_RID to env, COLOR to color, LONG to ambient.id, DOUBLE to energy.toDouble(), DOUBLE to skyContibution.toDouble(), LONG to reflectionSource.id) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetAmbientLightPtr, NIL) } /** * Configures glow for the specified environment RID. See `glow_*` properties in [Environment] for * more information. */ public fun environmentSetGlow( env: RID, enable: Boolean, levels: PackedFloat32Array, intensity: Float, strength: Float, mix: Float, bloomThreshold: Float, blendMode: EnvironmentGlowBlendMode, hdrBleedThreshold: Float, hdrBleedScale: Float, hdrLuminanceCap: Float, glowMapStrength: Float, glowMap: RID, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, PACKED_FLOAT_32_ARRAY to levels, DOUBLE to intensity.toDouble(), DOUBLE to strength.toDouble(), DOUBLE to mix.toDouble(), DOUBLE to bloomThreshold.toDouble(), LONG to blendMode.id, DOUBLE to hdrBleedThreshold.toDouble(), DOUBLE to hdrBleedScale.toDouble(), DOUBLE to hdrLuminanceCap.toDouble(), DOUBLE to glowMapStrength.toDouble(), _RID to glowMap) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetGlowPtr, NIL) } /** * Sets the variables to be used with the "tonemap" post-process effect. See [Environment] for * more details. */ public fun environmentSetTonemap( env: RID, toneMapper: EnvironmentToneMapper, exposure: Float, white: Float, ): Unit { TransferContext.writeArguments(_RID to env, LONG to toneMapper.id, DOUBLE to exposure.toDouble(), DOUBLE to white.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetTonemapPtr, NIL) } /** * Sets the values to be used with the "adjustments" post-process effect. See [Environment] for * more details. */ public fun environmentSetAdjustment( env: RID, enable: Boolean, brightness: Float, contrast: Float, saturation: Float, use1dColorCorrection: Boolean, colorCorrection: RID, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, DOUBLE to brightness.toDouble(), DOUBLE to contrast.toDouble(), DOUBLE to saturation.toDouble(), BOOL to use1dColorCorrection, _RID to colorCorrection) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetAdjustmentPtr, NIL) } /** * Sets the variables to be used with the screen-space reflections (SSR) post-process effect. See * [Environment] for more details. */ public fun environmentSetSsr( env: RID, enable: Boolean, maxSteps: Int, fadeIn: Float, fadeOut: Float, depthTolerance: Float, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, LONG to maxSteps.toLong(), DOUBLE to fadeIn.toDouble(), DOUBLE to fadeOut.toDouble(), DOUBLE to depthTolerance.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSsrPtr, NIL) } /** * Sets the variables to be used with the screen-space ambient occlusion (SSAO) post-process * effect. See [Environment] for more details. */ public fun environmentSetSsao( env: RID, enable: Boolean, radius: Float, intensity: Float, power: Float, detail: Float, horizon: Float, sharpness: Float, lightAffect: Float, aoChannelAffect: Float, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, DOUBLE to radius.toDouble(), DOUBLE to intensity.toDouble(), DOUBLE to power.toDouble(), DOUBLE to detail.toDouble(), DOUBLE to horizon.toDouble(), DOUBLE to sharpness.toDouble(), DOUBLE to lightAffect.toDouble(), DOUBLE to aoChannelAffect.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSsaoPtr, NIL) } /** * Configures fog for the specified environment RID. See `fog_*` properties in [Environment] for * more information. */ public fun environmentSetFog( env: RID, enable: Boolean, lightColor: Color, lightEnergy: Float, sunScatter: Float, density: Float, height: Float, heightDensity: Float, aerialPerspective: Float, skyAffect: Float, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, COLOR to lightColor, DOUBLE to lightEnergy.toDouble(), DOUBLE to sunScatter.toDouble(), DOUBLE to density.toDouble(), DOUBLE to height.toDouble(), DOUBLE to heightDensity.toDouble(), DOUBLE to aerialPerspective.toDouble(), DOUBLE to skyAffect.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetFogPtr, NIL) } /** * Configures signed distance field global illumination for the specified environment RID. See * `sdfgi_*` properties in [Environment] for more information. */ public fun environmentSetSdfgi( env: RID, enable: Boolean, cascades: Int, minCellSize: Float, yScale: EnvironmentSDFGIYScale, useOcclusion: Boolean, bounceFeedback: Float, readSky: Boolean, energy: Float, normalBias: Float, probeBias: Float, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, LONG to cascades.toLong(), DOUBLE to minCellSize.toDouble(), LONG to yScale.id, BOOL to useOcclusion, DOUBLE to bounceFeedback.toDouble(), BOOL to readSky, DOUBLE to energy.toDouble(), DOUBLE to normalBias.toDouble(), DOUBLE to probeBias.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSdfgiPtr, NIL) } /** * Sets the variables to be used with the volumetric fog post-process effect. See [Environment] * for more details. */ public fun environmentSetVolumetricFog( env: RID, enable: Boolean, density: Float, albedo: Color, emission: Color, emissionEnergy: Float, anisotropy: Float, length: Float, pDetailSpread: Float, giInject: Float, temporalReprojection: Boolean, temporalReprojectionAmount: Float, ambientInject: Float, skyAffect: Float, ): Unit { TransferContext.writeArguments(_RID to env, BOOL to enable, DOUBLE to density.toDouble(), COLOR to albedo, COLOR to emission, DOUBLE to emissionEnergy.toDouble(), DOUBLE to anisotropy.toDouble(), DOUBLE to length.toDouble(), DOUBLE to pDetailSpread.toDouble(), DOUBLE to giInject.toDouble(), BOOL to temporalReprojection, DOUBLE to temporalReprojectionAmount.toDouble(), DOUBLE to ambientInject.toDouble(), DOUBLE to skyAffect.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetVolumetricFogPtr, NIL) } /** * If [enable] is `true`, enables bicubic upscaling for glow which improves quality at the cost of * performance. Equivalent to [ProjectSettings.rendering/environment/glow/upscaleMode]. */ public fun environmentGlowSetUseBicubicUpscale(enable: Boolean): Unit { TransferContext.writeArguments(BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.environmentGlowSetUseBicubicUpscalePtr, NIL) } public fun environmentSetSsrRoughnessQuality(quality: EnvironmentSSRRoughnessQuality): Unit { TransferContext.writeArguments(LONG to quality.id) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSsrRoughnessQualityPtr, NIL) } /** * Sets the quality level of the screen-space ambient occlusion (SSAO) post-process effect. See * [Environment] for more details. */ public fun environmentSetSsaoQuality( quality: EnvironmentSSAOQuality, halfSize: Boolean, adaptiveTarget: Float, blurPasses: Int, fadeoutFrom: Float, fadeoutTo: Float, ): Unit { TransferContext.writeArguments(LONG to quality.id, BOOL to halfSize, DOUBLE to adaptiveTarget.toDouble(), LONG to blurPasses.toLong(), DOUBLE to fadeoutFrom.toDouble(), DOUBLE to fadeoutTo.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSsaoQualityPtr, NIL) } /** * Sets the quality level of the screen-space indirect lighting (SSIL) post-process effect. See * [Environment] for more details. */ public fun environmentSetSsilQuality( quality: EnvironmentSSILQuality, halfSize: Boolean, adaptiveTarget: Float, blurPasses: Int, fadeoutFrom: Float, fadeoutTo: Float, ): Unit { TransferContext.writeArguments(LONG to quality.id, BOOL to halfSize, DOUBLE to adaptiveTarget.toDouble(), LONG to blurPasses.toLong(), DOUBLE to fadeoutFrom.toDouble(), DOUBLE to fadeoutTo.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSsilQualityPtr, NIL) } /** * Sets the number of rays to throw per frame when computing signed distance field global * illumination. Equivalent to [ProjectSettings.rendering/globalIllumination/sdfgi/probeRayCount]. */ public fun environmentSetSdfgiRayCount(rayCount: EnvironmentSDFGIRayCount): Unit { TransferContext.writeArguments(LONG to rayCount.id) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSdfgiRayCountPtr, NIL) } /** * Sets the number of frames to use for converging signed distance field global illumination. * Equivalent to [ProjectSettings.rendering/globalIllumination/sdfgi/framesToConverge]. */ public fun environmentSetSdfgiFramesToConverge(frames: EnvironmentSDFGIFramesToConverge): Unit { TransferContext.writeArguments(LONG to frames.id) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSdfgiFramesToConvergePtr, NIL) } /** * Sets the update speed for dynamic lights' indirect lighting when computing signed distance * field global illumination. Equivalent to * [ProjectSettings.rendering/globalIllumination/sdfgi/framesToUpdateLights]. */ public fun environmentSetSdfgiFramesToUpdateLight(frames: EnvironmentSDFGIFramesToUpdateLight): Unit { TransferContext.writeArguments(LONG to frames.id) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetSdfgiFramesToUpdateLightPtr, NIL) } /** * Sets the resolution of the volumetric fog's froxel buffer. [size] is modified by the screen's * aspect ratio and then used to set the width and height of the buffer. While [depth] is directly * used to set the depth of the buffer. */ public fun environmentSetVolumetricFogVolumeSize(size: Int, depth: Int): Unit { TransferContext.writeArguments(LONG to size.toLong(), LONG to depth.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetVolumetricFogVolumeSizePtr, NIL) } /** * Enables filtering of the volumetric fog scattering buffer. This results in much smoother * volumes with very few under-sampling artifacts. */ public fun environmentSetVolumetricFogFilterActive(active: Boolean): Unit { TransferContext.writeArguments(BOOL to active) TransferContext.callMethod(rawPtr, MethodBindings.environmentSetVolumetricFogFilterActivePtr, NIL) } /** * Generates and returns an [Image] containing the radiance map for the specified [environment] * RID's sky. This supports built-in sky material and custom sky shaders. If [bakeIrradiance] is * `true`, the irradiance map is saved instead of the radiance map. The radiance map is used to * render reflected light, while the irradiance map is used to render ambient light. See also * [skyBakePanorama]. * **Note:** The image is saved in linear color space without any tonemapping performed, which * means it will look too dark if viewed directly in an image editor. * **Note:** [size] should be a 2:1 aspect ratio for the generated panorama to have square pixels. * For radiance maps, there is no point in using a height greater than [Sky.radianceSize], as it * won't increase detail. Irradiance maps only contain low-frequency data, so there is usually no * point in going past a size of 128×64 pixels when saving an irradiance map. */ public fun environmentBakePanorama( environment: RID, bakeIrradiance: Boolean, size: Vector2i, ): Image? { TransferContext.writeArguments(_RID to environment, BOOL to bakeIrradiance, VECTOR2I to size) TransferContext.callMethod(rawPtr, MethodBindings.environmentBakePanoramaPtr, OBJECT) return (TransferContext.readReturnValue(OBJECT, true) as Image?) } /** * Sets the screen-space roughness limiter parameters, such as whether it should be enabled and * its thresholds. Equivalent to * [ProjectSettings.rendering/antiAliasing/screenSpaceRoughnessLimiter/enabled], * [ProjectSettings.rendering/antiAliasing/screenSpaceRoughnessLimiter/amount] and * [ProjectSettings.rendering/antiAliasing/screenSpaceRoughnessLimiter/limit]. */ public fun screenSpaceRoughnessLimiterSetActive( enable: Boolean, amount: Float, limit: Float, ): Unit { TransferContext.writeArguments(BOOL to enable, DOUBLE to amount.toDouble(), DOUBLE to limit.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.screenSpaceRoughnessLimiterSetActivePtr, NIL) } /** * Sets [ProjectSettings.rendering/environment/subsurfaceScattering/subsurfaceScatteringQuality] * to use when rendering materials that have subsurface scattering enabled. */ public fun subSurfaceScatteringSetQuality(quality: SubSurfaceScatteringQuality): Unit { TransferContext.writeArguments(LONG to quality.id) TransferContext.callMethod(rawPtr, MethodBindings.subSurfaceScatteringSetQualityPtr, NIL) } /** * Sets the [ProjectSettings.rendering/environment/subsurfaceScattering/subsurfaceScatteringScale] * and [ProjectSettings.rendering/environment/subsurfaceScattering/subsurfaceScatteringDepthScale] to * use when rendering materials that have subsurface scattering enabled. */ public fun subSurfaceScatteringSetScale(scale: Float, depthScale: Float): Unit { TransferContext.writeArguments(DOUBLE to scale.toDouble(), DOUBLE to depthScale.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.subSurfaceScatteringSetScalePtr, NIL) } /** * Creates a camera attributes object and adds it to the RenderingServer. It can be accessed with * the RID that is returned. This RID will be used in all `camera_attributes_` RenderingServer * functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [CameraAttributes]. */ public fun cameraAttributesCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.cameraAttributesCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the quality level of the DOF blur effect to one of the options in [DOFBlurQuality]. * [useJitter] can be used to jitter samples taken during the blur pass to hide artifacts at the cost * of looking more fuzzy. */ public fun cameraAttributesSetDofBlurQuality(quality: DOFBlurQuality, useJitter: Boolean): Unit { TransferContext.writeArguments(LONG to quality.id, BOOL to useJitter) TransferContext.callMethod(rawPtr, MethodBindings.cameraAttributesSetDofBlurQualityPtr, NIL) } /** * Sets the shape of the DOF bokeh pattern. Different shapes may be used to achieve artistic * effect, or to meet performance targets. For more detail on available options see [DOFBokehShape]. */ public fun cameraAttributesSetDofBlurBokehShape(shape: DOFBokehShape): Unit { TransferContext.writeArguments(LONG to shape.id) TransferContext.callMethod(rawPtr, MethodBindings.cameraAttributesSetDofBlurBokehShapePtr, NIL) } /** * Sets the parameters to use with the DOF blur effect. These parameters take on the same meaning * as their counterparts in [CameraAttributesPractical]. */ public fun cameraAttributesSetDofBlur( cameraAttributes: RID, farEnable: Boolean, farDistance: Float, farTransition: Float, nearEnable: Boolean, nearDistance: Float, nearTransition: Float, amount: Float, ): Unit { TransferContext.writeArguments(_RID to cameraAttributes, BOOL to farEnable, DOUBLE to farDistance.toDouble(), DOUBLE to farTransition.toDouble(), BOOL to nearEnable, DOUBLE to nearDistance.toDouble(), DOUBLE to nearTransition.toDouble(), DOUBLE to amount.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.cameraAttributesSetDofBlurPtr, NIL) } /** * Sets the exposure values that will be used by the renderers. The normalization amount is used * to bake a given Exposure Value (EV) into rendering calculations to reduce the dynamic range of the * scene. * The normalization factor can be calculated from exposure value (EV100) as follows: * [codeblock] * func get_exposure_normalization(float ev100): * return 1.0 / (pow(2.0, ev100) * 1.2) * [/codeblock] * The exposure value can be calculated from aperture (in f-stops), shutter speed (in seconds), * and sensitivity (in ISO) as follows: * [codeblock] * func get_exposure(float aperture, float shutter_speed, float sensitivity): * return log2((aperture * aperture) / shutterSpeed * (100.0 / sensitivity)) * [/codeblock] */ public fun cameraAttributesSetExposure( cameraAttributes: RID, multiplier: Float, normalization: Float, ): Unit { TransferContext.writeArguments(_RID to cameraAttributes, DOUBLE to multiplier.toDouble(), DOUBLE to normalization.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.cameraAttributesSetExposurePtr, NIL) } /** * Sets the parameters to use with the auto-exposure effect. These parameters take on the same * meaning as their counterparts in [CameraAttributes] and [CameraAttributesPractical]. */ public fun cameraAttributesSetAutoExposure( cameraAttributes: RID, enable: Boolean, minSensitivity: Float, maxSensitivity: Float, speed: Float, scale: Float, ): Unit { TransferContext.writeArguments(_RID to cameraAttributes, BOOL to enable, DOUBLE to minSensitivity.toDouble(), DOUBLE to maxSensitivity.toDouble(), DOUBLE to speed.toDouble(), DOUBLE to scale.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.cameraAttributesSetAutoExposurePtr, NIL) } /** * Creates a scenario and adds it to the RenderingServer. It can be accessed with the RID that is * returned. This RID will be used in all `scenario_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * The scenario is the 3D world that all the visual instances exist in. */ public fun scenarioCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.scenarioCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the environment that will be used with this scenario. See also [Environment]. */ public fun scenarioSetEnvironment(scenario: RID, environment: RID): Unit { TransferContext.writeArguments(_RID to scenario, _RID to environment) TransferContext.callMethod(rawPtr, MethodBindings.scenarioSetEnvironmentPtr, NIL) } /** * Sets the fallback environment to be used by this scenario. The fallback environment is used if * no environment is set. Internally, this is used by the editor to provide a default environment. */ public fun scenarioSetFallbackEnvironment(scenario: RID, environment: RID): Unit { TransferContext.writeArguments(_RID to scenario, _RID to environment) TransferContext.callMethod(rawPtr, MethodBindings.scenarioSetFallbackEnvironmentPtr, NIL) } /** * Sets the camera attributes ([effects]) that will be used with this scenario. See also * [CameraAttributes]. */ public fun scenarioSetCameraAttributes(scenario: RID, effects: RID): Unit { TransferContext.writeArguments(_RID to scenario, _RID to effects) TransferContext.callMethod(rawPtr, MethodBindings.scenarioSetCameraAttributesPtr, NIL) } /** * Creates a visual instance, adds it to the RenderingServer, and sets both base and scenario. It * can be accessed with the RID that is returned. This RID will be used in all `instance_*` * RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. This is a shorthand for using [instanceCreate] and setting the base and scenario * manually. */ public fun instanceCreate2(base: RID, scenario: RID): RID { TransferContext.writeArguments(_RID to base, _RID to scenario) TransferContext.callMethod(rawPtr, MethodBindings.instanceCreate2Ptr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Creates a visual instance and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `instance_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * An instance is a way of placing a 3D object in the scenario. Objects like particles, meshes, * reflection probes and decals need to be associated with an instance to be visible in the scenario * using [instanceSetBase]. * **Note:** The equivalent node is [VisualInstance3D]. */ public fun instanceCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.instanceCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the base of the instance. A base can be any of the 3D objects that are created in the * RenderingServer that can be displayed. For example, any of the light types, mesh, multimesh, * particle system, reflection probe, decal, lightmap, voxel GI and visibility notifiers are all * types that can be set as the base of an instance in order to be displayed in the scenario. */ public fun instanceSetBase(instance: RID, base: RID): Unit { TransferContext.writeArguments(_RID to instance, _RID to base) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetBasePtr, NIL) } /** * Sets the scenario that the instance is in. The scenario is the 3D world that the objects will * be displayed in. */ public fun instanceSetScenario(instance: RID, scenario: RID): Unit { TransferContext.writeArguments(_RID to instance, _RID to scenario) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetScenarioPtr, NIL) } /** * Sets the render layers that this instance will be drawn to. Equivalent to * [VisualInstance3D.layers]. */ public fun instanceSetLayerMask(instance: RID, mask: Long): Unit { TransferContext.writeArguments(_RID to instance, LONG to mask) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetLayerMaskPtr, NIL) } /** * Sets the sorting offset and switches between using the bounding box or instance origin for * depth sorting. */ public fun instanceSetPivotData( instance: RID, sortingOffset: Float, useAabbCenter: Boolean, ): Unit { TransferContext.writeArguments(_RID to instance, DOUBLE to sortingOffset.toDouble(), BOOL to useAabbCenter) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetPivotDataPtr, NIL) } /** * Sets the world space transform of the instance. Equivalent to [Node3D.globalTransform]. */ public fun instanceSetTransform(instance: RID, transform: Transform3D): Unit { TransferContext.writeArguments(_RID to instance, TRANSFORM3D to transform) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetTransformPtr, NIL) } /** * Attaches a unique Object ID to instance. Object ID must be attached to instance for proper * culling with [instancesCullAabb], [instancesCullConvex], and [instancesCullRay]. */ public fun instanceAttachObjectInstanceId(instance: RID, id: Long): Unit { TransferContext.writeArguments(_RID to instance, LONG to id) TransferContext.callMethod(rawPtr, MethodBindings.instanceAttachObjectInstanceIdPtr, NIL) } /** * Sets the weight for a given blend shape associated with this instance. */ public fun instanceSetBlendShapeWeight( instance: RID, shape: Int, weight: Float, ): Unit { TransferContext.writeArguments(_RID to instance, LONG to shape.toLong(), DOUBLE to weight.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetBlendShapeWeightPtr, NIL) } /** * Sets the override material of a specific surface. Equivalent to * [MeshInstance3D.setSurfaceOverrideMaterial]. */ public fun instanceSetSurfaceOverrideMaterial( instance: RID, surface: Int, material: RID, ): Unit { TransferContext.writeArguments(_RID to instance, LONG to surface.toLong(), _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetSurfaceOverrideMaterialPtr, NIL) } /** * Sets whether an instance is drawn or not. Equivalent to [Node3D.visible]. */ public fun instanceSetVisible(instance: RID, visible: Boolean): Unit { TransferContext.writeArguments(_RID to instance, BOOL to visible) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetVisiblePtr, NIL) } /** * Sets the transparency for the given geometry instance. Equivalent to * [GeometryInstance3D.transparency]. * A transparency of `0.0` is fully opaque, while `1.0` is fully transparent. Values greater than * `0.0` (exclusive) will force the geometry's materials to go through the transparent pipeline, * which is slower to render and can exhibit rendering issues due to incorrect transparency sorting. * However, unlike using a transparent material, setting [transparency] to a value greater than `0.0` * (exclusive) will *not* disable shadow rendering. * In spatial shaders, `1.0 - transparency` is set as the default value of the `ALPHA` built-in. * **Note:** [transparency] is clamped between `0.0` and `1.0`, so this property cannot be used to * make transparent materials more opaque than they originally are. */ public fun instanceGeometrySetTransparency(instance: RID, transparency: Float): Unit { TransferContext.writeArguments(_RID to instance, DOUBLE to transparency.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetTransparencyPtr, NIL) } /** * Sets a custom AABB to use when culling objects from the view frustum. Equivalent to setting * [GeometryInstance3D.customAabb]. */ public fun instanceSetCustomAabb(instance: RID, aabb: AABB): Unit { TransferContext.writeArguments(_RID to instance, godot.core.VariantType.AABB to aabb) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetCustomAabbPtr, NIL) } /** * Attaches a skeleton to an instance. Removes the previous skeleton from the instance. */ public fun instanceAttachSkeleton(instance: RID, skeleton: RID): Unit { TransferContext.writeArguments(_RID to instance, _RID to skeleton) TransferContext.callMethod(rawPtr, MethodBindings.instanceAttachSkeletonPtr, NIL) } /** * Sets a margin to increase the size of the AABB when culling objects from the view frustum. This * allows you to avoid culling objects that fall outside the view frustum. Equivalent to * [GeometryInstance3D.extraCullMargin]. */ public fun instanceSetExtraVisibilityMargin(instance: RID, margin: Float): Unit { TransferContext.writeArguments(_RID to instance, DOUBLE to margin.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetExtraVisibilityMarginPtr, NIL) } /** * Sets the visibility parent for the given instance. Equivalent to [Node3D.visibilityParent]. */ public fun instanceSetVisibilityParent(instance: RID, parent: RID): Unit { TransferContext.writeArguments(_RID to instance, _RID to parent) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetVisibilityParentPtr, NIL) } /** * If `true`, ignores both frustum and occlusion culling on the specified 3D geometry instance. * This is not the same as [GeometryInstance3D.ignoreOcclusionCulling], which only ignores occlusion * culling and leaves frustum culling intact. */ public fun instanceSetIgnoreCulling(instance: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to instance, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.instanceSetIgnoreCullingPtr, NIL) } /** * Sets the flag for a given [InstanceFlags]. See [InstanceFlags] for more details. */ public fun instanceGeometrySetFlag( instance: RID, flag: InstanceFlags, enabled: Boolean, ): Unit { TransferContext.writeArguments(_RID to instance, LONG to flag.id, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetFlagPtr, NIL) } /** * Sets the shadow casting setting to one of [ShadowCastingSetting]. Equivalent to * [GeometryInstance3D.castShadow]. */ public fun instanceGeometrySetCastShadowsSetting(instance: RID, shadowCastingSetting: ShadowCastingSetting): Unit { TransferContext.writeArguments(_RID to instance, LONG to shadowCastingSetting.id) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetCastShadowsSettingPtr, NIL) } /** * Sets a material that will override the material for all surfaces on the mesh associated with * this instance. Equivalent to [GeometryInstance3D.materialOverride]. */ public fun instanceGeometrySetMaterialOverride(instance: RID, material: RID): Unit { TransferContext.writeArguments(_RID to instance, _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetMaterialOverridePtr, NIL) } /** * Sets a material that will be rendered for all surfaces on top of active materials for the mesh * associated with this instance. Equivalent to [GeometryInstance3D.materialOverlay]. */ public fun instanceGeometrySetMaterialOverlay(instance: RID, material: RID): Unit { TransferContext.writeArguments(_RID to instance, _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetMaterialOverlayPtr, NIL) } /** * Sets the visibility range values for the given geometry instance. Equivalent to * [GeometryInstance3D.visibilityRangeBegin] and related properties. */ public fun instanceGeometrySetVisibilityRange( instance: RID, min: Float, max: Float, minMargin: Float, maxMargin: Float, fadeMode: VisibilityRangeFadeMode, ): Unit { TransferContext.writeArguments(_RID to instance, DOUBLE to min.toDouble(), DOUBLE to max.toDouble(), DOUBLE to minMargin.toDouble(), DOUBLE to maxMargin.toDouble(), LONG to fadeMode.id) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetVisibilityRangePtr, NIL) } /** * Sets the lightmap GI instance to use for the specified 3D geometry instance. The lightmap UV * scale for the specified instance (equivalent to [GeometryInstance3D.giLightmapScale]) and lightmap * atlas slice must also be specified. */ public fun instanceGeometrySetLightmap( instance: RID, lightmap: RID, lightmapUvScale: Rect2, lightmapSlice: Int, ): Unit { TransferContext.writeArguments(_RID to instance, _RID to lightmap, RECT2 to lightmapUvScale, LONG to lightmapSlice.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetLightmapPtr, NIL) } /** * Sets the level of detail bias to use when rendering the specified 3D geometry instance. Higher * values result in higher detail from further away. Equivalent to [GeometryInstance3D.lodBias]. */ public fun instanceGeometrySetLodBias(instance: RID, lodBias: Float): Unit { TransferContext.writeArguments(_RID to instance, DOUBLE to lodBias.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetLodBiasPtr, NIL) } /** * Sets the per-instance shader uniform on the specified 3D geometry instance. Equivalent to * [GeometryInstance3D.setInstanceShaderParameter]. */ public fun instanceGeometrySetShaderParameter( instance: RID, parameter: StringName, `value`: Any?, ): Unit { TransferContext.writeArguments(_RID to instance, STRING_NAME to parameter, ANY to value) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometrySetShaderParameterPtr, NIL) } /** * Returns the value of the per-instance shader uniform from the specified 3D geometry instance. * Equivalent to [GeometryInstance3D.getInstanceShaderParameter]. * **Note:** Per-instance shader parameter names are case-sensitive. */ public fun instanceGeometryGetShaderParameter(instance: RID, parameter: StringName): Any? { TransferContext.writeArguments(_RID to instance, STRING_NAME to parameter) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometryGetShaderParameterPtr, ANY) return (TransferContext.readReturnValue(ANY, true) as Any?) } /** * Returns the default value of the per-instance shader uniform from the specified 3D geometry * instance. Equivalent to [GeometryInstance3D.getInstanceShaderParameter]. */ public fun instanceGeometryGetShaderParameterDefaultValue(instance: RID, parameter: StringName): Any? { TransferContext.writeArguments(_RID to instance, STRING_NAME to parameter) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometryGetShaderParameterDefaultValuePtr, ANY) return (TransferContext.readReturnValue(ANY, true) as Any?) } /** * Returns a dictionary of per-instance shader uniform names of the per-instance shader uniform * from the specified 3D geometry instance. The returned dictionary is in PropertyInfo format, with * the keys `name`, `class_name`, `type`, `hint`, `hint_string` and `usage`. Equivalent to * [GeometryInstance3D.getInstanceShaderParameter]. */ public fun instanceGeometryGetShaderParameterList(instance: RID): VariantArray<Dictionary<Any?, Any?>> { TransferContext.writeArguments(_RID to instance) TransferContext.callMethod(rawPtr, MethodBindings.instanceGeometryGetShaderParameterListPtr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<Dictionary<Any?, Any?>>) } /** * Returns an array of object IDs intersecting with the provided AABB. Only 3D nodes that inherit * from [VisualInstance3D] are considered, such as [MeshInstance3D] or [DirectionalLight3D]. Use * [@GlobalScope.instanceFromId] to obtain the actual nodes. A scenario RID must be provided, which * is available in the [World3D] you want to query. This forces an update for all resources queued to * update. * **Warning:** This function is primarily intended for editor usage. For in-game use cases, * prefer physics collision. */ @JvmOverloads public fun instancesCullAabb(aabb: AABB, scenario: RID = RID()): PackedInt64Array { TransferContext.writeArguments(godot.core.VariantType.AABB to aabb, _RID to scenario) TransferContext.callMethod(rawPtr, MethodBindings.instancesCullAabbPtr, PACKED_INT_64_ARRAY) return (TransferContext.readReturnValue(PACKED_INT_64_ARRAY, false) as PackedInt64Array) } /** * Returns an array of object IDs intersecting with the provided 3D ray. Only 3D nodes that * inherit from [VisualInstance3D] are considered, such as [MeshInstance3D] or [DirectionalLight3D]. * Use [@GlobalScope.instanceFromId] to obtain the actual nodes. A scenario RID must be provided, * which is available in the [World3D] you want to query. This forces an update for all resources * queued to update. * **Warning:** This function is primarily intended for editor usage. For in-game use cases, * prefer physics collision. */ @JvmOverloads public fun instancesCullRay( from: Vector3, to: Vector3, scenario: RID = RID(), ): PackedInt64Array { TransferContext.writeArguments(VECTOR3 to from, VECTOR3 to to, _RID to scenario) TransferContext.callMethod(rawPtr, MethodBindings.instancesCullRayPtr, PACKED_INT_64_ARRAY) return (TransferContext.readReturnValue(PACKED_INT_64_ARRAY, false) as PackedInt64Array) } /** * Returns an array of object IDs intersecting with the provided convex shape. Only 3D nodes that * inherit from [VisualInstance3D] are considered, such as [MeshInstance3D] or [DirectionalLight3D]. * Use [@GlobalScope.instanceFromId] to obtain the actual nodes. A scenario RID must be provided, * which is available in the [World3D] you want to query. This forces an update for all resources * queued to update. * **Warning:** This function is primarily intended for editor usage. For in-game use cases, * prefer physics collision. */ @JvmOverloads public fun instancesCullConvex(convex: VariantArray<Plane>, scenario: RID = RID()): PackedInt64Array { TransferContext.writeArguments(ARRAY to convex, _RID to scenario) TransferContext.callMethod(rawPtr, MethodBindings.instancesCullConvexPtr, PACKED_INT_64_ARRAY) return (TransferContext.readReturnValue(PACKED_INT_64_ARRAY, false) as PackedInt64Array) } /** * Bakes the material data of the Mesh passed in the [base] parameter with optional * [materialOverrides] to a set of [Image]s of size [imageSize]. Returns an array of [Image]s * containing material properties as specified in [BakeChannels]. */ public fun bakeRenderUv2( base: RID, materialOverrides: VariantArray<RID>, imageSize: Vector2i, ): VariantArray<Image> { TransferContext.writeArguments(_RID to base, ARRAY to materialOverrides, VECTOR2I to imageSize) TransferContext.callMethod(rawPtr, MethodBindings.bakeRenderUv2Ptr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<Image>) } /** * Creates a canvas and returns the assigned [RID]. It can be accessed with the RID that is * returned. This RID will be used in all `canvas_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * Canvas has no [Resource] or [Node] equivalent. */ public fun canvasCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.canvasCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * A copy of the canvas item will be drawn with a local offset of the mirroring [Vector2]. */ public fun canvasSetItemMirroring( canvas: RID, item: RID, mirroring: Vector2, ): Unit { TransferContext.writeArguments(_RID to canvas, _RID to item, VECTOR2 to mirroring) TransferContext.callMethod(rawPtr, MethodBindings.canvasSetItemMirroringPtr, NIL) } /** * Modulates all colors in the given canvas. */ public fun canvasSetModulate(canvas: RID, color: Color): Unit { TransferContext.writeArguments(_RID to canvas, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasSetModulatePtr, NIL) } public fun canvasSetDisableScale(disable: Boolean): Unit { TransferContext.writeArguments(BOOL to disable) TransferContext.callMethod(rawPtr, MethodBindings.canvasSetDisableScalePtr, NIL) } /** * Creates a canvas texture and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `canvas_texture_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. See also [texture2dCreate]. * **Note:** The equivalent resource is [CanvasTexture] and is only meant to be used in 2D * rendering, not 3D. */ public fun canvasTextureCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.canvasTextureCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the [channel]'s [texture] for the canvas texture specified by the [canvasTexture] RID. * Equivalent to [CanvasTexture.diffuseTexture], [CanvasTexture.normalTexture] and * [CanvasTexture.specularTexture]. */ public fun canvasTextureSetChannel( canvasTexture: RID, channel: CanvasTextureChannel, texture: RID, ): Unit { TransferContext.writeArguments(_RID to canvasTexture, LONG to channel.id, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasTextureSetChannelPtr, NIL) } /** * Sets the [baseColor] and [shininess] to use for the canvas texture specified by the * [canvasTexture] RID. Equivalent to [CanvasTexture.specularColor] and * [CanvasTexture.specularShininess]. */ public fun canvasTextureSetShadingParameters( canvasTexture: RID, baseColor: Color, shininess: Float, ): Unit { TransferContext.writeArguments(_RID to canvasTexture, COLOR to baseColor, DOUBLE to shininess.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasTextureSetShadingParametersPtr, NIL) } /** * Sets the texture [filter] mode to use for the canvas texture specified by the [canvasTexture] * RID. */ public fun canvasTextureSetTextureFilter(canvasTexture: RID, filter: CanvasItemTextureFilter): Unit { TransferContext.writeArguments(_RID to canvasTexture, LONG to filter.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasTextureSetTextureFilterPtr, NIL) } /** * Sets the texture [repeat] mode to use for the canvas texture specified by the [canvasTexture] * RID. */ public fun canvasTextureSetTextureRepeat(canvasTexture: RID, repeat: CanvasItemTextureRepeat): Unit { TransferContext.writeArguments(_RID to canvasTexture, LONG to repeat.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasTextureSetTextureRepeatPtr, NIL) } /** * Creates a new CanvasItem instance and returns its [RID]. It can be accessed with the RID that * is returned. This RID will be used in all `canvas_item_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [CanvasItem]. */ public fun canvasItemCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.canvasItemCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets a parent [CanvasItem] to the [CanvasItem]. The item will inherit transform, modulation and * visibility from its parent, like [CanvasItem] nodes in the scene tree. */ public fun canvasItemSetParent(item: RID, parent: RID): Unit { TransferContext.writeArguments(_RID to item, _RID to parent) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetParentPtr, NIL) } /** * Sets the default texture filter mode for the canvas item specified by the [item] RID. * Equivalent to [CanvasItem.textureFilter]. */ public fun canvasItemSetDefaultTextureFilter(item: RID, filter: CanvasItemTextureFilter): Unit { TransferContext.writeArguments(_RID to item, LONG to filter.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetDefaultTextureFilterPtr, NIL) } /** * Sets the default texture repeat mode for the canvas item specified by the [item] RID. * Equivalent to [CanvasItem.textureRepeat]. */ public fun canvasItemSetDefaultTextureRepeat(item: RID, repeat: CanvasItemTextureRepeat): Unit { TransferContext.writeArguments(_RID to item, LONG to repeat.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetDefaultTextureRepeatPtr, NIL) } /** * Sets the visibility of the [CanvasItem]. */ public fun canvasItemSetVisible(item: RID, visible: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to visible) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetVisiblePtr, NIL) } /** * Sets the light [mask] for the canvas item specified by the [item] RID. Equivalent to * [CanvasItem.lightMask]. */ public fun canvasItemSetLightMask(item: RID, mask: Int): Unit { TransferContext.writeArguments(_RID to item, LONG to mask.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetLightMaskPtr, NIL) } /** * Sets the rendering visibility layer associated with this [CanvasItem]. Only [Viewport] nodes * with a matching rendering mask will render this [CanvasItem]. */ public fun canvasItemSetVisibilityLayer(item: RID, visibilityLayer: Long): Unit { TransferContext.writeArguments(_RID to item, LONG to visibilityLayer) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetVisibilityLayerPtr, NIL) } /** * Sets the [transform] of the canvas item specified by the [item] RID. This affects where and how * the item will be drawn. Child canvas items' transforms are multiplied by their parent's transform. * Equivalent to [Node2D.transform]. */ public fun canvasItemSetTransform(item: RID, transform: Transform2D): Unit { TransferContext.writeArguments(_RID to item, TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetTransformPtr, NIL) } /** * If [clip] is `true`, makes the canvas item specified by the [item] RID not draw anything * outside of its rect's coordinates. This clipping is fast, but works only with axis-aligned * rectangles. This means that rotation is ignored by the clipping rectangle. For more advanced * clipping shapes, use [canvasItemSetCanvasGroupMode] instead. * **Note:** The equivalent node functionality is found in [Label.clipText], [RichTextLabel] * (always enabled) and more. */ public fun canvasItemSetClip(item: RID, clip: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to clip) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetClipPtr, NIL) } /** * If [enabled] is `true`, enables multichannel signed distance field rendering mode for the * canvas item specified by the [item] RID. This is meant to be used for font rendering, or with * specially generated images using [url=https://github.com/Chlumsky/msdfgen]msdfgen[/url]. */ public fun canvasItemSetDistanceFieldMode(item: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetDistanceFieldModePtr, NIL) } /** * If [useCustomRect] is `true`, sets the custom visibility rectangle (used for culling) to [rect] * for the canvas item specified by [item]. Setting a custom visibility rect can reduce CPU load when * drawing lots of 2D instances. If [useCustomRect] is `false`, automatically computes a visibility * rectangle based on the canvas item's draw commands. */ @JvmOverloads public fun canvasItemSetCustomRect( item: RID, useCustomRect: Boolean, rect: Rect2 = Rect2(0.0, 0.0, 0.0, 0.0), ): Unit { TransferContext.writeArguments(_RID to item, BOOL to useCustomRect, RECT2 to rect) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetCustomRectPtr, NIL) } /** * Multiplies the color of the canvas item specified by the [item] RID, while affecting its * children. See also [canvasItemSetSelfModulate]. Equivalent to [CanvasItem.modulate]. */ public fun canvasItemSetModulate(item: RID, color: Color): Unit { TransferContext.writeArguments(_RID to item, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetModulatePtr, NIL) } /** * Multiplies the color of the canvas item specified by the [item] RID, without affecting its * children. See also [canvasItemSetModulate]. Equivalent to [CanvasItem.selfModulate]. */ public fun canvasItemSetSelfModulate(item: RID, color: Color): Unit { TransferContext.writeArguments(_RID to item, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetSelfModulatePtr, NIL) } /** * If [enabled] is `true`, draws the canvas item specified by the [item] RID behind its parent. * Equivalent to [CanvasItem.showBehindParent]. */ public fun canvasItemSetDrawBehindParent(item: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetDrawBehindParentPtr, NIL) } /** * Draws a line on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawLine]. */ @JvmOverloads public fun canvasItemAddLine( item: RID, from: Vector2, to: Vector2, color: Color, width: Float = -1.0f, antialiased: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to item, VECTOR2 to from, VECTOR2 to to, COLOR to color, DOUBLE to width.toDouble(), BOOL to antialiased) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddLinePtr, NIL) } /** * Draws a 2D polyline on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawPolyline] and [CanvasItem.drawPolylineColors]. */ @JvmOverloads public fun canvasItemAddPolyline( item: RID, points: PackedVector2Array, colors: PackedColorArray, width: Float = -1.0f, antialiased: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to item, PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, DOUBLE to width.toDouble(), BOOL to antialiased) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddPolylinePtr, NIL) } /** * Draws a 2D multiline on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawMultiline] and [CanvasItem.drawMultilineColors]. */ @JvmOverloads public fun canvasItemAddMultiline( item: RID, points: PackedVector2Array, colors: PackedColorArray, width: Float = -1.0f, ): Unit { TransferContext.writeArguments(_RID to item, PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, DOUBLE to width.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddMultilinePtr, NIL) } /** * Draws a rectangle on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawRect]. */ public fun canvasItemAddRect( item: RID, rect: Rect2, color: Color, ): Unit { TransferContext.writeArguments(_RID to item, RECT2 to rect, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddRectPtr, NIL) } /** * Draws a circle on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawCircle]. */ public fun canvasItemAddCircle( item: RID, pos: Vector2, radius: Float, color: Color, ): Unit { TransferContext.writeArguments(_RID to item, VECTOR2 to pos, DOUBLE to radius.toDouble(), COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddCirclePtr, NIL) } /** * Draws a 2D textured rectangle on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawTextureRect] and [Texture2D.drawRect]. */ @JvmOverloads public fun canvasItemAddTextureRect( item: RID, rect: Rect2, texture: RID, tile: Boolean = false, modulate: Color = Color(Color(1, 1, 1, 1)), transpose: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to item, RECT2 to rect, _RID to texture, BOOL to tile, COLOR to modulate, BOOL to transpose) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddTextureRectPtr, NIL) } /** * See also [CanvasItem.drawMsdfTextureRectRegion]. */ @JvmOverloads public fun canvasItemAddMsdfTextureRectRegion( item: RID, rect: Rect2, texture: RID, srcRect: Rect2, modulate: Color = Color(Color(1, 1, 1, 1)), outlineSize: Int = 0, pxRange: Float = 1.0f, scale: Float = 1.0f, ): Unit { TransferContext.writeArguments(_RID to item, RECT2 to rect, _RID to texture, RECT2 to srcRect, COLOR to modulate, LONG to outlineSize.toLong(), DOUBLE to pxRange.toDouble(), DOUBLE to scale.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddMsdfTextureRectRegionPtr, NIL) } /** * See also [CanvasItem.drawLcdTextureRectRegion]. */ public fun canvasItemAddLcdTextureRectRegion( item: RID, rect: Rect2, texture: RID, srcRect: Rect2, modulate: Color, ): Unit { TransferContext.writeArguments(_RID to item, RECT2 to rect, _RID to texture, RECT2 to srcRect, COLOR to modulate) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddLcdTextureRectRegionPtr, NIL) } /** * Draws the specified region of a 2D textured rectangle on the [CanvasItem] pointed to by the * [item] [RID]. See also [CanvasItem.drawTextureRectRegion] and [Texture2D.drawRectRegion]. */ @JvmOverloads public fun canvasItemAddTextureRectRegion( item: RID, rect: Rect2, texture: RID, srcRect: Rect2, modulate: Color = Color(Color(1, 1, 1, 1)), transpose: Boolean = false, clipUv: Boolean = true, ): Unit { TransferContext.writeArguments(_RID to item, RECT2 to rect, _RID to texture, RECT2 to srcRect, COLOR to modulate, BOOL to transpose, BOOL to clipUv) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddTextureRectRegionPtr, NIL) } /** * Draws a nine-patch rectangle on the [CanvasItem] pointed to by the [item] [RID]. */ @JvmOverloads public fun canvasItemAddNinePatch( item: RID, rect: Rect2, source: Rect2, texture: RID, topleft: Vector2, bottomright: Vector2, xAxisMode: NinePatchAxisMode = RenderingServer.NinePatchAxisMode.NINE_PATCH_STRETCH, yAxisMode: NinePatchAxisMode = RenderingServer.NinePatchAxisMode.NINE_PATCH_STRETCH, drawCenter: Boolean = true, modulate: Color = Color(Color(1, 1, 1, 1)), ): Unit { TransferContext.writeArguments(_RID to item, RECT2 to rect, RECT2 to source, _RID to texture, VECTOR2 to topleft, VECTOR2 to bottomright, LONG to xAxisMode.id, LONG to yAxisMode.id, BOOL to drawCenter, COLOR to modulate) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddNinePatchPtr, NIL) } /** * Draws a 2D primitive on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawPrimitive]. */ public fun canvasItemAddPrimitive( item: RID, points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array, texture: RID, ): Unit { TransferContext.writeArguments(_RID to item, PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, PACKED_VECTOR2_ARRAY to uvs, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddPrimitivePtr, NIL) } /** * Draws a 2D polygon on the [CanvasItem] pointed to by the [item] [RID]. If you need more * flexibility (such as being able to use bones), use [canvasItemAddTriangleArray] instead. See also * [CanvasItem.drawPolygon]. */ @JvmOverloads public fun canvasItemAddPolygon( item: RID, points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array = PackedVector2Array(), texture: RID = RID(), ): Unit { TransferContext.writeArguments(_RID to item, PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, PACKED_VECTOR2_ARRAY to uvs, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddPolygonPtr, NIL) } /** * Draws a triangle array on the [CanvasItem] pointed to by the [item] [RID]. This is internally * used by [Line2D] and [StyleBoxFlat] for rendering. [canvasItemAddTriangleArray] is highly * flexible, but more complex to use than [canvasItemAddPolygon]. * **Note:** [count] is unused and can be left unspecified. */ @JvmOverloads public fun canvasItemAddTriangleArray( item: RID, indices: PackedInt32Array, points: PackedVector2Array, colors: PackedColorArray, uvs: PackedVector2Array = PackedVector2Array(), bones: PackedInt32Array = PackedInt32Array(), weights: PackedFloat32Array = PackedFloat32Array(), texture: RID = RID(), count: Int = -1, ): Unit { TransferContext.writeArguments(_RID to item, PACKED_INT_32_ARRAY to indices, PACKED_VECTOR2_ARRAY to points, PACKED_COLOR_ARRAY to colors, PACKED_VECTOR2_ARRAY to uvs, PACKED_INT_32_ARRAY to bones, PACKED_FLOAT_32_ARRAY to weights, _RID to texture, LONG to count.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddTriangleArrayPtr, NIL) } /** * Draws a mesh created with [meshCreate] with given [transform], [modulate] color, and [texture]. * This is used internally by [MeshInstance2D]. */ @JvmOverloads public fun canvasItemAddMesh( item: RID, mesh: RID, transform: Transform2D = Transform2D(), modulate: Color = Color(Color(1, 1, 1, 1)), texture: RID = RID(), ): Unit { TransferContext.writeArguments(_RID to item, _RID to mesh, TRANSFORM2D to transform, COLOR to modulate, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddMeshPtr, NIL) } /** * Draws a 2D [MultiMesh] on the [CanvasItem] pointed to by the [item] [RID]. See also * [CanvasItem.drawMultimesh]. */ @JvmOverloads public fun canvasItemAddMultimesh( item: RID, mesh: RID, texture: RID = RID(), ): Unit { TransferContext.writeArguments(_RID to item, _RID to mesh, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddMultimeshPtr, NIL) } /** * Draws particles on the [CanvasItem] pointed to by the [item] [RID]. */ public fun canvasItemAddParticles( item: RID, particles: RID, texture: RID, ): Unit { TransferContext.writeArguments(_RID to item, _RID to particles, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddParticlesPtr, NIL) } /** * Sets a [Transform2D] that will be used to transform subsequent canvas item commands. */ public fun canvasItemAddSetTransform(item: RID, transform: Transform2D): Unit { TransferContext.writeArguments(_RID to item, TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddSetTransformPtr, NIL) } /** * If [ignore] is `true`, ignore clipping on items drawn with this canvas item until this is * called again with [ignore] set to false. */ public fun canvasItemAddClipIgnore(item: RID, ignore: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to ignore) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddClipIgnorePtr, NIL) } /** * Subsequent drawing commands will be ignored unless they fall within the specified animation * slice. This is a faster way to implement animations that loop on background rather than redrawing * constantly. */ @JvmOverloads public fun canvasItemAddAnimationSlice( item: RID, animationLength: Double, sliceBegin: Double, sliceEnd: Double, offset: Double = 0.0, ): Unit { TransferContext.writeArguments(_RID to item, DOUBLE to animationLength, DOUBLE to sliceBegin, DOUBLE to sliceEnd, DOUBLE to offset) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemAddAnimationSlicePtr, NIL) } /** * If [enabled] is `true`, child nodes with the lowest Y position are drawn before those with a * higher Y position. Y-sorting only affects children that inherit from the canvas item specified by * the [item] RID, not the canvas item itself. Equivalent to [CanvasItem.ySortEnabled]. */ public fun canvasItemSetSortChildrenByY(item: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetSortChildrenByYPtr, NIL) } /** * Sets the [CanvasItem]'s Z index, i.e. its draw order (lower indexes are drawn first). */ public fun canvasItemSetZIndex(item: RID, zIndex: Int): Unit { TransferContext.writeArguments(_RID to item, LONG to zIndex.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetZIndexPtr, NIL) } /** * If this is enabled, the Z index of the parent will be added to the children's Z index. */ public fun canvasItemSetZAsRelativeToParent(item: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetZAsRelativeToParentPtr, NIL) } /** * Sets the [CanvasItem] to copy a rect to the backbuffer. */ public fun canvasItemSetCopyToBackbuffer( item: RID, enabled: Boolean, rect: Rect2, ): Unit { TransferContext.writeArguments(_RID to item, BOOL to enabled, RECT2 to rect) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetCopyToBackbufferPtr, NIL) } /** * Clears the [CanvasItem] and removes all commands in it. */ public fun canvasItemClear(item: RID): Unit { TransferContext.writeArguments(_RID to item) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemClearPtr, NIL) } /** * Sets the index for the [CanvasItem]. */ public fun canvasItemSetDrawIndex(item: RID, index: Int): Unit { TransferContext.writeArguments(_RID to item, LONG to index.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetDrawIndexPtr, NIL) } /** * Sets a new [material] to the canvas item specified by the [item] RID. Equivalent to * [CanvasItem.material]. */ public fun canvasItemSetMaterial(item: RID, material: RID): Unit { TransferContext.writeArguments(_RID to item, _RID to material) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetMaterialPtr, NIL) } /** * Sets if the [CanvasItem] uses its parent's material. */ public fun canvasItemSetUseParentMaterial(item: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to item, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetUseParentMaterialPtr, NIL) } /** * Sets the given [CanvasItem] as visibility notifier. [area] defines the area of detecting * visibility. [enterCallable] is called when the [CanvasItem] enters the screen, [exitCallable] is * called when the [CanvasItem] exits the screen. If [enable] is `false`, the item will no longer * function as notifier. * This method can be used to manually mimic [VisibleOnScreenNotifier2D]. */ public fun canvasItemSetVisibilityNotifier( item: RID, enable: Boolean, area: Rect2, enterCallable: Callable, exitCallable: Callable, ): Unit { TransferContext.writeArguments(_RID to item, BOOL to enable, RECT2 to area, CALLABLE to enterCallable, CALLABLE to exitCallable) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetVisibilityNotifierPtr, NIL) } /** * Sets the canvas group mode used during 2D rendering for the canvas item specified by the [item] * RID. For faster but more limited clipping, use [canvasItemSetClip] instead. * **Note:** The equivalent node functionality is found in [CanvasGroup] and * [CanvasItem.clipChildren]. */ @JvmOverloads public fun canvasItemSetCanvasGroupMode( item: RID, mode: CanvasGroupMode, clearMargin: Float = 5.0f, fitEmpty: Boolean = false, fitMargin: Float = 0.0f, blurMipmaps: Boolean = false, ): Unit { TransferContext.writeArguments(_RID to item, LONG to mode.id, DOUBLE to clearMargin.toDouble(), BOOL to fitEmpty, DOUBLE to fitMargin.toDouble(), BOOL to blurMipmaps) TransferContext.callMethod(rawPtr, MethodBindings.canvasItemSetCanvasGroupModePtr, NIL) } /** * Returns the bounding rectangle for a canvas item in local space, as calculated by the renderer. * This bound is used internally for culling. * **Warning:** This function is intended for debugging in the editor, and will pass through and * return a zero [Rect2] in exported projects. */ public fun debugCanvasItemGetRect(item: RID): Rect2 { TransferContext.writeArguments(_RID to item) TransferContext.callMethod(rawPtr, MethodBindings.debugCanvasItemGetRectPtr, RECT2) return (TransferContext.readReturnValue(RECT2, false) as Rect2) } /** * Creates a canvas light and adds it to the RenderingServer. It can be accessed with the RID that * is returned. This RID will be used in all `canvas_light_*` RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [Light2D]. */ public fun canvasLightCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.canvasLightCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Attaches the canvas light to the canvas. Removes it from its previous canvas. */ public fun canvasLightAttachToCanvas(light: RID, canvas: RID): Unit { TransferContext.writeArguments(_RID to light, _RID to canvas) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightAttachToCanvasPtr, NIL) } /** * Enables or disables a canvas light. */ public fun canvasLightSetEnabled(light: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to light, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetEnabledPtr, NIL) } /** * Sets the scale factor of a [PointLight2D]'s texture. Equivalent to [PointLight2D.textureScale]. */ public fun canvasLightSetTextureScale(light: RID, scale: Float): Unit { TransferContext.writeArguments(_RID to light, DOUBLE to scale.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetTextureScalePtr, NIL) } /** * Sets the canvas light's [Transform2D]. */ public fun canvasLightSetTransform(light: RID, transform: Transform2D): Unit { TransferContext.writeArguments(_RID to light, TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetTransformPtr, NIL) } /** * Sets the texture to be used by a [PointLight2D]. Equivalent to [PointLight2D.texture]. */ public fun canvasLightSetTexture(light: RID, texture: RID): Unit { TransferContext.writeArguments(_RID to light, _RID to texture) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetTexturePtr, NIL) } /** * Sets the offset of a [PointLight2D]'s texture. Equivalent to [PointLight2D.offset]. */ public fun canvasLightSetTextureOffset(light: RID, offset: Vector2): Unit { TransferContext.writeArguments(_RID to light, VECTOR2 to offset) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetTextureOffsetPtr, NIL) } /** * Sets the color for a light. */ public fun canvasLightSetColor(light: RID, color: Color): Unit { TransferContext.writeArguments(_RID to light, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetColorPtr, NIL) } /** * Sets a canvas light's height. */ public fun canvasLightSetHeight(light: RID, height: Float): Unit { TransferContext.writeArguments(_RID to light, DOUBLE to height.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetHeightPtr, NIL) } /** * Sets a canvas light's energy. */ public fun canvasLightSetEnergy(light: RID, energy: Float): Unit { TransferContext.writeArguments(_RID to light, DOUBLE to energy.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetEnergyPtr, NIL) } /** * Sets the Z range of objects that will be affected by this light. Equivalent to * [Light2D.rangeZMin] and [Light2D.rangeZMax]. */ public fun canvasLightSetZRange( light: RID, minZ: Int, maxZ: Int, ): Unit { TransferContext.writeArguments(_RID to light, LONG to minZ.toLong(), LONG to maxZ.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetZRangePtr, NIL) } /** * The layer range that gets rendered with this light. */ public fun canvasLightSetLayerRange( light: RID, minLayer: Int, maxLayer: Int, ): Unit { TransferContext.writeArguments(_RID to light, LONG to minLayer.toLong(), LONG to maxLayer.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetLayerRangePtr, NIL) } /** * The light mask. See [LightOccluder2D] for more information on light masks. */ public fun canvasLightSetItemCullMask(light: RID, mask: Int): Unit { TransferContext.writeArguments(_RID to light, LONG to mask.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetItemCullMaskPtr, NIL) } /** * The binary mask used to determine which layers this canvas light's shadows affects. See * [LightOccluder2D] for more information on light masks. */ public fun canvasLightSetItemShadowCullMask(light: RID, mask: Int): Unit { TransferContext.writeArguments(_RID to light, LONG to mask.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetItemShadowCullMaskPtr, NIL) } /** * The mode of the light, see [CanvasLightMode] constants. */ public fun canvasLightSetMode(light: RID, mode: CanvasLightMode): Unit { TransferContext.writeArguments(_RID to light, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetModePtr, NIL) } /** * Enables or disables the canvas light's shadow. */ public fun canvasLightSetShadowEnabled(light: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to light, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetShadowEnabledPtr, NIL) } /** * Sets the canvas light's shadow's filter, see [CanvasLightShadowFilter] constants. */ public fun canvasLightSetShadowFilter(light: RID, filter: CanvasLightShadowFilter): Unit { TransferContext.writeArguments(_RID to light, LONG to filter.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetShadowFilterPtr, NIL) } /** * Sets the color of the canvas light's shadow. */ public fun canvasLightSetShadowColor(light: RID, color: Color): Unit { TransferContext.writeArguments(_RID to light, COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetShadowColorPtr, NIL) } /** * Smoothens the shadow. The lower, the smoother. */ public fun canvasLightSetShadowSmooth(light: RID, smooth: Float): Unit { TransferContext.writeArguments(_RID to light, DOUBLE to smooth.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetShadowSmoothPtr, NIL) } /** * Sets the blend mode for the given canvas light. See [CanvasLightBlendMode] for options. * Equivalent to [Light2D.blendMode]. */ public fun canvasLightSetBlendMode(light: RID, mode: CanvasLightBlendMode): Unit { TransferContext.writeArguments(_RID to light, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightSetBlendModePtr, NIL) } /** * Creates a light occluder and adds it to the RenderingServer. It can be accessed with the RID * that is returned. This RID will be used in all `canvas_light_occluder_*` RenderingServer * functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent node is [LightOccluder2D]. */ public fun canvasLightOccluderCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Attaches a light occluder to the canvas. Removes it from its previous canvas. */ public fun canvasLightOccluderAttachToCanvas(occluder: RID, canvas: RID): Unit { TransferContext.writeArguments(_RID to occluder, _RID to canvas) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderAttachToCanvasPtr, NIL) } /** * Enables or disables light occluder. */ public fun canvasLightOccluderSetEnabled(occluder: RID, enabled: Boolean): Unit { TransferContext.writeArguments(_RID to occluder, BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderSetEnabledPtr, NIL) } /** * Sets a light occluder's polygon. */ public fun canvasLightOccluderSetPolygon(occluder: RID, polygon: RID): Unit { TransferContext.writeArguments(_RID to occluder, _RID to polygon) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderSetPolygonPtr, NIL) } public fun canvasLightOccluderSetAsSdfCollision(occluder: RID, enable: Boolean): Unit { TransferContext.writeArguments(_RID to occluder, BOOL to enable) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderSetAsSdfCollisionPtr, NIL) } /** * Sets a light occluder's [Transform2D]. */ public fun canvasLightOccluderSetTransform(occluder: RID, transform: Transform2D): Unit { TransferContext.writeArguments(_RID to occluder, TRANSFORM2D to transform) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderSetTransformPtr, NIL) } /** * The light mask. See [LightOccluder2D] for more information on light masks. */ public fun canvasLightOccluderSetLightMask(occluder: RID, mask: Int): Unit { TransferContext.writeArguments(_RID to occluder, LONG to mask.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasLightOccluderSetLightMaskPtr, NIL) } /** * Creates a new light occluder polygon and adds it to the RenderingServer. It can be accessed * with the RID that is returned. This RID will be used in all `canvas_occluder_polygon_*` * RenderingServer functions. * Once finished with your RID, you will want to free the RID using the RenderingServer's * [freeRid] method. * **Note:** The equivalent resource is [OccluderPolygon2D]. */ public fun canvasOccluderPolygonCreate(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.canvasOccluderPolygonCreatePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets the shape of the occluder polygon. */ public fun canvasOccluderPolygonSetShape( occluderPolygon: RID, shape: PackedVector2Array, closed: Boolean, ): Unit { TransferContext.writeArguments(_RID to occluderPolygon, PACKED_VECTOR2_ARRAY to shape, BOOL to closed) TransferContext.callMethod(rawPtr, MethodBindings.canvasOccluderPolygonSetShapePtr, NIL) } /** * Sets an occluder polygons cull mode. See [CanvasOccluderPolygonCullMode] constants. */ public fun canvasOccluderPolygonSetCullMode(occluderPolygon: RID, mode: CanvasOccluderPolygonCullMode): Unit { TransferContext.writeArguments(_RID to occluderPolygon, LONG to mode.id) TransferContext.callMethod(rawPtr, MethodBindings.canvasOccluderPolygonSetCullModePtr, NIL) } /** * Sets the [ProjectSettings.rendering/2d/shadowAtlas/size] to use for [Light2D] shadow rendering * (in pixels). The value is rounded up to the nearest power of 2. */ public fun canvasSetShadowTextureSize(size: Int): Unit { TransferContext.writeArguments(LONG to size.toLong()) TransferContext.callMethod(rawPtr, MethodBindings.canvasSetShadowTextureSizePtr, NIL) } /** * Creates a new global shader uniform. * **Note:** Global shader parameter names are case-sensitive. */ public fun globalShaderParameterAdd( name: StringName, type: GlobalShaderParameterType, defaultValue: Any?, ): Unit { TransferContext.writeArguments(STRING_NAME to name, LONG to type.id, ANY to defaultValue) TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterAddPtr, NIL) } /** * Removes the global shader uniform specified by [name]. */ public fun globalShaderParameterRemove(name: StringName): Unit { TransferContext.writeArguments(STRING_NAME to name) TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterRemovePtr, NIL) } /** * Returns the list of global shader uniform names. * **Note:** [globalShaderParameterGet] has a large performance penalty as the rendering thread * needs to synchronize with the calling thread, which is slow. Do not use this method during * gameplay to avoid stuttering. If you need to read values in a script after setting them, consider * creating an autoload where you store the values you need to query at the same time you're setting * them as global parameters. */ public fun globalShaderParameterGetList(): VariantArray<StringName> { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterGetListPtr, ARRAY) return (TransferContext.readReturnValue(ARRAY, false) as VariantArray<StringName>) } /** * Sets the global shader uniform [name] to [value]. */ public fun globalShaderParameterSet(name: StringName, `value`: Any?): Unit { TransferContext.writeArguments(STRING_NAME to name, ANY to value) TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterSetPtr, NIL) } /** * Overrides the global shader uniform [name] with [value]. Equivalent to the * [ShaderGlobalsOverride] node. */ public fun globalShaderParameterSetOverride(name: StringName, `value`: Any?): Unit { TransferContext.writeArguments(STRING_NAME to name, ANY to value) TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterSetOverridePtr, NIL) } /** * Returns the value of the global shader uniform specified by [name]. * **Note:** [globalShaderParameterGet] has a large performance penalty as the rendering thread * needs to synchronize with the calling thread, which is slow. Do not use this method during * gameplay to avoid stuttering. If you need to read values in a script after setting them, consider * creating an autoload where you store the values you need to query at the same time you're setting * them as global parameters. */ public fun globalShaderParameterGet(name: StringName): Any? { TransferContext.writeArguments(STRING_NAME to name) TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterGetPtr, ANY) return (TransferContext.readReturnValue(ANY, true) as Any?) } /** * Returns the type associated to the global shader uniform specified by [name]. * **Note:** [globalShaderParameterGet] has a large performance penalty as the rendering thread * needs to synchronize with the calling thread, which is slow. Do not use this method during * gameplay to avoid stuttering. If you need to read values in a script after setting them, consider * creating an autoload where you store the values you need to query at the same time you're setting * them as global parameters. */ public fun globalShaderParameterGetType(name: StringName): GlobalShaderParameterType { TransferContext.writeArguments(STRING_NAME to name) TransferContext.callMethod(rawPtr, MethodBindings.globalShaderParameterGetTypePtr, LONG) return RenderingServer.GlobalShaderParameterType.from(TransferContext.readReturnValue(LONG) as Long) } /** * Tries to free an object in the RenderingServer. To avoid memory leaks, this should be called * after using an object as memory management does not occur automatically when using RenderingServer * directly. */ public fun freeRid(rid: RID): Unit { TransferContext.writeArguments(_RID to rid) TransferContext.callMethod(rawPtr, MethodBindings.freeRidPtr, NIL) } /** * Schedules a callback to the given callable after a frame has been drawn. */ public fun requestFrameDrawnCallback(callable: Callable): Unit { TransferContext.writeArguments(CALLABLE to callable) TransferContext.callMethod(rawPtr, MethodBindings.requestFrameDrawnCallbackPtr, NIL) } /** * Returns `true` if changes have been made to the RenderingServer's data. [forceDraw] is usually * called if this happens. */ public fun hasChanged(): Boolean { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.hasChangedPtr, BOOL) return (TransferContext.readReturnValue(BOOL, false) as Boolean) } /** * Returns a statistic about the rendering engine which can be used for performance profiling. See * [RenderingServer.RenderingInfo] for a list of values that can be queried. See also * [viewportGetRenderInfo], which returns information specific to a viewport. * **Note:** Only 3D rendering is currently taken into account by some of these values, such as * the number of draw calls. * **Note:** Rendering information is not available until at least 2 frames have been rendered by * the engine. If rendering information is not available, [getRenderingInfo] returns `0`. To print * rendering information in `_ready()` successfully, use the following: * [codeblock] * func _ready(): * for _i in 2: * await get_tree().process_frame * * print(RenderingServer.get_rendering_info(RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME)) * [/codeblock] */ public fun getRenderingInfo(info: RenderingInfo): Long { TransferContext.writeArguments(LONG to info.id) TransferContext.callMethod(rawPtr, MethodBindings.getRenderingInfoPtr, LONG) return (TransferContext.readReturnValue(LONG, false) as Long) } /** * Returns the name of the video adapter (e.g. "GeForce GTX 1080/PCIe/SSE2"). * **Note:** When running a headless or server binary, this function returns an empty string. * **Note:** On the web platform, some browsers such as Firefox may report a different, fixed GPU * name such as "GeForce GTX 980" (regardless of the user's actual GPU model). This is done to make * fingerprinting more difficult. */ public fun getVideoAdapterName(): String { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getVideoAdapterNamePtr, STRING) return (TransferContext.readReturnValue(STRING, false) as String) } /** * Returns the vendor of the video adapter (e.g. "NVIDIA Corporation"). * **Note:** When running a headless or server binary, this function returns an empty string. */ public fun getVideoAdapterVendor(): String { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getVideoAdapterVendorPtr, STRING) return (TransferContext.readReturnValue(STRING, false) as String) } /** * Returns the type of the video adapter. Since dedicated graphics cards from a given generation * will *usually* be significantly faster than integrated graphics made in the same generation, the * device type can be used as a basis for automatic graphics settings adjustment. However, this is * not always true, so make sure to provide users with a way to manually override graphics settings. * **Note:** When using the OpenGL backend or when running in headless mode, this function always * returns [RenderingDevice.DEVICE_TYPE_OTHER]. */ public fun getVideoAdapterType(): RenderingDevice.DeviceType { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getVideoAdapterTypePtr, LONG) return RenderingDevice.DeviceType.from(TransferContext.readReturnValue(LONG) as Long) } /** * Returns the version of the graphics video adapter *currently in use* (e.g. "1.2.189" for * Vulkan, "3.3.0 NVIDIA 510.60.02" for OpenGL). This version may be different from the actual latest * version supported by the hardware, as Godot may not always request the latest version. See also * [OS.getVideoAdapterDriverInfo]. * **Note:** When running a headless or server binary, this function returns an empty string. */ public fun getVideoAdapterApiVersion(): String { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getVideoAdapterApiVersionPtr, STRING) return (TransferContext.readReturnValue(STRING, false) as String) } /** * Returns a mesh of a sphere with the given number of horizontal subdivisions, vertical * subdivisions and radius. See also [getTestCube]. */ public fun makeSphereMesh( latitudes: Int, longitudes: Int, radius: Float, ): RID { TransferContext.writeArguments(LONG to latitudes.toLong(), LONG to longitudes.toLong(), DOUBLE to radius.toDouble()) TransferContext.callMethod(rawPtr, MethodBindings.makeSphereMeshPtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns the RID of the test cube. This mesh will be created and returned on the first call to * [getTestCube], then it will be cached for subsequent calls. See also [makeSphereMesh]. */ public fun getTestCube(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getTestCubePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns the RID of a 256×256 texture with a testing pattern on it (in [Image.FORMAT_RGB8] * format). This texture will be created and returned on the first call to [getTestTexture], then it * will be cached for subsequent calls. See also [getWhiteTexture]. * Example of getting the test texture and applying it to a [Sprite2D] node: * [codeblock] * var texture_rid = RenderingServer.get_test_texture() * var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid)) * $Sprite2D.texture = texture * [/codeblock] */ public fun getTestTexture(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getTestTexturePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Returns the ID of a 4×4 white texture (in [Image.FORMAT_RGB8] format). This texture will be * created and returned on the first call to [getWhiteTexture], then it will be cached for subsequent * calls. See also [getTestTexture]. * Example of getting the white texture and applying it to a [Sprite2D] node: * [codeblock] * var texture_rid = RenderingServer.get_white_texture() * var texture = ImageTexture.create_from_image(RenderingServer.texture_2d_get(texture_rid)) * $Sprite2D.texture = texture * [/codeblock] */ public fun getWhiteTexture(): RID { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getWhiteTexturePtr, _RID) return (TransferContext.readReturnValue(_RID, false) as RID) } /** * Sets a boot image. The color defines the background color. If [scale] is `true`, the image will * be scaled to fit the screen size. If [useFilter] is `true`, the image will be scaled with linear * interpolation. If [useFilter] is `false`, the image will be scaled with nearest-neighbor * interpolation. */ @JvmOverloads public fun setBootImage( image: Image, color: Color, scale: Boolean, useFilter: Boolean = true, ): Unit { TransferContext.writeArguments(OBJECT to image, COLOR to color, BOOL to scale, BOOL to useFilter) TransferContext.callMethod(rawPtr, MethodBindings.setBootImagePtr, NIL) } /** * Returns the default clear color which is used when a specific clear color has not been * selected. See also [setDefaultClearColor]. */ public fun getDefaultClearColor(): Color { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getDefaultClearColorPtr, COLOR) return (TransferContext.readReturnValue(COLOR, false) as Color) } /** * Sets the default clear color which is used when a specific clear color has not been selected. * See also [getDefaultClearColor]. */ public fun setDefaultClearColor(color: Color): Unit { TransferContext.writeArguments(COLOR to color) TransferContext.callMethod(rawPtr, MethodBindings.setDefaultClearColorPtr, NIL) } /** * Not yet implemented. Always returns `false`. */ public fun hasFeature(feature: Features): Boolean { TransferContext.writeArguments(LONG to feature.id) TransferContext.callMethod(rawPtr, MethodBindings.hasFeaturePtr, BOOL) return (TransferContext.readReturnValue(BOOL, false) as Boolean) } /** * Returns `true` if the OS supports a certain [feature]. Features might be `s3tc`, `etc`, and * `etc2`. */ public fun hasOsFeature(feature: String): Boolean { TransferContext.writeArguments(STRING to feature) TransferContext.callMethod(rawPtr, MethodBindings.hasOsFeaturePtr, BOOL) return (TransferContext.readReturnValue(BOOL, false) as Boolean) } /** * This method is currently unimplemented and does nothing if called with [generate] set to * `true`. */ public fun setDebugGenerateWireframes(generate: Boolean): Unit { TransferContext.writeArguments(BOOL to generate) TransferContext.callMethod(rawPtr, MethodBindings.setDebugGenerateWireframesPtr, NIL) } public fun isRenderLoopEnabled(): Boolean { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.isRenderLoopEnabledPtr, BOOL) return (TransferContext.readReturnValue(BOOL, false) as Boolean) } public fun setRenderLoopEnabled(enabled: Boolean): Unit { TransferContext.writeArguments(BOOL to enabled) TransferContext.callMethod(rawPtr, MethodBindings.setRenderLoopEnabledPtr, NIL) } /** * Returns the time taken to setup rendering on the CPU in milliseconds. This value is shared * across all viewports and does *not* require [viewportSetMeasureRenderTime] to be enabled on a * viewport to be queried. See also [viewportGetMeasuredRenderTimeCpu]. */ public fun getFrameSetupTimeCpu(): Double { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getFrameSetupTimeCpuPtr, DOUBLE) return (TransferContext.readReturnValue(DOUBLE, false) as Double) } /** * Forces a synchronization between the CPU and GPU, which may be required in certain cases. Only * call this when needed, as CPU-GPU synchronization has a performance cost. */ public fun forceSync(): Unit { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.forceSyncPtr, NIL) } /** * Forces redrawing of all viewports at once. Must be called from the main thread. */ @JvmOverloads public fun forceDraw(swapBuffers: Boolean = true, frameStep: Double = 0.0): Unit { TransferContext.writeArguments(BOOL to swapBuffers, DOUBLE to frameStep) TransferContext.callMethod(rawPtr, MethodBindings.forceDrawPtr, NIL) } /** * Returns the global RenderingDevice. * **Note:** When using the OpenGL backend or when running in headless mode, this function always * returns `null`. */ public fun getRenderingDevice(): RenderingDevice? { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.getRenderingDevicePtr, OBJECT) return (TransferContext.readReturnValue(OBJECT, true) as RenderingDevice?) } /** * Creates a RenderingDevice that can be used to do draw and compute operations on a separate * thread. Cannot draw to the screen nor share data with the global RenderingDevice. * **Note:** When using the OpenGL backend or when running in headless mode, this function always * returns `null`. */ public fun createLocalRenderingDevice(): RenderingDevice? { TransferContext.writeArguments() TransferContext.callMethod(rawPtr, MethodBindings.createLocalRenderingDevicePtr, OBJECT) return (TransferContext.readReturnValue(OBJECT, true) as RenderingDevice?) } /** * As the RenderingServer actual logic may run on an separate thread, accessing its internals from * the main (or any other) thread will result in errors. To make it easier to run code that can * safely access the rendering internals (such as [RenderingDevice] and similar RD classes), push a * callable via this function so it will be executed on the render thread. */ public fun callOnRenderThread(callable: Callable): Unit { TransferContext.writeArguments(CALLABLE to callable) TransferContext.callMethod(rawPtr, MethodBindings.callOnRenderThreadPtr, NIL) } public enum class TextureLayeredType( id: Long, ) { /** * Array of 2-dimensional textures (see [Texture2DArray]). */ TEXTURE_LAYERED_2D_ARRAY(0), /** * Cubemap texture (see [Cubemap]). */ TEXTURE_LAYERED_CUBEMAP(1), /** * Array of cubemap textures (see [CubemapArray]). */ TEXTURE_LAYERED_CUBEMAP_ARRAY(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CubeMapLayer( id: Long, ) { /** * Left face of a [Cubemap]. */ CUBEMAP_LAYER_LEFT(0), /** * Right face of a [Cubemap]. */ CUBEMAP_LAYER_RIGHT(1), /** * Bottom face of a [Cubemap]. */ CUBEMAP_LAYER_BOTTOM(2), /** * Top face of a [Cubemap]. */ CUBEMAP_LAYER_TOP(3), /** * Front face of a [Cubemap]. */ CUBEMAP_LAYER_FRONT(4), /** * Back face of a [Cubemap]. */ CUBEMAP_LAYER_BACK(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ShaderMode( id: Long, ) { /** * Shader is a 3D shader. */ SHADER_SPATIAL(0), /** * Shader is a 2D shader. */ SHADER_CANVAS_ITEM(1), /** * Shader is a particle shader (can be used in both 2D and 3D). */ SHADER_PARTICLES(2), /** * Shader is a 3D sky shader. */ SHADER_SKY(3), /** * Shader is a 3D fog shader. */ SHADER_FOG(4), /** * Represents the size of the [ShaderMode] enum. */ SHADER_MAX(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ArrayType( id: Long, ) { /** * Array is a vertex position array. */ ARRAY_VERTEX(0), /** * Array is a normal array. */ ARRAY_NORMAL(1), /** * Array is a tangent array. */ ARRAY_TANGENT(2), /** * Array is a vertex color array. */ ARRAY_COLOR(3), /** * Array is a UV coordinates array. */ ARRAY_TEX_UV(4), /** * Array is a UV coordinates array for the second set of UV coordinates. */ ARRAY_TEX_UV2(5), /** * Array is a custom data array for the first set of custom data. */ ARRAY_CUSTOM0(6), /** * Array is a custom data array for the second set of custom data. */ ARRAY_CUSTOM1(7), /** * Array is a custom data array for the third set of custom data. */ ARRAY_CUSTOM2(8), /** * Array is a custom data array for the fourth set of custom data. */ ARRAY_CUSTOM3(9), /** * Array contains bone information. */ ARRAY_BONES(10), /** * Array is weight information. */ ARRAY_WEIGHTS(11), /** * Array is an index array. */ ARRAY_INDEX(12), /** * Represents the size of the [ArrayType] enum. */ ARRAY_MAX(13), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ArrayCustomFormat( id: Long, ) { /** * Custom data array contains 8-bit-per-channel red/green/blue/alpha color data. Values are * normalized, unsigned floating-point in the `[0.0, 1.0]` range. */ ARRAY_CUSTOM_RGBA8_UNORM(0), /** * Custom data array contains 8-bit-per-channel red/green/blue/alpha color data. Values are * normalized, signed floating-point in the `[-1.0, 1.0]` range. */ ARRAY_CUSTOM_RGBA8_SNORM(1), /** * Custom data array contains 16-bit-per-channel red/green color data. Values are floating-point * in half precision. */ ARRAY_CUSTOM_RG_HALF(2), /** * Custom data array contains 16-bit-per-channel red/green/blue/alpha color data. Values are * floating-point in half precision. */ ARRAY_CUSTOM_RGBA_HALF(3), /** * Custom data array contains 32-bit-per-channel red color data. Values are floating-point in * single precision. */ ARRAY_CUSTOM_R_FLOAT(4), /** * Custom data array contains 32-bit-per-channel red/green color data. Values are floating-point * in single precision. */ ARRAY_CUSTOM_RG_FLOAT(5), /** * Custom data array contains 32-bit-per-channel red/green/blue color data. Values are * floating-point in single precision. */ ARRAY_CUSTOM_RGB_FLOAT(6), /** * Custom data array contains 32-bit-per-channel red/green/blue/alpha color data. Values are * floating-point in single precision. */ ARRAY_CUSTOM_RGBA_FLOAT(7), /** * Represents the size of the [ArrayCustomFormat] enum. */ ARRAY_CUSTOM_MAX(8), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public sealed interface ArrayFormat { public val flag: Long public infix fun or(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.or(other.flag)) public infix fun or(other: Long): ArrayFormat = ArrayFormatValue(flag.or(other)) public infix fun xor(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.xor(other.flag)) public infix fun xor(other: Long): ArrayFormat = ArrayFormatValue(flag.xor(other)) public infix fun and(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.and(other.flag)) public infix fun and(other: Long): ArrayFormat = ArrayFormatValue(flag.and(other)) public operator fun plus(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.plus(other.flag)) public operator fun plus(other: Long): ArrayFormat = ArrayFormatValue(flag.plus(other)) public operator fun minus(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.minus(other.flag)) public operator fun minus(other: Long): ArrayFormat = ArrayFormatValue(flag.minus(other)) public operator fun times(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.times(other.flag)) public operator fun times(other: Long): ArrayFormat = ArrayFormatValue(flag.times(other)) public operator fun div(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.div(other.flag)) public operator fun div(other: Long): ArrayFormat = ArrayFormatValue(flag.div(other)) public operator fun rem(other: ArrayFormat): ArrayFormat = ArrayFormatValue(flag.rem(other.flag)) public operator fun rem(other: Long): ArrayFormat = ArrayFormatValue(flag.rem(other)) public fun unaryPlus(): ArrayFormat = ArrayFormatValue(flag.unaryPlus()) public fun unaryMinus(): ArrayFormat = ArrayFormatValue(flag.unaryMinus()) public fun inv(): ArrayFormat = ArrayFormatValue(flag.inv()) public infix fun shl(bits: Int): ArrayFormat = ArrayFormatValue(flag shl bits) public infix fun shr(bits: Int): ArrayFormat = ArrayFormatValue(flag shr bits) public infix fun ushr(bits: Int): ArrayFormat = ArrayFormatValue(flag ushr bits) public companion object { public val ARRAY_FORMAT_VERTEX: ArrayFormat = ArrayFormatValue(1) public val ARRAY_FORMAT_NORMAL: ArrayFormat = ArrayFormatValue(2) public val ARRAY_FORMAT_TANGENT: ArrayFormat = ArrayFormatValue(4) public val ARRAY_FORMAT_COLOR: ArrayFormat = ArrayFormatValue(8) public val ARRAY_FORMAT_TEX_UV: ArrayFormat = ArrayFormatValue(16) public val ARRAY_FORMAT_TEX_UV2: ArrayFormat = ArrayFormatValue(32) public val ARRAY_FORMAT_CUSTOM0: ArrayFormat = ArrayFormatValue(64) public val ARRAY_FORMAT_CUSTOM1: ArrayFormat = ArrayFormatValue(128) public val ARRAY_FORMAT_CUSTOM2: ArrayFormat = ArrayFormatValue(256) public val ARRAY_FORMAT_CUSTOM3: ArrayFormat = ArrayFormatValue(512) public val ARRAY_FORMAT_BONES: ArrayFormat = ArrayFormatValue(1024) public val ARRAY_FORMAT_WEIGHTS: ArrayFormat = ArrayFormatValue(2048) public val ARRAY_FORMAT_INDEX: ArrayFormat = ArrayFormatValue(4096) public val ARRAY_FORMAT_BLEND_SHAPE_MASK: ArrayFormat = ArrayFormatValue(7) public val ARRAY_FORMAT_CUSTOM_BASE: ArrayFormat = ArrayFormatValue(13) public val ARRAY_FORMAT_CUSTOM_BITS: ArrayFormat = ArrayFormatValue(3) public val ARRAY_FORMAT_CUSTOM0_SHIFT: ArrayFormat = ArrayFormatValue(13) public val ARRAY_FORMAT_CUSTOM1_SHIFT: ArrayFormat = ArrayFormatValue(16) public val ARRAY_FORMAT_CUSTOM2_SHIFT: ArrayFormat = ArrayFormatValue(19) public val ARRAY_FORMAT_CUSTOM3_SHIFT: ArrayFormat = ArrayFormatValue(22) public val ARRAY_FORMAT_CUSTOM_MASK: ArrayFormat = ArrayFormatValue(7) public val ARRAY_COMPRESS_FLAGS_BASE: ArrayFormat = ArrayFormatValue(25) public val ARRAY_FLAG_USE_2D_VERTICES: ArrayFormat = ArrayFormatValue(33554432) public val ARRAY_FLAG_USE_DYNAMIC_UPDATE: ArrayFormat = ArrayFormatValue(67108864) public val ARRAY_FLAG_USE_8_BONE_WEIGHTS: ArrayFormat = ArrayFormatValue(134217728) public val ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY: ArrayFormat = ArrayFormatValue(268435456) public val ARRAY_FLAG_COMPRESS_ATTRIBUTES: ArrayFormat = ArrayFormatValue(536870912) public val ARRAY_FLAG_FORMAT_VERSION_BASE: ArrayFormat = ArrayFormatValue(35) public val ARRAY_FLAG_FORMAT_VERSION_SHIFT: ArrayFormat = ArrayFormatValue(35) public val ARRAY_FLAG_FORMAT_VERSION_1: ArrayFormat = ArrayFormatValue(0) public val ARRAY_FLAG_FORMAT_VERSION_2: ArrayFormat = ArrayFormatValue(34359738368) public val ARRAY_FLAG_FORMAT_CURRENT_VERSION: ArrayFormat = ArrayFormatValue(34359738368) public val ARRAY_FLAG_FORMAT_VERSION_MASK: ArrayFormat = ArrayFormatValue(255) } } @JvmInline internal value class ArrayFormatValue internal constructor( public override val flag: Long, ) : ArrayFormat public enum class PrimitiveType( id: Long, ) { /** * Primitive to draw consists of points. */ PRIMITIVE_POINTS(0), /** * Primitive to draw consists of lines. */ PRIMITIVE_LINES(1), /** * Primitive to draw consists of a line strip from start to end. */ PRIMITIVE_LINE_STRIP(2), /** * Primitive to draw consists of triangles. */ PRIMITIVE_TRIANGLES(3), /** * Primitive to draw consists of a triangle strip (the last 3 vertices are always combined to * make a triangle). */ PRIMITIVE_TRIANGLE_STRIP(4), /** * Represents the size of the [PrimitiveType] enum. */ PRIMITIVE_MAX(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class BlendShapeMode( id: Long, ) { /** * Blend shapes are normalized. */ BLEND_SHAPE_MODE_NORMALIZED(0), /** * Blend shapes are relative to base weight. */ BLEND_SHAPE_MODE_RELATIVE(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class MultimeshTransformFormat( id: Long, ) { /** * Use [Transform2D] to store MultiMesh transform. */ MULTIMESH_TRANSFORM_2D(0), /** * Use [Transform3D] to store MultiMesh transform. */ MULTIMESH_TRANSFORM_3D(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightProjectorFilter( id: Long, ) { /** * Nearest-neighbor filter for light projectors (use for pixel art light projectors). No mipmaps * are used for rendering, which means light projectors at a distance will look sharp but grainy. * This has roughly the same performance cost as using mipmaps. */ LIGHT_PROJECTOR_FILTER_NEAREST(0), /** * Linear filter for light projectors (use for non-pixel art light projectors). No mipmaps are * used for rendering, which means light projectors at a distance will look smooth but blurry. This * has roughly the same performance cost as using mipmaps. */ LIGHT_PROJECTOR_FILTER_LINEAR(1), /** * Nearest-neighbor filter for light projectors (use for pixel art light projectors). Isotropic * mipmaps are used for rendering, which means light projectors at a distance will look smooth but * blurry. This has roughly the same performance cost as not using mipmaps. */ LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS(2), /** * Linear filter for light projectors (use for non-pixel art light projectors). Isotropic * mipmaps are used for rendering, which means light projectors at a distance will look smooth but * blurry. This has roughly the same performance cost as not using mipmaps. */ LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS(3), /** * Nearest-neighbor filter for light projectors (use for pixel art light projectors). * Anisotropic mipmaps are used for rendering, which means light projectors at a distance will look * smooth and sharp when viewed from oblique angles. This looks better compared to isotropic * mipmaps, but is slower. The level of anisotropic filtering is defined by * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. */ LIGHT_PROJECTOR_FILTER_NEAREST_MIPMAPS_ANISOTROPIC(4), /** * Linear filter for light projectors (use for non-pixel art light projectors). Anisotropic * mipmaps are used for rendering, which means light projectors at a distance will look smooth and * sharp when viewed from oblique angles. This looks better compared to isotropic mipmaps, but is * slower. The level of anisotropic filtering is defined by * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. */ LIGHT_PROJECTOR_FILTER_LINEAR_MIPMAPS_ANISOTROPIC(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightType( id: Long, ) { /** * Directional (sun/moon) light (see [DirectionalLight3D]). */ LIGHT_DIRECTIONAL(0), /** * Omni light (see [OmniLight3D]). */ LIGHT_OMNI(1), /** * Spot light (see [SpotLight3D]). */ LIGHT_SPOT(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightParam( id: Long, ) { /** * The light's energy multiplier. */ LIGHT_PARAM_ENERGY(0), /** * The light's indirect energy multiplier (final indirect energy is [LIGHT_PARAM_ENERGY] * * [LIGHT_PARAM_INDIRECT_ENERGY]). */ LIGHT_PARAM_INDIRECT_ENERGY(1), /** * The light's volumetric fog energy multiplier (final volumetric fog energy is * [LIGHT_PARAM_ENERGY] * [LIGHT_PARAM_VOLUMETRIC_FOG_ENERGY]). */ LIGHT_PARAM_VOLUMETRIC_FOG_ENERGY(2), /** * The light's influence on specularity. */ LIGHT_PARAM_SPECULAR(3), /** * The light's range. */ LIGHT_PARAM_RANGE(4), /** * The size of the light when using spot light or omni light. The angular size of the light when * using directional light. */ LIGHT_PARAM_SIZE(5), /** * The light's attenuation. */ LIGHT_PARAM_ATTENUATION(6), /** * The spotlight's angle. */ LIGHT_PARAM_SPOT_ANGLE(7), /** * The spotlight's attenuation. */ LIGHT_PARAM_SPOT_ATTENUATION(8), /** * The maximum distance for shadow splits. Increasing this value will make directional shadows * visible from further away, at the cost of lower overall shadow detail and performance (since * more objects need to be included in the directional shadow rendering). */ LIGHT_PARAM_SHADOW_MAX_DISTANCE(9), /** * Proportion of shadow atlas occupied by the first split. */ LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET(10), /** * Proportion of shadow atlas occupied by the second split. */ LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET(11), /** * Proportion of shadow atlas occupied by the third split. The fourth split occupies the rest. */ LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET(12), /** * Proportion of shadow max distance where the shadow will start to fade out. */ LIGHT_PARAM_SHADOW_FADE_START(13), /** * Normal bias used to offset shadow lookup by object normal. Can be used to fix self-shadowing * artifacts. */ LIGHT_PARAM_SHADOW_NORMAL_BIAS(14), /** * Bias the shadow lookup to fix self-shadowing artifacts. */ LIGHT_PARAM_SHADOW_BIAS(15), /** * Sets the size of the directional shadow pancake. The pancake offsets the start of the * shadow's camera frustum to provide a higher effective depth resolution for the shadow. However, * a high pancake size can cause artifacts in the shadows of large objects that are close to the * edge of the frustum. Reducing the pancake size can help. Setting the size to `0` turns off the * pancaking effect. */ LIGHT_PARAM_SHADOW_PANCAKE_SIZE(16), /** * The light's shadow opacity. Values lower than `1.0` make the light appear through shadows. * This can be used to fake global illumination at a low performance cost. */ LIGHT_PARAM_SHADOW_OPACITY(17), /** * Blurs the edges of the shadow. Can be used to hide pixel artifacts in low resolution shadow * maps. A high value can make shadows appear grainy and can cause other unwanted artifacts. Try to * keep as near default as possible. */ LIGHT_PARAM_SHADOW_BLUR(18), LIGHT_PARAM_TRANSMITTANCE_BIAS(19), /** * Constant representing the intensity of the light, measured in Lumens when dealing with a * [SpotLight3D] or [OmniLight3D], or measured in Lux with a [DirectionalLight3D]. Only used when * [ProjectSettings.rendering/lightsAndShadows/usePhysicalLightUnits] is `true`. */ LIGHT_PARAM_INTENSITY(20), /** * Represents the size of the [LightParam] enum. */ LIGHT_PARAM_MAX(21), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightBakeMode( id: Long, ) { /** * Light is ignored when baking. This is the fastest mode, but the light will be taken into * account when baking global illumination. This mode should generally be used for dynamic lights * that change quickly, as the effect of global illumination is less noticeable on those lights. */ LIGHT_BAKE_DISABLED(0), /** * Light is taken into account in static baking ([VoxelGI], [LightmapGI], SDFGI * ([Environment.sdfgiEnabled])). The light can be moved around or modified, but its global * illumination will not update in real-time. This is suitable for subtle changes (such as * flickering torches), but generally not large changes such as toggling a light on and off. */ LIGHT_BAKE_STATIC(1), /** * Light is taken into account in dynamic baking ([VoxelGI] and SDFGI * ([Environment.sdfgiEnabled]) only). The light can be moved around or modified with global * illumination updating in real-time. The light's global illumination appearance will be slightly * different compared to [LIGHT_BAKE_STATIC]. This has a greater performance cost compared to * [LIGHT_BAKE_STATIC]. When using SDFGI, the update speed of dynamic lights is affected by * [ProjectSettings.rendering/globalIllumination/sdfgi/framesToUpdateLights]. */ LIGHT_BAKE_DYNAMIC(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightOmniShadowMode( id: Long, ) { /** * Use a dual paraboloid shadow map for omni lights. */ LIGHT_OMNI_SHADOW_DUAL_PARABOLOID(0), /** * Use a cubemap shadow map for omni lights. Slower but better quality than dual paraboloid. */ LIGHT_OMNI_SHADOW_CUBE(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightDirectionalShadowMode( id: Long, ) { /** * Use orthogonal shadow projection for directional light. */ LIGHT_DIRECTIONAL_SHADOW_ORTHOGONAL(0), /** * Use 2 splits for shadow projection when using directional light. */ LIGHT_DIRECTIONAL_SHADOW_PARALLEL_2_SPLITS(1), /** * Use 4 splits for shadow projection when using directional light. */ LIGHT_DIRECTIONAL_SHADOW_PARALLEL_4_SPLITS(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class LightDirectionalSkyMode( id: Long, ) { /** * Use DirectionalLight3D in both sky rendering and scene lighting. */ LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_AND_SKY(0), /** * Only use DirectionalLight3D in scene lighting. */ LIGHT_DIRECTIONAL_SKY_MODE_LIGHT_ONLY(1), /** * Only use DirectionalLight3D in sky rendering. */ LIGHT_DIRECTIONAL_SKY_MODE_SKY_ONLY(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ShadowQuality( id: Long, ) { /** * Lowest shadow filtering quality (fastest). Soft shadows are not available with this quality * setting, which means the [Light3D.shadowBlur] property is ignored if [Light3D.lightSize] and * [Light3D.lightAngularDistance] is `0.0`. * **Note:** The variable shadow blur performed by [Light3D.lightSize] and * [Light3D.lightAngularDistance] is still effective when using hard shadow filtering. In this * case, [Light3D.shadowBlur] *is* taken into account. However, the results will not be blurred, * instead the blur amount is treated as a maximum radius for the penumbra. */ SHADOW_QUALITY_HARD(0), /** * Very low shadow filtering quality (faster). When using this quality setting, * [Light3D.shadowBlur] is automatically multiplied by 0.75× to avoid introducing too much noise. * This division only applies to lights whose [Light3D.lightSize] or [Light3D.lightAngularDistance] * is `0.0`). */ SHADOW_QUALITY_SOFT_VERY_LOW(1), /** * Low shadow filtering quality (fast). */ SHADOW_QUALITY_SOFT_LOW(2), /** * Medium low shadow filtering quality (average). */ SHADOW_QUALITY_SOFT_MEDIUM(3), /** * High low shadow filtering quality (slow). When using this quality setting, * [Light3D.shadowBlur] is automatically multiplied by 1.5× to better make use of the high sample * count. This increased blur also improves the stability of dynamic object shadows. This * multiplier only applies to lights whose [Light3D.lightSize] or [Light3D.lightAngularDistance] is * `0.0`). */ SHADOW_QUALITY_SOFT_HIGH(4), /** * Highest low shadow filtering quality (slowest). When using this quality setting, * [Light3D.shadowBlur] is automatically multiplied by 2× to better make use of the high sample * count. This increased blur also improves the stability of dynamic object shadows. This * multiplier only applies to lights whose [Light3D.lightSize] or [Light3D.lightAngularDistance] is * `0.0`). */ SHADOW_QUALITY_SOFT_ULTRA(5), /** * Represents the size of the [ShadowQuality] enum. */ SHADOW_QUALITY_MAX(6), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ReflectionProbeUpdateMode( id: Long, ) { /** * Reflection probe will update reflections once and then stop. */ REFLECTION_PROBE_UPDATE_ONCE(0), /** * Reflection probe will update each frame. This mode is necessary to capture moving objects. */ REFLECTION_PROBE_UPDATE_ALWAYS(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ReflectionProbeAmbientMode( id: Long, ) { /** * Do not apply any ambient lighting inside the reflection probe's box defined by its size. */ REFLECTION_PROBE_AMBIENT_DISABLED(0), /** * Apply automatically-sourced environment lighting inside the reflection probe's box defined by * its size. */ REFLECTION_PROBE_AMBIENT_ENVIRONMENT(1), /** * Apply custom ambient lighting inside the reflection probe's box defined by its size. See * [reflectionProbeSetAmbientColor] and [reflectionProbeSetAmbientEnergy]. */ REFLECTION_PROBE_AMBIENT_COLOR(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class DecalTexture( id: Long, ) { /** * Albedo texture slot in a decal ([Decal.textureAlbedo]). */ DECAL_TEXTURE_ALBEDO(0), /** * Normal map texture slot in a decal ([Decal.textureNormal]). */ DECAL_TEXTURE_NORMAL(1), /** * Occlusion/Roughness/Metallic texture slot in a decal ([Decal.textureOrm]). */ DECAL_TEXTURE_ORM(2), /** * Emission texture slot in a decal ([Decal.textureEmission]). */ DECAL_TEXTURE_EMISSION(3), /** * Represents the size of the [DecalTexture] enum. */ DECAL_TEXTURE_MAX(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class DecalFilter( id: Long, ) { /** * Nearest-neighbor filter for decals (use for pixel art decals). No mipmaps are used for * rendering, which means decals at a distance will look sharp but grainy. This has roughly the * same performance cost as using mipmaps. */ DECAL_FILTER_NEAREST(0), /** * Linear filter for decals (use for non-pixel art decals). No mipmaps are used for rendering, * which means decals at a distance will look smooth but blurry. This has roughly the same * performance cost as using mipmaps. */ DECAL_FILTER_LINEAR(1), /** * Nearest-neighbor filter for decals (use for pixel art decals). Isotropic mipmaps are used for * rendering, which means decals at a distance will look smooth but blurry. This has roughly the * same performance cost as not using mipmaps. */ DECAL_FILTER_NEAREST_MIPMAPS(2), /** * Linear filter for decals (use for non-pixel art decals). Isotropic mipmaps are used for * rendering, which means decals at a distance will look smooth but blurry. This has roughly the * same performance cost as not using mipmaps. */ DECAL_FILTER_LINEAR_MIPMAPS(3), /** * Nearest-neighbor filter for decals (use for pixel art decals). Anisotropic mipmaps are used * for rendering, which means decals at a distance will look smooth and sharp when viewed from * oblique angles. This looks better compared to isotropic mipmaps, but is slower. The level of * anisotropic filtering is defined by * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. */ DECAL_FILTER_NEAREST_MIPMAPS_ANISOTROPIC(4), /** * Linear filter for decals (use for non-pixel art decals). Anisotropic mipmaps are used for * rendering, which means decals at a distance will look smooth and sharp when viewed from oblique * angles. This looks better compared to isotropic mipmaps, but is slower. The level of anisotropic * filtering is defined by * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. */ DECAL_FILTER_LINEAR_MIPMAPS_ANISOTROPIC(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class VoxelGIQuality( id: Long, ) { /** * Low [VoxelGI] rendering quality using 4 cones. */ VOXEL_GI_QUALITY_LOW(0), /** * High [VoxelGI] rendering quality using 6 cones. */ VOXEL_GI_QUALITY_HIGH(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ParticlesMode( id: Long, ) { /** * 2D particles. */ PARTICLES_MODE_2D(0), /** * 3D particles. */ PARTICLES_MODE_3D(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ParticlesTransformAlign( id: Long, ) { PARTICLES_TRANSFORM_ALIGN_DISABLED(0), PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD(1), PARTICLES_TRANSFORM_ALIGN_Y_TO_VELOCITY(2), PARTICLES_TRANSFORM_ALIGN_Z_BILLBOARD_Y_TO_VELOCITY(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ParticlesDrawOrder( id: Long, ) { /** * Draw particles in the order that they appear in the particles array. */ PARTICLES_DRAW_ORDER_INDEX(0), /** * Sort particles based on their lifetime. In other words, the particle with the highest * lifetime is drawn at the front. */ PARTICLES_DRAW_ORDER_LIFETIME(1), /** * Sort particles based on the inverse of their lifetime. In other words, the particle with the * lowest lifetime is drawn at the front. */ PARTICLES_DRAW_ORDER_REVERSE_LIFETIME(2), /** * Sort particles based on their distance to the camera. */ PARTICLES_DRAW_ORDER_VIEW_DEPTH(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ParticlesCollisionType( id: Long, ) { PARTICLES_COLLISION_TYPE_SPHERE_ATTRACT(0), PARTICLES_COLLISION_TYPE_BOX_ATTRACT(1), PARTICLES_COLLISION_TYPE_VECTOR_FIELD_ATTRACT(2), PARTICLES_COLLISION_TYPE_SPHERE_COLLIDE(3), PARTICLES_COLLISION_TYPE_BOX_COLLIDE(4), PARTICLES_COLLISION_TYPE_SDF_COLLIDE(5), PARTICLES_COLLISION_TYPE_HEIGHTFIELD_COLLIDE(6), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ParticlesCollisionHeightfieldResolution( id: Long, ) { PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_256(0), PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_512(1), PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_1024(2), PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_2048(3), PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_4096(4), PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_8192(5), /** * Represents the size of the [ParticlesCollisionHeightfieldResolution] enum. */ PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX(6), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class FogVolumeShape( id: Long, ) { /** * [FogVolume] will be shaped like an ellipsoid (stretched sphere). */ FOG_VOLUME_SHAPE_ELLIPSOID(0), /** * [FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's * angle is set automatically to fill the size. The cone will be adjusted to fit within the size. * Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via size is not supported * (scale the [FogVolume] node instead). */ FOG_VOLUME_SHAPE_CONE(1), /** * [FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the * [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the size. * Non-uniform scaling via size is not supported (scale the [FogVolume] node instead). */ FOG_VOLUME_SHAPE_CYLINDER(2), /** * [FogVolume] will be shaped like a box. */ FOG_VOLUME_SHAPE_BOX(3), /** * [FogVolume] will have no shape, will cover the whole world and will not be culled. */ FOG_VOLUME_SHAPE_WORLD(4), /** * Represents the size of the [FogVolumeShape] enum. */ FOG_VOLUME_SHAPE_MAX(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportScaling3DMode( id: Long, ) { /** * Use bilinear scaling for the viewport's 3D buffer. The amount of scaling can be set using * [Viewport.scaling3dScale]. Values less than `1.0` will result in undersampling while values * greater than `1.0` will result in supersampling. A value of `1.0` disables scaling. */ VIEWPORT_SCALING_3D_MODE_BILINEAR(0), /** * Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. The amount of * scaling can be set using [Viewport.scaling3dScale]. Values less than `1.0` will be result in the * viewport being upscaled using FSR. Values greater than `1.0` are not supported and bilinear * downsampling will be used instead. A value of `1.0` disables scaling. */ VIEWPORT_SCALING_3D_MODE_FSR(1), /** * Use AMD FidelityFX Super Resolution 2.2 upscaling for the viewport's 3D buffer. The amount of * scaling can be set using [Viewport.scaling3dScale]. Values less than `1.0` will be result in the * viewport being upscaled using FSR2. Values greater than `1.0` are not supported and bilinear * downsampling will be used instead. A value of `1.0` will use FSR2 at native resolution as a TAA * solution. */ VIEWPORT_SCALING_3D_MODE_FSR2(2), /** * Represents the size of the [ViewportScaling3DMode] enum. */ VIEWPORT_SCALING_3D_MODE_MAX(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportUpdateMode( id: Long, ) { /** * Do not update the viewport's render target. */ VIEWPORT_UPDATE_DISABLED(0), /** * Update the viewport's render target once, then switch to [VIEWPORT_UPDATE_DISABLED]. */ VIEWPORT_UPDATE_ONCE(1), /** * Update the viewport's render target only when it is visible. This is the default value. */ VIEWPORT_UPDATE_WHEN_VISIBLE(2), /** * Update the viewport's render target only when its parent is visible. */ VIEWPORT_UPDATE_WHEN_PARENT_VISIBLE(3), /** * Always update the viewport's render target. */ VIEWPORT_UPDATE_ALWAYS(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportClearMode( id: Long, ) { /** * Always clear the viewport's render target before drawing. */ VIEWPORT_CLEAR_ALWAYS(0), /** * Never clear the viewport's render target. */ VIEWPORT_CLEAR_NEVER(1), /** * Clear the viewport's render target on the next frame, then switch to [VIEWPORT_CLEAR_NEVER]. */ VIEWPORT_CLEAR_ONLY_NEXT_FRAME(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportEnvironmentMode( id: Long, ) { /** * Disable rendering of 3D environment over 2D canvas. */ VIEWPORT_ENVIRONMENT_DISABLED(0), /** * Enable rendering of 3D environment over 2D canvas. */ VIEWPORT_ENVIRONMENT_ENABLED(1), /** * Inherit enable/disable value from parent. If the topmost parent is also set to * [VIEWPORT_ENVIRONMENT_INHERIT], then this has the same behavior as * [VIEWPORT_ENVIRONMENT_ENABLED]. */ VIEWPORT_ENVIRONMENT_INHERIT(2), /** * Represents the size of the [ViewportEnvironmentMode] enum. */ VIEWPORT_ENVIRONMENT_MAX(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportSDFOversize( id: Long, ) { /** * Do not oversize the 2D signed distance field. Occluders may disappear when touching the * viewport's edges, and [GPUParticles3D] collision may stop working earlier than intended. This * has the lowest GPU requirements. */ VIEWPORT_SDF_OVERSIZE_100_PERCENT(0), /** * 2D signed distance field covers 20&#37; of the viewport's size outside the viewport on each * side (top, right, bottom, left). */ VIEWPORT_SDF_OVERSIZE_120_PERCENT(1), /** * 2D signed distance field covers 50&#37; of the viewport's size outside the viewport on each * side (top, right, bottom, left). */ VIEWPORT_SDF_OVERSIZE_150_PERCENT(2), /** * 2D signed distance field covers 100&#37; of the viewport's size outside the viewport on each * side (top, right, bottom, left). This has the highest GPU requirements. */ VIEWPORT_SDF_OVERSIZE_200_PERCENT(3), /** * Represents the size of the [ViewportSDFOversize] enum. */ VIEWPORT_SDF_OVERSIZE_MAX(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportSDFScale( id: Long, ) { /** * Full resolution 2D signed distance field scale. This has the highest GPU requirements. */ VIEWPORT_SDF_SCALE_100_PERCENT(0), /** * Half resolution 2D signed distance field scale on each axis (25&#37; of the viewport pixel * count). */ VIEWPORT_SDF_SCALE_50_PERCENT(1), /** * Quarter resolution 2D signed distance field scale on each axis (6.25&#37; of the viewport * pixel count). This has the lowest GPU requirements. */ VIEWPORT_SDF_SCALE_25_PERCENT(2), /** * Represents the size of the [ViewportSDFScale] enum. */ VIEWPORT_SDF_SCALE_MAX(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportMSAA( id: Long, ) { /** * Multisample antialiasing for 3D is disabled. This is the default value, and also the fastest * setting. */ VIEWPORT_MSAA_DISABLED(0), /** * Multisample antialiasing uses 2 samples per pixel for 3D. This has a moderate impact on * performance. */ VIEWPORT_MSAA_2X(1), /** * Multisample antialiasing uses 4 samples per pixel for 3D. This has a high impact on * performance. */ VIEWPORT_MSAA_4X(2), /** * Multisample antialiasing uses 8 samples per pixel for 3D. This has a very high impact on * performance. Likely unsupported on low-end and older hardware. */ VIEWPORT_MSAA_8X(3), /** * Represents the size of the [ViewportMSAA] enum. */ VIEWPORT_MSAA_MAX(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportScreenSpaceAA( id: Long, ) { /** * Do not perform any antialiasing in the full screen post-process. */ VIEWPORT_SCREEN_SPACE_AA_DISABLED(0), /** * Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which * is fast but will make the image look blurry, especially at lower resolutions. It can still work * relatively well at large resolutions such as 1440p and 4K. */ VIEWPORT_SCREEN_SPACE_AA_FXAA(1), /** * Represents the size of the [ViewportScreenSpaceAA] enum. */ VIEWPORT_SCREEN_SPACE_AA_MAX(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportOcclusionCullingBuildQuality( id: Long, ) { /** * Low occlusion culling BVH build quality (as defined by Embree). Results in the lowest CPU * usage, but least effective culling. */ VIEWPORT_OCCLUSION_BUILD_QUALITY_LOW(0), /** * Medium occlusion culling BVH build quality (as defined by Embree). */ VIEWPORT_OCCLUSION_BUILD_QUALITY_MEDIUM(1), /** * High occlusion culling BVH build quality (as defined by Embree). Results in the highest CPU * usage, but most effective culling. */ VIEWPORT_OCCLUSION_BUILD_QUALITY_HIGH(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportRenderInfo( id: Long, ) { /** * Number of objects drawn in a single frame. */ VIEWPORT_RENDER_INFO_OBJECTS_IN_FRAME(0), /** * Number of points, lines, or triangles drawn in a single frame. */ VIEWPORT_RENDER_INFO_PRIMITIVES_IN_FRAME(1), /** * Number of draw calls during this frame. */ VIEWPORT_RENDER_INFO_DRAW_CALLS_IN_FRAME(2), /** * Represents the size of the [ViewportRenderInfo] enum. */ VIEWPORT_RENDER_INFO_MAX(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportRenderInfoType( id: Long, ) { /** * Visible render pass (excluding shadows). */ VIEWPORT_RENDER_INFO_TYPE_VISIBLE(0), /** * Shadow render pass. Objects will be rendered several times depending on the number of amounts * of lights with shadows and the number of directional shadow splits. */ VIEWPORT_RENDER_INFO_TYPE_SHADOW(1), /** * Represents the size of the [ViewportRenderInfoType] enum. */ VIEWPORT_RENDER_INFO_TYPE_MAX(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportDebugDraw( id: Long, ) { /** * Debug draw is disabled. Default setting. */ VIEWPORT_DEBUG_DRAW_DISABLED(0), /** * Objects are displayed without light information. */ VIEWPORT_DEBUG_DRAW_UNSHADED(1), /** * Objects are displayed with only light information. */ VIEWPORT_DEBUG_DRAW_LIGHTING(2), /** * Objects are displayed semi-transparent with additive blending so you can see where they are * drawing over top of one another. A higher overdraw (represented by brighter colors) means you * are wasting performance on drawing pixels that are being hidden behind others. * **Note:** When using this debug draw mode, custom shaders will be ignored. This means vertex * displacement won't be visible anymore. */ VIEWPORT_DEBUG_DRAW_OVERDRAW(3), /** * Debug draw draws objects in wireframe. */ VIEWPORT_DEBUG_DRAW_WIREFRAME(4), /** * Normal buffer is drawn instead of regular scene so you can see the per-pixel normals that * will be used by post-processing effects. */ VIEWPORT_DEBUG_DRAW_NORMAL_BUFFER(5), /** * Objects are displayed with only the albedo value from [VoxelGI]s. */ VIEWPORT_DEBUG_DRAW_VOXEL_GI_ALBEDO(6), /** * Objects are displayed with only the lighting value from [VoxelGI]s. */ VIEWPORT_DEBUG_DRAW_VOXEL_GI_LIGHTING(7), /** * Objects are displayed with only the emission color from [VoxelGI]s. */ VIEWPORT_DEBUG_DRAW_VOXEL_GI_EMISSION(8), /** * Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the * upper left quadrant of the [Viewport]. */ VIEWPORT_DEBUG_DRAW_SHADOW_ATLAS(9), /** * Draws the shadow atlas that stores shadows from [DirectionalLight3D]s in the upper left * quadrant of the [Viewport]. * The slice of the camera frustum related to the shadow map cascade is superimposed to * visualize coverage. The color of each slice matches the colors used for * [VIEWPORT_DEBUG_DRAW_PSSM_SPLITS]. When shadow cascades are blended the overlap is taken into * account when drawing the frustum slices. * The last cascade shows all frustum slices to illustrate the coverage of all slices. */ VIEWPORT_DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS(10), /** * Draws the estimated scene luminance. This is a 1×1 texture that is generated when * autoexposure is enabled to control the scene's exposure. */ VIEWPORT_DEBUG_DRAW_SCENE_LUMINANCE(11), /** * Draws the screen space ambient occlusion texture instead of the scene so that you can clearly * see how it is affecting objects. In order for this display mode to work, you must have * [Environment.ssaoEnabled] set in your [WorldEnvironment]. */ VIEWPORT_DEBUG_DRAW_SSAO(12), /** * Draws the screen space indirect lighting texture instead of the scene so that you can clearly * see how it is affecting objects. In order for this display mode to work, you must have * [Environment.ssilEnabled] set in your [WorldEnvironment]. */ VIEWPORT_DEBUG_DRAW_SSIL(13), /** * Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you * can see where the splits are. In order they will be colored red, green, blue, yellow. */ VIEWPORT_DEBUG_DRAW_PSSM_SPLITS(14), /** * Draws the decal atlas that stores decal textures from [Decal]s. */ VIEWPORT_DEBUG_DRAW_DECAL_ATLAS(15), /** * Draws SDFGI cascade data. This is the data structure that is used to bounce lighting against * and create reflections. */ VIEWPORT_DEBUG_DRAW_SDFGI(16), /** * Draws SDFGI probe data. This is the data structure that is used to give indirect lighting * dynamic objects moving within the scene. */ VIEWPORT_DEBUG_DRAW_SDFGI_PROBES(17), /** * Draws the global illumination buffer ([VoxelGI] or SDFGI). */ VIEWPORT_DEBUG_DRAW_GI_BUFFER(18), /** * Disable mesh LOD. All meshes are drawn with full detail, which can be used to compare * performance. */ VIEWPORT_DEBUG_DRAW_DISABLE_LOD(19), /** * Draws the [OmniLight3D] cluster. Clustering determines where lights are positioned in * screen-space, which allows the engine to only process these portions of the screen for lighting. */ VIEWPORT_DEBUG_DRAW_CLUSTER_OMNI_LIGHTS(20), /** * Draws the [SpotLight3D] cluster. Clustering determines where lights are positioned in * screen-space, which allows the engine to only process these portions of the screen for lighting. */ VIEWPORT_DEBUG_DRAW_CLUSTER_SPOT_LIGHTS(21), /** * Draws the [Decal] cluster. Clustering determines where decals are positioned in screen-space, * which allows the engine to only process these portions of the screen for decals. */ VIEWPORT_DEBUG_DRAW_CLUSTER_DECALS(22), /** * Draws the [ReflectionProbe] cluster. Clustering determines where reflection probes are * positioned in screen-space, which allows the engine to only process these portions of the screen * for reflection probes. */ VIEWPORT_DEBUG_DRAW_CLUSTER_REFLECTION_PROBES(23), /** * Draws the occlusion culling buffer. This low-resolution occlusion culling buffer is * rasterized on the CPU and is used to check whether instances are occluded by other objects. */ VIEWPORT_DEBUG_DRAW_OCCLUDERS(24), /** * Draws the motion vectors buffer. This is used by temporal antialiasing to correct for motion * that occurs during gameplay. */ VIEWPORT_DEBUG_DRAW_MOTION_VECTORS(25), /** * Internal buffer is drawn instead of regular scene so you can see the per-pixel output that * will be used by post-processing effects. */ VIEWPORT_DEBUG_DRAW_INTERNAL_BUFFER(26), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ViewportVRSMode( id: Long, ) { /** * Variable rate shading is disabled. */ VIEWPORT_VRS_DISABLED(0), /** * Variable rate shading uses a texture. Note, for stereoscopic use a texture atlas with a * texture for each view. */ VIEWPORT_VRS_TEXTURE(1), /** * Variable rate shading texture is supplied by the primary [XRInterface]. */ VIEWPORT_VRS_XR(2), /** * Represents the size of the [ViewportVRSMode] enum. */ VIEWPORT_VRS_MAX(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class SkyMode( id: Long, ) { /** * Automatically selects the appropriate process mode based on your sky shader. If your shader * uses `TIME` or `POSITION`, this will use [SKY_MODE_REALTIME]. If your shader uses any of the * `LIGHT_*` variables or any custom uniforms, this uses [SKY_MODE_INCREMENTAL]. Otherwise, this * defaults to [SKY_MODE_QUALITY]. */ SKY_MODE_AUTOMATIC(0), /** * Uses high quality importance sampling to process the radiance map. In general, this results * in much higher quality than [SKY_MODE_REALTIME] but takes much longer to generate. This should * not be used if you plan on changing the sky at runtime. If you are finding that the reflection * is not blurry enough and is showing sparkles or fireflies, try increasing * [ProjectSettings.rendering/reflections/skyReflections/ggxSamples]. */ SKY_MODE_QUALITY(1), /** * Uses the same high quality importance sampling to process the radiance map as * [SKY_MODE_QUALITY], but updates over several frames. The number of frames is determined by * [ProjectSettings.rendering/reflections/skyReflections/roughnessLayers]. Use this when you need * highest quality radiance maps, but have a sky that updates slowly. */ SKY_MODE_INCREMENTAL(2), /** * Uses the fast filtering algorithm to process the radiance map. In general this results in * lower quality, but substantially faster run times. If you need better quality, but still need to * update the sky every frame, consider turning on * [ProjectSettings.rendering/reflections/skyReflections/fastFilterHighQuality]. * **Note:** The fast filtering algorithm is limited to 256×256 cubemaps, so * [skySetRadianceSize] must be set to `256`. Otherwise, a warning is printed and the overridden * radiance size is ignored. */ SKY_MODE_REALTIME(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentBG( id: Long, ) { /** * Use the clear color as background. */ ENV_BG_CLEAR_COLOR(0), /** * Use a specified color as the background. */ ENV_BG_COLOR(1), /** * Use a sky resource for the background. */ ENV_BG_SKY(2), /** * Use a specified canvas layer as the background. This can be useful for instantiating a 2D * scene in a 3D world. */ ENV_BG_CANVAS(3), /** * Do not clear the background, use whatever was rendered last frame as the background. */ ENV_BG_KEEP(4), /** * Displays a camera feed in the background. */ ENV_BG_CAMERA_FEED(5), /** * Represents the size of the [EnvironmentBG] enum. */ ENV_BG_MAX(6), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentAmbientSource( id: Long, ) { /** * Gather ambient light from whichever source is specified as the background. */ ENV_AMBIENT_SOURCE_BG(0), /** * Disable ambient light. */ ENV_AMBIENT_SOURCE_DISABLED(1), /** * Specify a specific [Color] for ambient light. */ ENV_AMBIENT_SOURCE_COLOR(2), /** * Gather ambient light from the [Sky] regardless of what the background is. */ ENV_AMBIENT_SOURCE_SKY(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentReflectionSource( id: Long, ) { /** * Use the background for reflections. */ ENV_REFLECTION_SOURCE_BG(0), /** * Disable reflections. */ ENV_REFLECTION_SOURCE_DISABLED(1), /** * Use the [Sky] for reflections regardless of what the background is. */ ENV_REFLECTION_SOURCE_SKY(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentGlowBlendMode( id: Long, ) { /** * Additive glow blending mode. Mostly used for particles, glows (bloom), lens flare, bright * sources. */ ENV_GLOW_BLEND_MODE_ADDITIVE(0), /** * Screen glow blending mode. Increases brightness, used frequently with bloom. */ ENV_GLOW_BLEND_MODE_SCREEN(1), /** * Soft light glow blending mode. Modifies contrast, exposes shadows and highlights (vivid * bloom). */ ENV_GLOW_BLEND_MODE_SOFTLIGHT(2), /** * Replace glow blending mode. Replaces all pixels' color by the glow value. This can be used to * simulate a full-screen blur effect by tweaking the glow parameters to match the original image's * brightness. */ ENV_GLOW_BLEND_MODE_REPLACE(3), /** * Mixes the glow with the underlying color to avoid increasing brightness as much while still * maintaining a glow effect. */ ENV_GLOW_BLEND_MODE_MIX(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentToneMapper( id: Long, ) { /** * Output color as they came in. This can cause bright lighting to look blown out, with * noticeable clipping in the output colors. */ ENV_TONE_MAPPER_LINEAR(0), /** * Use the Reinhard tonemapper. Performs a variation on rendered pixels' colors by this formula: * `color = color / (1 + color)`. This avoids clipping bright highlights, but the resulting image * can look a bit dull. */ ENV_TONE_MAPPER_REINHARD(1), /** * Use the filmic tonemapper. This avoids clipping bright highlights, with a resulting image * that usually looks more vivid than [ENV_TONE_MAPPER_REINHARD]. */ ENV_TONE_MAPPER_FILMIC(2), /** * Use the Academy Color Encoding System tonemapper. ACES is slightly more expensive than other * options, but it handles bright lighting in a more realistic fashion by desaturating it as it * becomes brighter. ACES typically has a more contrasted output compared to * [ENV_TONE_MAPPER_REINHARD] and [ENV_TONE_MAPPER_FILMIC]. * **Note:** This tonemapping operator is called "ACES Fitted" in Godot 3.x. */ ENV_TONE_MAPPER_ACES(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSSRRoughnessQuality( id: Long, ) { /** * Lowest quality of roughness filter for screen-space reflections. Rough materials will not * have blurrier screen-space reflections compared to smooth (non-rough) materials. This is the * fastest option. */ ENV_SSR_ROUGHNESS_QUALITY_DISABLED(0), /** * Low quality of roughness filter for screen-space reflections. */ ENV_SSR_ROUGHNESS_QUALITY_LOW(1), /** * Medium quality of roughness filter for screen-space reflections. */ ENV_SSR_ROUGHNESS_QUALITY_MEDIUM(2), /** * High quality of roughness filter for screen-space reflections. This is the slowest option. */ ENV_SSR_ROUGHNESS_QUALITY_HIGH(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSSAOQuality( id: Long, ) { /** * Lowest quality of screen-space ambient occlusion. */ ENV_SSAO_QUALITY_VERY_LOW(0), /** * Low quality screen-space ambient occlusion. */ ENV_SSAO_QUALITY_LOW(1), /** * Medium quality screen-space ambient occlusion. */ ENV_SSAO_QUALITY_MEDIUM(2), /** * High quality screen-space ambient occlusion. */ ENV_SSAO_QUALITY_HIGH(3), /** * Highest quality screen-space ambient occlusion. Uses the adaptive target setting which can be * dynamically adjusted to smoothly balance performance and visual quality. */ ENV_SSAO_QUALITY_ULTRA(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSSILQuality( id: Long, ) { /** * Lowest quality of screen-space indirect lighting. */ ENV_SSIL_QUALITY_VERY_LOW(0), /** * Low quality screen-space indirect lighting. */ ENV_SSIL_QUALITY_LOW(1), /** * High quality screen-space indirect lighting. */ ENV_SSIL_QUALITY_MEDIUM(2), /** * High quality screen-space indirect lighting. */ ENV_SSIL_QUALITY_HIGH(3), /** * Highest quality screen-space indirect lighting. Uses the adaptive target setting which can be * dynamically adjusted to smoothly balance performance and visual quality. */ ENV_SSIL_QUALITY_ULTRA(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSDFGIYScale( id: Long, ) { /** * Use 50&#37; scale for SDFGI on the Y (vertical) axis. SDFGI cells will be twice as short as * they are wide. This allows providing increased GI detail and reduced light leaking with thin * floors and ceilings. This is usually the best choice for scenes that don't feature much * verticality. */ ENV_SDFGI_Y_SCALE_50_PERCENT(0), /** * Use 75&#37; scale for SDFGI on the Y (vertical) axis. This is a balance between the 50&#37; * and 100&#37; SDFGI Y scales. */ ENV_SDFGI_Y_SCALE_75_PERCENT(1), /** * Use 100&#37; scale for SDFGI on the Y (vertical) axis. SDFGI cells will be as tall as they * are wide. This is usually the best choice for highly vertical scenes. The downside is that light * leaking may become more noticeable with thin floors and ceilings. */ ENV_SDFGI_Y_SCALE_100_PERCENT(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSDFGIRayCount( id: Long, ) { /** * Throw 4 rays per frame when converging SDFGI. This has the lowest GPU requirements, but * creates the most noisy result. */ ENV_SDFGI_RAY_COUNT_4(0), /** * Throw 8 rays per frame when converging SDFGI. */ ENV_SDFGI_RAY_COUNT_8(1), /** * Throw 16 rays per frame when converging SDFGI. */ ENV_SDFGI_RAY_COUNT_16(2), /** * Throw 32 rays per frame when converging SDFGI. */ ENV_SDFGI_RAY_COUNT_32(3), /** * Throw 64 rays per frame when converging SDFGI. */ ENV_SDFGI_RAY_COUNT_64(4), /** * Throw 96 rays per frame when converging SDFGI. This has high GPU requirements. */ ENV_SDFGI_RAY_COUNT_96(5), /** * Throw 128 rays per frame when converging SDFGI. This has very high GPU requirements, but * creates the least noisy result. */ ENV_SDFGI_RAY_COUNT_128(6), /** * Represents the size of the [EnvironmentSDFGIRayCount] enum. */ ENV_SDFGI_RAY_COUNT_MAX(7), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSDFGIFramesToConverge( id: Long, ) { /** * Converge SDFGI over 5 frames. This is the most responsive, but creates the most noisy result * with a given ray count. */ ENV_SDFGI_CONVERGE_IN_5_FRAMES(0), /** * Configure SDFGI to fully converge over 10 frames. */ ENV_SDFGI_CONVERGE_IN_10_FRAMES(1), /** * Configure SDFGI to fully converge over 15 frames. */ ENV_SDFGI_CONVERGE_IN_15_FRAMES(2), /** * Configure SDFGI to fully converge over 20 frames. */ ENV_SDFGI_CONVERGE_IN_20_FRAMES(3), /** * Configure SDFGI to fully converge over 25 frames. */ ENV_SDFGI_CONVERGE_IN_25_FRAMES(4), /** * Configure SDFGI to fully converge over 30 frames. This is the least responsive, but creates * the least noisy result with a given ray count. */ ENV_SDFGI_CONVERGE_IN_30_FRAMES(5), /** * Represents the size of the [EnvironmentSDFGIFramesToConverge] enum. */ ENV_SDFGI_CONVERGE_MAX(6), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class EnvironmentSDFGIFramesToUpdateLight( id: Long, ) { /** * Update indirect light from dynamic lights in SDFGI over 1 frame. This is the most responsive, * but has the highest GPU requirements. */ ENV_SDFGI_UPDATE_LIGHT_IN_1_FRAME(0), /** * Update indirect light from dynamic lights in SDFGI over 2 frames. */ ENV_SDFGI_UPDATE_LIGHT_IN_2_FRAMES(1), /** * Update indirect light from dynamic lights in SDFGI over 4 frames. */ ENV_SDFGI_UPDATE_LIGHT_IN_4_FRAMES(2), /** * Update indirect light from dynamic lights in SDFGI over 8 frames. */ ENV_SDFGI_UPDATE_LIGHT_IN_8_FRAMES(3), /** * Update indirect light from dynamic lights in SDFGI over 16 frames. This is the least * responsive, but has the lowest GPU requirements. */ ENV_SDFGI_UPDATE_LIGHT_IN_16_FRAMES(4), /** * Represents the size of the [EnvironmentSDFGIFramesToUpdateLight] enum. */ ENV_SDFGI_UPDATE_LIGHT_MAX(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class SubSurfaceScatteringQuality( id: Long, ) { /** * Disables subsurface scattering entirely, even on materials that have * [BaseMaterial3D.subsurfScatterEnabled] set to `true`. This has the lowest GPU requirements. */ SUB_SURFACE_SCATTERING_QUALITY_DISABLED(0), /** * Low subsurface scattering quality. */ SUB_SURFACE_SCATTERING_QUALITY_LOW(1), /** * Medium subsurface scattering quality. */ SUB_SURFACE_SCATTERING_QUALITY_MEDIUM(2), /** * High subsurface scattering quality. This has the highest GPU requirements. */ SUB_SURFACE_SCATTERING_QUALITY_HIGH(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class DOFBokehShape( id: Long, ) { /** * Calculate the DOF blur using a box filter. The fastest option, but results in obvious lines * in blur pattern. */ DOF_BOKEH_BOX(0), /** * Calculates DOF blur using a hexagon shaped filter. */ DOF_BOKEH_HEXAGON(1), /** * Calculates DOF blur using a circle shaped filter. Best quality and most realistic, but * slowest. Use only for areas where a lot of performance can be dedicated to post-processing (e.g. * cutscenes). */ DOF_BOKEH_CIRCLE(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class DOFBlurQuality( id: Long, ) { /** * Lowest quality DOF blur. This is the fastest setting, but you may be able to see filtering * artifacts. */ DOF_BLUR_QUALITY_VERY_LOW(0), /** * Low quality DOF blur. */ DOF_BLUR_QUALITY_LOW(1), /** * Medium quality DOF blur. */ DOF_BLUR_QUALITY_MEDIUM(2), /** * Highest quality DOF blur. Results in the smoothest looking blur by taking the most samples, * but is also significantly slower. */ DOF_BLUR_QUALITY_HIGH(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class InstanceType( id: Long, ) { /** * The instance does not have a type. */ INSTANCE_NONE(0), /** * The instance is a mesh. */ INSTANCE_MESH(1), /** * The instance is a multimesh. */ INSTANCE_MULTIMESH(2), /** * The instance is a particle emitter. */ INSTANCE_PARTICLES(3), /** * The instance is a GPUParticles collision shape. */ INSTANCE_PARTICLES_COLLISION(4), /** * The instance is a light. */ INSTANCE_LIGHT(5), /** * The instance is a reflection probe. */ INSTANCE_REFLECTION_PROBE(6), /** * The instance is a decal. */ INSTANCE_DECAL(7), /** * The instance is a VoxelGI. */ INSTANCE_VOXEL_GI(8), /** * The instance is a lightmap. */ INSTANCE_LIGHTMAP(9), /** * The instance is an occlusion culling occluder. */ INSTANCE_OCCLUDER(10), /** * The instance is a visible on-screen notifier. */ INSTANCE_VISIBLITY_NOTIFIER(11), /** * The instance is a fog volume. */ INSTANCE_FOG_VOLUME(12), /** * Represents the size of the [InstanceType] enum. */ INSTANCE_MAX(13), /** * A combination of the flags of geometry instances (mesh, multimesh, immediate and particles). */ INSTANCE_GEOMETRY_MASK(14), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class InstanceFlags( id: Long, ) { /** * Allows the instance to be used in baked lighting. */ INSTANCE_FLAG_USE_BAKED_LIGHT(0), /** * Allows the instance to be used with dynamic global illumination. */ INSTANCE_FLAG_USE_DYNAMIC_GI(1), /** * When set, manually requests to draw geometry on next frame. */ INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE(2), /** * Always draw, even if the instance would be culled by occlusion culling. Does not affect view * frustum culling. */ INSTANCE_FLAG_IGNORE_OCCLUSION_CULLING(3), /** * Represents the size of the [InstanceFlags] enum. */ INSTANCE_FLAG_MAX(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class ShadowCastingSetting( id: Long, ) { /** * Disable shadows from this instance. */ SHADOW_CASTING_SETTING_OFF(0), /** * Cast shadows from this instance. */ SHADOW_CASTING_SETTING_ON(1), /** * Disable backface culling when rendering the shadow of the object. This is slightly slower but * may result in more correct shadows. */ SHADOW_CASTING_SETTING_DOUBLE_SIDED(2), /** * Only render the shadows from the object. The object itself will not be drawn. */ SHADOW_CASTING_SETTING_SHADOWS_ONLY(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class VisibilityRangeFadeMode( id: Long, ) { /** * Disable visibility range fading for the given instance. */ VISIBILITY_RANGE_FADE_DISABLED(0), /** * Fade-out the given instance when it approaches its visibility range limits. */ VISIBILITY_RANGE_FADE_SELF(1), /** * Fade-in the given instance's dependencies when reaching its visibility range limits. */ VISIBILITY_RANGE_FADE_DEPENDENCIES(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class BakeChannels( id: Long, ) { /** * Index of [Image] in array of [Image]s returned by [bakeRenderUv2]. Image uses * [Image.FORMAT_RGBA8] and contains albedo color in the `.rgb` channels and alpha in the `.a` * channel. */ BAKE_CHANNEL_ALBEDO_ALPHA(0), /** * Index of [Image] in array of [Image]s returned by [bakeRenderUv2]. Image uses * [Image.FORMAT_RGBA8] and contains the per-pixel normal of the object in the `.rgb` channels and * nothing in the `.a` channel. The per-pixel normal is encoded as `normal * 0.5 + 0.5`. */ BAKE_CHANNEL_NORMAL(1), /** * Index of [Image] in array of [Image]s returned by [bakeRenderUv2]. Image uses * [Image.FORMAT_RGBA8] and contains ambient occlusion (from material and decals only) in the `.r` * channel, roughness in the `.g` channel, metallic in the `.b` channel and sub surface scattering * amount in the `.a` channel. */ BAKE_CHANNEL_ORM(2), /** * Index of [Image] in array of [Image]s returned by [bakeRenderUv2]. Image uses * [Image.FORMAT_RGBAH] and contains emission color in the `.rgb` channels and nothing in the `.a` * channel. */ BAKE_CHANNEL_EMISSION(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasTextureChannel( id: Long, ) { /** * Diffuse canvas texture ([CanvasTexture.diffuseTexture]). */ CANVAS_TEXTURE_CHANNEL_DIFFUSE(0), /** * Normal map canvas texture ([CanvasTexture.normalTexture]). */ CANVAS_TEXTURE_CHANNEL_NORMAL(1), /** * Specular map canvas texture ([CanvasTexture.specularTexture]). */ CANVAS_TEXTURE_CHANNEL_SPECULAR(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class NinePatchAxisMode( id: Long, ) { /** * The nine patch gets stretched where needed. */ NINE_PATCH_STRETCH(0), /** * The nine patch gets filled with tiles where needed. */ NINE_PATCH_TILE(1), /** * The nine patch gets filled with tiles where needed and stretches them a bit if needed. */ NINE_PATCH_TILE_FIT(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasItemTextureFilter( id: Long, ) { /** * Uses the default filter mode for this [Viewport]. */ CANVAS_ITEM_TEXTURE_FILTER_DEFAULT(0), /** * The texture filter reads from the nearest pixel only. This makes the texture look pixelated * from up close, and grainy from a distance (due to mipmaps not being sampled). */ CANVAS_ITEM_TEXTURE_FILTER_NEAREST(1), /** * The texture filter blends between the nearest 4 pixels. This makes the texture look smooth * from up close, and grainy from a distance (due to mipmaps not being sampled). */ CANVAS_ITEM_TEXTURE_FILTER_LINEAR(2), /** * The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or * uses the nearest mipmap if * [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is `true`). This * makes the texture look pixelated from up close, and smooth from a distance. * Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to [Camera2D] * zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than * on-screen pixels. */ CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS(3), /** * The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or * uses the nearest mipmap if * [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is `true`). This * makes the texture look smooth from up close, and smooth from a distance. * Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to [Camera2D] * zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than * on-screen pixels. */ CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS(4), /** * The texture filter reads from the nearest pixel and blends between 2 mipmaps (or uses the * nearest mipmap if [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] is * `true`) based on the angle between the surface and the camera view. This makes the texture look * pixelated from up close, and smooth from a distance. Anisotropic filtering improves texture * quality on surfaces that are almost in line with the camera, but is slightly slower. The * anisotropic filtering level can be changed by adjusting * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. * **Note:** This texture filter is rarely useful in 2D projects. * [CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS] is usually more appropriate in this case. */ CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS_ANISOTROPIC(5), /** * The texture filter blends between the nearest 4 pixels and blends between 2 mipmaps (or uses * the nearest mipmap if [ProjectSettings.rendering/textures/defaultFilters/useNearestMipmapFilter] * is `true`) based on the angle between the surface and the camera view. This makes the texture * look smooth from up close, and smooth from a distance. Anisotropic filtering improves texture * quality on surfaces that are almost in line with the camera, but is slightly slower. The * anisotropic filtering level can be changed by adjusting * [ProjectSettings.rendering/textures/defaultFilters/anisotropicFilteringLevel]. * **Note:** This texture filter is rarely useful in 2D projects. * [CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS] is usually more appropriate in this case. */ CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS_ANISOTROPIC(6), /** * Max value for [CanvasItemTextureFilter] enum. */ CANVAS_ITEM_TEXTURE_FILTER_MAX(7), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasItemTextureRepeat( id: Long, ) { /** * Uses the default repeat mode for this [Viewport]. */ CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT(0), /** * Disables textures repeating. Instead, when reading UVs outside the 0-1 range, the value will * be clamped to the edge of the texture, resulting in a stretched out look at the borders of the * texture. */ CANVAS_ITEM_TEXTURE_REPEAT_DISABLED(1), /** * Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of * the linear filtering modes, this can result in artifacts at the edges of a texture when the * sampler filters across the edges of the texture. */ CANVAS_ITEM_TEXTURE_REPEAT_ENABLED(2), /** * Flip the texture when repeating so that the edge lines up instead of abruptly changing. */ CANVAS_ITEM_TEXTURE_REPEAT_MIRROR(3), /** * Max value for [CanvasItemTextureRepeat] enum. */ CANVAS_ITEM_TEXTURE_REPEAT_MAX(4), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasGroupMode( id: Long, ) { /** * Child draws over parent and is not clipped. */ CANVAS_GROUP_MODE_DISABLED(0), /** * Parent is used for the purposes of clipping only. Child is clipped to the parent's visible * area, parent is not drawn. */ CANVAS_GROUP_MODE_CLIP_ONLY(1), /** * Parent is used for clipping child, but parent is also drawn underneath child as normal before * clipping child to its visible area. */ CANVAS_GROUP_MODE_CLIP_AND_DRAW(2), CANVAS_GROUP_MODE_TRANSPARENT(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasLightMode( id: Long, ) { /** * 2D point light (see [PointLight2D]). */ CANVAS_LIGHT_MODE_POINT(0), /** * 2D directional (sun/moon) light (see [DirectionalLight2D]). */ CANVAS_LIGHT_MODE_DIRECTIONAL(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasLightBlendMode( id: Long, ) { /** * Adds light color additive to the canvas. */ CANVAS_LIGHT_BLEND_MODE_ADD(0), /** * Adds light color subtractive to the canvas. */ CANVAS_LIGHT_BLEND_MODE_SUB(1), /** * The light adds color depending on transparency. */ CANVAS_LIGHT_BLEND_MODE_MIX(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasLightShadowFilter( id: Long, ) { /** * Do not apply a filter to canvas light shadows. */ CANVAS_LIGHT_FILTER_NONE(0), /** * Use PCF5 filtering to filter canvas light shadows. */ CANVAS_LIGHT_FILTER_PCF5(1), /** * Use PCF13 filtering to filter canvas light shadows. */ CANVAS_LIGHT_FILTER_PCF13(2), /** * Max value of the [CanvasLightShadowFilter] enum. */ CANVAS_LIGHT_FILTER_MAX(3), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class CanvasOccluderPolygonCullMode( id: Long, ) { /** * Culling of the canvas occluder is disabled. */ CANVAS_OCCLUDER_POLYGON_CULL_DISABLED(0), /** * Culling of the canvas occluder is clockwise. */ CANVAS_OCCLUDER_POLYGON_CULL_CLOCKWISE(1), /** * Culling of the canvas occluder is counterclockwise. */ CANVAS_OCCLUDER_POLYGON_CULL_COUNTER_CLOCKWISE(2), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class GlobalShaderParameterType( id: Long, ) { /** * Boolean global shader parameter (`global uniform bool ...`). */ GLOBAL_VAR_TYPE_BOOL(0), /** * 2-dimensional boolean vector global shader parameter (`global uniform bvec2 ...`). */ GLOBAL_VAR_TYPE_BVEC2(1), /** * 3-dimensional boolean vector global shader parameter (`global uniform bvec3 ...`). */ GLOBAL_VAR_TYPE_BVEC3(2), /** * 4-dimensional boolean vector global shader parameter (`global uniform bvec4 ...`). */ GLOBAL_VAR_TYPE_BVEC4(3), /** * Integer global shader parameter (`global uniform int ...`). */ GLOBAL_VAR_TYPE_INT(4), /** * 2-dimensional integer vector global shader parameter (`global uniform ivec2 ...`). */ GLOBAL_VAR_TYPE_IVEC2(5), /** * 3-dimensional integer vector global shader parameter (`global uniform ivec3 ...`). */ GLOBAL_VAR_TYPE_IVEC3(6), /** * 4-dimensional integer vector global shader parameter (`global uniform ivec4 ...`). */ GLOBAL_VAR_TYPE_IVEC4(7), /** * 2-dimensional integer rectangle global shader parameter (`global uniform ivec4 ...`). * Equivalent to [GLOBAL_VAR_TYPE_IVEC4] in shader code, but exposed as a [Rect2i] in the editor * UI. */ GLOBAL_VAR_TYPE_RECT2I(8), /** * Unsigned integer global shader parameter (`global uniform uint ...`). */ GLOBAL_VAR_TYPE_UINT(9), /** * 2-dimensional unsigned integer vector global shader parameter (`global uniform uvec2 ...`). */ GLOBAL_VAR_TYPE_UVEC2(10), /** * 3-dimensional unsigned integer vector global shader parameter (`global uniform uvec3 ...`). */ GLOBAL_VAR_TYPE_UVEC3(11), /** * 4-dimensional unsigned integer vector global shader parameter (`global uniform uvec4 ...`). */ GLOBAL_VAR_TYPE_UVEC4(12), /** * Single-precision floating-point global shader parameter (`global uniform float ...`). */ GLOBAL_VAR_TYPE_FLOAT(13), /** * 2-dimensional floating-point vector global shader parameter (`global uniform vec2 ...`). */ GLOBAL_VAR_TYPE_VEC2(14), /** * 3-dimensional floating-point vector global shader parameter (`global uniform vec3 ...`). */ GLOBAL_VAR_TYPE_VEC3(15), /** * 4-dimensional floating-point vector global shader parameter (`global uniform vec4 ...`). */ GLOBAL_VAR_TYPE_VEC4(16), /** * Color global shader parameter (`global uniform vec4 ...`). Equivalent to * [GLOBAL_VAR_TYPE_VEC4] in shader code, but exposed as a [Color] in the editor UI. */ GLOBAL_VAR_TYPE_COLOR(17), /** * 2-dimensional floating-point rectangle global shader parameter (`global uniform vec4 ...`). * Equivalent to [GLOBAL_VAR_TYPE_VEC4] in shader code, but exposed as a [Rect2] in the editor UI. */ GLOBAL_VAR_TYPE_RECT2(18), /** * 2×2 matrix global shader parameter (`global uniform mat2 ...`). Exposed as a * [PackedInt32Array] in the editor UI. */ GLOBAL_VAR_TYPE_MAT2(19), /** * 3×3 matrix global shader parameter (`global uniform mat3 ...`). Exposed as a [Basis] in the * editor UI. */ GLOBAL_VAR_TYPE_MAT3(20), /** * 4×4 matrix global shader parameter (`global uniform mat4 ...`). Exposed as a [Projection] in * the editor UI. */ GLOBAL_VAR_TYPE_MAT4(21), /** * 2-dimensional transform global shader parameter (`global uniform mat2x3 ...`). Exposed as a * [Transform2D] in the editor UI. */ GLOBAL_VAR_TYPE_TRANSFORM_2D(22), /** * 3-dimensional transform global shader parameter (`global uniform mat3x4 ...`). Exposed as a * [Transform3D] in the editor UI. */ GLOBAL_VAR_TYPE_TRANSFORM(23), /** * 2D sampler global shader parameter (`global uniform sampler2D ...`). Exposed as a [Texture2D] * in the editor UI. */ GLOBAL_VAR_TYPE_SAMPLER2D(24), /** * 2D sampler array global shader parameter (`global uniform sampler2DArray ...`). Exposed as a * [Texture2DArray] in the editor UI. */ GLOBAL_VAR_TYPE_SAMPLER2DARRAY(25), /** * 3D sampler global shader parameter (`global uniform sampler3D ...`). Exposed as a [Texture3D] * in the editor UI. */ GLOBAL_VAR_TYPE_SAMPLER3D(26), /** * Cubemap sampler global shader parameter (`global uniform samplerCube ...`). Exposed as a * [Cubemap] in the editor UI. */ GLOBAL_VAR_TYPE_SAMPLERCUBE(27), /** * Represents the size of the [GlobalShaderParameterType] enum. */ GLOBAL_VAR_TYPE_MAX(28), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class RenderingInfo( id: Long, ) { /** * Number of objects rendered in the current 3D scene. This varies depending on camera position * and rotation. */ RENDERING_INFO_TOTAL_OBJECTS_IN_FRAME(0), /** * Number of points, lines, or triangles rendered in the current 3D scene. This varies depending * on camera position and rotation. */ RENDERING_INFO_TOTAL_PRIMITIVES_IN_FRAME(1), /** * Number of draw calls performed to render in the current 3D scene. This varies depending on * camera position and rotation. */ RENDERING_INFO_TOTAL_DRAW_CALLS_IN_FRAME(2), /** * Texture memory used (in bytes). */ RENDERING_INFO_TEXTURE_MEM_USED(3), /** * Buffer memory used (in bytes). This includes vertex data, uniform buffers, and many * miscellaneous buffer types used internally. */ RENDERING_INFO_BUFFER_MEM_USED(4), /** * Video memory used (in bytes). When using the Forward+ or mobile rendering backends, this is * always greater than the sum of [RENDERING_INFO_TEXTURE_MEM_USED] and * [RENDERING_INFO_BUFFER_MEM_USED], since there is miscellaneous data not accounted for by those * two metrics. When using the GL Compatibility backend, this is equal to the sum of * [RENDERING_INFO_TEXTURE_MEM_USED] and [RENDERING_INFO_BUFFER_MEM_USED]. */ RENDERING_INFO_VIDEO_MEM_USED(5), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } public enum class Features( id: Long, ) { /** * Hardware supports shaders. This enum is currently unused in Godot 3.x. */ FEATURE_SHADERS(0), /** * Hardware supports multithreading. This enum is currently unused in Godot 3.x. */ FEATURE_MULTITHREADED(1), ; public val id: Long init { this.id = id } public companion object { public fun from(`value`: Long) = entries.single { it.id == `value` } } } internal object MethodBindings { public val texture2dCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_create") public val texture2dLayeredCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_layered_create") public val texture3dCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_3d_create") public val textureProxyCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_proxy_create") public val texture2dUpdatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_update") public val texture3dUpdatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_3d_update") public val textureProxyUpdatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_proxy_update") public val texture2dPlaceholderCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_placeholder_create") public val texture2dLayeredPlaceholderCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_layered_placeholder_create") public val texture3dPlaceholderCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_3d_placeholder_create") public val texture2dGetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_get") public val texture2dLayerGetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_2d_layer_get") public val texture3dGetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_3d_get") public val textureReplacePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_replace") public val textureSetSizeOverridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_set_size_override") public val textureSetPathPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_set_path") public val textureGetPathPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_get_path") public val textureGetFormatPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_get_format") public val textureSetForceRedrawIfVisiblePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_set_force_redraw_if_visible") public val textureRdCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_rd_create") public val textureGetRdTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_get_rd_texture") public val textureGetNativeHandlePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "texture_get_native_handle") public val shaderCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_create") public val shaderSetCodePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_set_code") public val shaderSetPathHintPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_set_path_hint") public val shaderGetCodePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_get_code") public val getShaderParameterListPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_shader_parameter_list") public val shaderGetParameterDefaultPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_get_parameter_default") public val shaderSetDefaultTextureParameterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_set_default_texture_parameter") public val shaderGetDefaultTextureParameterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "shader_get_default_texture_parameter") public val materialCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "material_create") public val materialSetShaderPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "material_set_shader") public val materialSetParamPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "material_set_param") public val materialGetParamPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "material_get_param") public val materialSetRenderPriorityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "material_set_render_priority") public val materialSetNextPassPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "material_set_next_pass") public val meshCreateFromSurfacesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_create_from_surfaces") public val meshCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_create") public val meshSurfaceGetFormatOffsetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_format_offset") public val meshSurfaceGetFormatVertexStridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_format_vertex_stride") public val meshSurfaceGetFormatNormalTangentStridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_format_normal_tangent_stride") public val meshSurfaceGetFormatAttributeStridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_format_attribute_stride") public val meshSurfaceGetFormatSkinStridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_format_skin_stride") public val meshAddSurfacePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_add_surface") public val meshAddSurfaceFromArraysPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_add_surface_from_arrays") public val meshGetBlendShapeCountPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_get_blend_shape_count") public val meshSetBlendShapeModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_set_blend_shape_mode") public val meshGetBlendShapeModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_get_blend_shape_mode") public val meshSurfaceSetMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_set_material") public val meshSurfaceGetMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_material") public val meshGetSurfacePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_get_surface") public val meshSurfaceGetArraysPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_arrays") public val meshSurfaceGetBlendShapeArraysPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_get_blend_shape_arrays") public val meshGetSurfaceCountPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_get_surface_count") public val meshSetCustomAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_set_custom_aabb") public val meshGetCustomAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_get_custom_aabb") public val meshClearPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_clear") public val meshSurfaceUpdateVertexRegionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_update_vertex_region") public val meshSurfaceUpdateAttributeRegionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_update_attribute_region") public val meshSurfaceUpdateSkinRegionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_surface_update_skin_region") public val meshSetShadowMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "mesh_set_shadow_mesh") public val multimeshCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_create") public val multimeshAllocateDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_allocate_data") public val multimeshGetInstanceCountPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_get_instance_count") public val multimeshSetMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_set_mesh") public val multimeshInstanceSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_set_transform") public val multimeshInstanceSetTransform2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_set_transform_2d") public val multimeshInstanceSetColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_set_color") public val multimeshInstanceSetCustomDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_set_custom_data") public val multimeshGetMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_get_mesh") public val multimeshGetAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_get_aabb") public val multimeshInstanceGetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_get_transform") public val multimeshInstanceGetTransform2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_get_transform_2d") public val multimeshInstanceGetColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_get_color") public val multimeshInstanceGetCustomDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_instance_get_custom_data") public val multimeshSetVisibleInstancesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_set_visible_instances") public val multimeshGetVisibleInstancesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_get_visible_instances") public val multimeshSetBufferPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_set_buffer") public val multimeshGetBufferPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "multimesh_get_buffer") public val skeletonCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_create") public val skeletonAllocateDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_allocate_data") public val skeletonGetBoneCountPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_get_bone_count") public val skeletonBoneSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_bone_set_transform") public val skeletonBoneGetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_bone_get_transform") public val skeletonBoneSetTransform2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_bone_set_transform_2d") public val skeletonBoneGetTransform2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_bone_get_transform_2d") public val skeletonSetBaseTransform2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "skeleton_set_base_transform_2d") public val directionalLightCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "directional_light_create") public val omniLightCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "omni_light_create") public val spotLightCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "spot_light_create") public val lightSetColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_color") public val lightSetParamPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_param") public val lightSetShadowPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_shadow") public val lightSetProjectorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_projector") public val lightSetNegativePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_negative") public val lightSetCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_cull_mask") public val lightSetDistanceFadePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_distance_fade") public val lightSetReverseCullFaceModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_reverse_cull_face_mode") public val lightSetBakeModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_bake_mode") public val lightSetMaxSdfgiCascadePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_set_max_sdfgi_cascade") public val lightOmniSetShadowModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_omni_set_shadow_mode") public val lightDirectionalSetShadowModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_directional_set_shadow_mode") public val lightDirectionalSetBlendSplitsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_directional_set_blend_splits") public val lightDirectionalSetSkyModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_directional_set_sky_mode") public val lightProjectorsSetFilterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "light_projectors_set_filter") public val positionalSoftShadowFilterSetQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "positional_soft_shadow_filter_set_quality") public val directionalSoftShadowFilterSetQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "directional_soft_shadow_filter_set_quality") public val directionalShadowAtlasSetSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "directional_shadow_atlas_set_size") public val reflectionProbeCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_create") public val reflectionProbeSetUpdateModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_update_mode") public val reflectionProbeSetIntensityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_intensity") public val reflectionProbeSetAmbientModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_ambient_mode") public val reflectionProbeSetAmbientColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_ambient_color") public val reflectionProbeSetAmbientEnergyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_ambient_energy") public val reflectionProbeSetMaxDistancePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_max_distance") public val reflectionProbeSetSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_size") public val reflectionProbeSetOriginOffsetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_origin_offset") public val reflectionProbeSetAsInteriorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_as_interior") public val reflectionProbeSetEnableBoxProjectionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_enable_box_projection") public val reflectionProbeSetEnableShadowsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_enable_shadows") public val reflectionProbeSetCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_cull_mask") public val reflectionProbeSetResolutionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_resolution") public val reflectionProbeSetMeshLodThresholdPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "reflection_probe_set_mesh_lod_threshold") public val decalCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_create") public val decalSetSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_size") public val decalSetTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_texture") public val decalSetEmissionEnergyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_emission_energy") public val decalSetAlbedoMixPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_albedo_mix") public val decalSetModulatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_modulate") public val decalSetCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_cull_mask") public val decalSetDistanceFadePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_distance_fade") public val decalSetFadePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_fade") public val decalSetNormalFadePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decal_set_normal_fade") public val decalsSetFilterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "decals_set_filter") public val giSetUseHalfResolutionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "gi_set_use_half_resolution") public val voxelGiCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_create") public val voxelGiAllocateDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_allocate_data") public val voxelGiGetOctreeSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_get_octree_size") public val voxelGiGetOctreeCellsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_get_octree_cells") public val voxelGiGetDataCellsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_get_data_cells") public val voxelGiGetDistanceFieldPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_get_distance_field") public val voxelGiGetLevelCountsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_get_level_counts") public val voxelGiGetToCellXformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_get_to_cell_xform") public val voxelGiSetDynamicRangePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_dynamic_range") public val voxelGiSetPropagationPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_propagation") public val voxelGiSetEnergyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_energy") public val voxelGiSetBakedExposureNormalizationPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_baked_exposure_normalization") public val voxelGiSetBiasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_bias") public val voxelGiSetNormalBiasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_normal_bias") public val voxelGiSetInteriorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_interior") public val voxelGiSetUseTwoBouncesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_use_two_bounces") public val voxelGiSetQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "voxel_gi_set_quality") public val lightmapCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_create") public val lightmapSetTexturesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_set_textures") public val lightmapSetProbeBoundsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_set_probe_bounds") public val lightmapSetProbeInteriorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_set_probe_interior") public val lightmapSetProbeCaptureDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_set_probe_capture_data") public val lightmapGetProbeCapturePointsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_get_probe_capture_points") public val lightmapGetProbeCaptureShPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_get_probe_capture_sh") public val lightmapGetProbeCaptureTetrahedraPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_get_probe_capture_tetrahedra") public val lightmapGetProbeCaptureBspTreePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_get_probe_capture_bsp_tree") public val lightmapSetBakedExposureNormalizationPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_set_baked_exposure_normalization") public val lightmapSetProbeCaptureUpdateSpeedPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "lightmap_set_probe_capture_update_speed") public val particlesCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_create") public val particlesSetModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_mode") public val particlesSetEmittingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_emitting") public val particlesGetEmittingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_get_emitting") public val particlesSetAmountPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_amount") public val particlesSetAmountRatioPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_amount_ratio") public val particlesSetLifetimePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_lifetime") public val particlesSetOneShotPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_one_shot") public val particlesSetPreProcessTimePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_pre_process_time") public val particlesSetExplosivenessRatioPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_explosiveness_ratio") public val particlesSetRandomnessRatioPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_randomness_ratio") public val particlesSetInterpToEndPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_interp_to_end") public val particlesSetEmitterVelocityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_emitter_velocity") public val particlesSetCustomAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_custom_aabb") public val particlesSetSpeedScalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_speed_scale") public val particlesSetUseLocalCoordinatesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_use_local_coordinates") public val particlesSetProcessMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_process_material") public val particlesSetFixedFpsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_fixed_fps") public val particlesSetInterpolatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_interpolate") public val particlesSetFractionalDeltaPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_fractional_delta") public val particlesSetCollisionBaseSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_collision_base_size") public val particlesSetTransformAlignPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_transform_align") public val particlesSetTrailsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_trails") public val particlesSetTrailBindPosesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_trail_bind_poses") public val particlesIsInactivePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_is_inactive") public val particlesRequestProcessPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_request_process") public val particlesRestartPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_restart") public val particlesSetSubemitterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_subemitter") public val particlesEmitPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_emit") public val particlesSetDrawOrderPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_draw_order") public val particlesSetDrawPassesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_draw_passes") public val particlesSetDrawPassMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_draw_pass_mesh") public val particlesGetCurrentAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_get_current_aabb") public val particlesSetEmissionTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_set_emission_transform") public val particlesCollisionCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_create") public val particlesCollisionSetCollisionTypePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_collision_type") public val particlesCollisionSetCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_cull_mask") public val particlesCollisionSetSphereRadiusPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_sphere_radius") public val particlesCollisionSetBoxExtentsPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_box_extents") public val particlesCollisionSetAttractorStrengthPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_attractor_strength") public val particlesCollisionSetAttractorDirectionalityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_attractor_directionality") public val particlesCollisionSetAttractorAttenuationPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_attractor_attenuation") public val particlesCollisionSetFieldTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_field_texture") public val particlesCollisionHeightFieldUpdatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_height_field_update") public val particlesCollisionSetHeightFieldResolutionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "particles_collision_set_height_field_resolution") public val fogVolumeCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "fog_volume_create") public val fogVolumeSetShapePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "fog_volume_set_shape") public val fogVolumeSetSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "fog_volume_set_size") public val fogVolumeSetMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "fog_volume_set_material") public val visibilityNotifierCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "visibility_notifier_create") public val visibilityNotifierSetAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "visibility_notifier_set_aabb") public val visibilityNotifierSetCallbacksPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "visibility_notifier_set_callbacks") public val occluderCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "occluder_create") public val occluderSetMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "occluder_set_mesh") public val cameraCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_create") public val cameraSetPerspectivePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_perspective") public val cameraSetOrthogonalPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_orthogonal") public val cameraSetFrustumPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_frustum") public val cameraSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_transform") public val cameraSetCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_cull_mask") public val cameraSetEnvironmentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_environment") public val cameraSetCameraAttributesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_camera_attributes") public val cameraSetUseVerticalAspectPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_set_use_vertical_aspect") public val viewportCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_create") public val viewportSetUseXrPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_use_xr") public val viewportSetSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_size") public val viewportSetActivePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_active") public val viewportSetParentViewportPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_parent_viewport") public val viewportAttachToScreenPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_attach_to_screen") public val viewportSetRenderDirectToScreenPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_render_direct_to_screen") public val viewportSetCanvasCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_canvas_cull_mask") public val viewportSetScaling3dModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_scaling_3d_mode") public val viewportSetScaling3dScalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_scaling_3d_scale") public val viewportSetFsrSharpnessPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_fsr_sharpness") public val viewportSetTextureMipmapBiasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_texture_mipmap_bias") public val viewportSetUpdateModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_update_mode") public val viewportSetClearModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_clear_mode") public val viewportGetRenderTargetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_get_render_target") public val viewportGetTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_get_texture") public val viewportSetDisable3dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_disable_3d") public val viewportSetDisable2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_disable_2d") public val viewportSetEnvironmentModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_environment_mode") public val viewportAttachCameraPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_attach_camera") public val viewportSetScenarioPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_scenario") public val viewportAttachCanvasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_attach_canvas") public val viewportRemoveCanvasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_remove_canvas") public val viewportSetSnap2dTransformsToPixelPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_snap_2d_transforms_to_pixel") public val viewportSetSnap2dVerticesToPixelPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_snap_2d_vertices_to_pixel") public val viewportSetDefaultCanvasItemTextureFilterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_default_canvas_item_texture_filter") public val viewportSetDefaultCanvasItemTextureRepeatPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_default_canvas_item_texture_repeat") public val viewportSetCanvasTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_canvas_transform") public val viewportSetCanvasStackingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_canvas_stacking") public val viewportSetTransparentBackgroundPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_transparent_background") public val viewportSetGlobalCanvasTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_global_canvas_transform") public val viewportSetSdfOversizeAndScalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_sdf_oversize_and_scale") public val viewportSetPositionalShadowAtlasSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_positional_shadow_atlas_size") public val viewportSetPositionalShadowAtlasQuadrantSubdivisionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_positional_shadow_atlas_quadrant_subdivision") public val viewportSetMsaa3dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_msaa_3d") public val viewportSetMsaa2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_msaa_2d") public val viewportSetUseHdr2dPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_use_hdr_2d") public val viewportSetScreenSpaceAaPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_screen_space_aa") public val viewportSetUseTaaPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_use_taa") public val viewportSetUseDebandingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_use_debanding") public val viewportSetUseOcclusionCullingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_use_occlusion_culling") public val viewportSetOcclusionRaysPerThreadPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_occlusion_rays_per_thread") public val viewportSetOcclusionCullingBuildQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_occlusion_culling_build_quality") public val viewportGetRenderInfoPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_get_render_info") public val viewportSetDebugDrawPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_debug_draw") public val viewportSetMeasureRenderTimePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_measure_render_time") public val viewportGetMeasuredRenderTimeCpuPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_get_measured_render_time_cpu") public val viewportGetMeasuredRenderTimeGpuPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_get_measured_render_time_gpu") public val viewportSetVrsModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_vrs_mode") public val viewportSetVrsTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "viewport_set_vrs_texture") public val skyCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sky_create") public val skySetRadianceSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sky_set_radiance_size") public val skySetModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sky_set_mode") public val skySetMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sky_set_material") public val skyBakePanoramaPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sky_bake_panorama") public val environmentCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_create") public val environmentSetBackgroundPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_background") public val environmentSetSkyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sky") public val environmentSetSkyCustomFovPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sky_custom_fov") public val environmentSetSkyOrientationPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sky_orientation") public val environmentSetBgColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_bg_color") public val environmentSetBgEnergyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_bg_energy") public val environmentSetCanvasMaxLayerPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_canvas_max_layer") public val environmentSetAmbientLightPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_ambient_light") public val environmentSetGlowPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_glow") public val environmentSetTonemapPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_tonemap") public val environmentSetAdjustmentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_adjustment") public val environmentSetSsrPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_ssr") public val environmentSetSsaoPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_ssao") public val environmentSetFogPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_fog") public val environmentSetSdfgiPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sdfgi") public val environmentSetVolumetricFogPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_volumetric_fog") public val environmentGlowSetUseBicubicUpscalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_glow_set_use_bicubic_upscale") public val environmentSetSsrRoughnessQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_ssr_roughness_quality") public val environmentSetSsaoQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_ssao_quality") public val environmentSetSsilQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_ssil_quality") public val environmentSetSdfgiRayCountPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sdfgi_ray_count") public val environmentSetSdfgiFramesToConvergePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sdfgi_frames_to_converge") public val environmentSetSdfgiFramesToUpdateLightPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_sdfgi_frames_to_update_light") public val environmentSetVolumetricFogVolumeSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_volumetric_fog_volume_size") public val environmentSetVolumetricFogFilterActivePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_set_volumetric_fog_filter_active") public val environmentBakePanoramaPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "environment_bake_panorama") public val screenSpaceRoughnessLimiterSetActivePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "screen_space_roughness_limiter_set_active") public val subSurfaceScatteringSetQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sub_surface_scattering_set_quality") public val subSurfaceScatteringSetScalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "sub_surface_scattering_set_scale") public val cameraAttributesCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_attributes_create") public val cameraAttributesSetDofBlurQualityPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_attributes_set_dof_blur_quality") public val cameraAttributesSetDofBlurBokehShapePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_attributes_set_dof_blur_bokeh_shape") public val cameraAttributesSetDofBlurPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_attributes_set_dof_blur") public val cameraAttributesSetExposurePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_attributes_set_exposure") public val cameraAttributesSetAutoExposurePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "camera_attributes_set_auto_exposure") public val scenarioCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "scenario_create") public val scenarioSetEnvironmentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "scenario_set_environment") public val scenarioSetFallbackEnvironmentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "scenario_set_fallback_environment") public val scenarioSetCameraAttributesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "scenario_set_camera_attributes") public val instanceCreate2Ptr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_create2") public val instanceCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_create") public val instanceSetBasePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_base") public val instanceSetScenarioPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_scenario") public val instanceSetLayerMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_layer_mask") public val instanceSetPivotDataPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_pivot_data") public val instanceSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_transform") public val instanceAttachObjectInstanceIdPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_attach_object_instance_id") public val instanceSetBlendShapeWeightPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_blend_shape_weight") public val instanceSetSurfaceOverrideMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_surface_override_material") public val instanceSetVisiblePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_visible") public val instanceGeometrySetTransparencyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_transparency") public val instanceSetCustomAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_custom_aabb") public val instanceAttachSkeletonPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_attach_skeleton") public val instanceSetExtraVisibilityMarginPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_extra_visibility_margin") public val instanceSetVisibilityParentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_visibility_parent") public val instanceSetIgnoreCullingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_set_ignore_culling") public val instanceGeometrySetFlagPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_flag") public val instanceGeometrySetCastShadowsSettingPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_cast_shadows_setting") public val instanceGeometrySetMaterialOverridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_material_override") public val instanceGeometrySetMaterialOverlayPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_material_overlay") public val instanceGeometrySetVisibilityRangePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_visibility_range") public val instanceGeometrySetLightmapPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_lightmap") public val instanceGeometrySetLodBiasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_lod_bias") public val instanceGeometrySetShaderParameterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_set_shader_parameter") public val instanceGeometryGetShaderParameterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_get_shader_parameter") public val instanceGeometryGetShaderParameterDefaultValuePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_get_shader_parameter_default_value") public val instanceGeometryGetShaderParameterListPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instance_geometry_get_shader_parameter_list") public val instancesCullAabbPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instances_cull_aabb") public val instancesCullRayPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instances_cull_ray") public val instancesCullConvexPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "instances_cull_convex") public val bakeRenderUv2Ptr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "bake_render_uv2") public val canvasCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_create") public val canvasSetItemMirroringPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_set_item_mirroring") public val canvasSetModulatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_set_modulate") public val canvasSetDisableScalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_set_disable_scale") public val canvasTextureCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_texture_create") public val canvasTextureSetChannelPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_texture_set_channel") public val canvasTextureSetShadingParametersPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_texture_set_shading_parameters") public val canvasTextureSetTextureFilterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_texture_set_texture_filter") public val canvasTextureSetTextureRepeatPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_texture_set_texture_repeat") public val canvasItemCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_create") public val canvasItemSetParentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_parent") public val canvasItemSetDefaultTextureFilterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_default_texture_filter") public val canvasItemSetDefaultTextureRepeatPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_default_texture_repeat") public val canvasItemSetVisiblePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_visible") public val canvasItemSetLightMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_light_mask") public val canvasItemSetVisibilityLayerPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_visibility_layer") public val canvasItemSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_transform") public val canvasItemSetClipPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_clip") public val canvasItemSetDistanceFieldModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_distance_field_mode") public val canvasItemSetCustomRectPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_custom_rect") public val canvasItemSetModulatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_modulate") public val canvasItemSetSelfModulatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_self_modulate") public val canvasItemSetDrawBehindParentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_draw_behind_parent") public val canvasItemAddLinePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_line") public val canvasItemAddPolylinePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_polyline") public val canvasItemAddMultilinePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_multiline") public val canvasItemAddRectPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_rect") public val canvasItemAddCirclePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_circle") public val canvasItemAddTextureRectPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_texture_rect") public val canvasItemAddMsdfTextureRectRegionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_msdf_texture_rect_region") public val canvasItemAddLcdTextureRectRegionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_lcd_texture_rect_region") public val canvasItemAddTextureRectRegionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_texture_rect_region") public val canvasItemAddNinePatchPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_nine_patch") public val canvasItemAddPrimitivePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_primitive") public val canvasItemAddPolygonPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_polygon") public val canvasItemAddTriangleArrayPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_triangle_array") public val canvasItemAddMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_mesh") public val canvasItemAddMultimeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_multimesh") public val canvasItemAddParticlesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_particles") public val canvasItemAddSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_set_transform") public val canvasItemAddClipIgnorePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_clip_ignore") public val canvasItemAddAnimationSlicePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_add_animation_slice") public val canvasItemSetSortChildrenByYPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_sort_children_by_y") public val canvasItemSetZIndexPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_z_index") public val canvasItemSetZAsRelativeToParentPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_z_as_relative_to_parent") public val canvasItemSetCopyToBackbufferPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_copy_to_backbuffer") public val canvasItemClearPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_clear") public val canvasItemSetDrawIndexPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_draw_index") public val canvasItemSetMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_material") public val canvasItemSetUseParentMaterialPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_use_parent_material") public val canvasItemSetVisibilityNotifierPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_visibility_notifier") public val canvasItemSetCanvasGroupModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_item_set_canvas_group_mode") public val debugCanvasItemGetRectPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "debug_canvas_item_get_rect") public val canvasLightCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_create") public val canvasLightAttachToCanvasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_attach_to_canvas") public val canvasLightSetEnabledPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_enabled") public val canvasLightSetTextureScalePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_texture_scale") public val canvasLightSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_transform") public val canvasLightSetTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_texture") public val canvasLightSetTextureOffsetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_texture_offset") public val canvasLightSetColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_color") public val canvasLightSetHeightPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_height") public val canvasLightSetEnergyPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_energy") public val canvasLightSetZRangePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_z_range") public val canvasLightSetLayerRangePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_layer_range") public val canvasLightSetItemCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_item_cull_mask") public val canvasLightSetItemShadowCullMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_item_shadow_cull_mask") public val canvasLightSetModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_mode") public val canvasLightSetShadowEnabledPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_shadow_enabled") public val canvasLightSetShadowFilterPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_shadow_filter") public val canvasLightSetShadowColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_shadow_color") public val canvasLightSetShadowSmoothPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_shadow_smooth") public val canvasLightSetBlendModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_set_blend_mode") public val canvasLightOccluderCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_create") public val canvasLightOccluderAttachToCanvasPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_attach_to_canvas") public val canvasLightOccluderSetEnabledPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_set_enabled") public val canvasLightOccluderSetPolygonPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_set_polygon") public val canvasLightOccluderSetAsSdfCollisionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_set_as_sdf_collision") public val canvasLightOccluderSetTransformPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_set_transform") public val canvasLightOccluderSetLightMaskPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_light_occluder_set_light_mask") public val canvasOccluderPolygonCreatePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_occluder_polygon_create") public val canvasOccluderPolygonSetShapePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_occluder_polygon_set_shape") public val canvasOccluderPolygonSetCullModePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_occluder_polygon_set_cull_mode") public val canvasSetShadowTextureSizePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "canvas_set_shadow_texture_size") public val globalShaderParameterAddPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_add") public val globalShaderParameterRemovePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_remove") public val globalShaderParameterGetListPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_get_list") public val globalShaderParameterSetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_set") public val globalShaderParameterSetOverridePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_set_override") public val globalShaderParameterGetPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_get") public val globalShaderParameterGetTypePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "global_shader_parameter_get_type") public val freeRidPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "free_rid") public val requestFrameDrawnCallbackPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "request_frame_drawn_callback") public val hasChangedPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "has_changed") public val getRenderingInfoPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_rendering_info") public val getVideoAdapterNamePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_video_adapter_name") public val getVideoAdapterVendorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_video_adapter_vendor") public val getVideoAdapterTypePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_video_adapter_type") public val getVideoAdapterApiVersionPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_video_adapter_api_version") public val makeSphereMeshPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "make_sphere_mesh") public val getTestCubePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_test_cube") public val getTestTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_test_texture") public val getWhiteTexturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_white_texture") public val setBootImagePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "set_boot_image") public val getDefaultClearColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_default_clear_color") public val setDefaultClearColorPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "set_default_clear_color") public val hasFeaturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "has_feature") public val hasOsFeaturePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "has_os_feature") public val setDebugGenerateWireframesPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "set_debug_generate_wireframes") public val isRenderLoopEnabledPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "is_render_loop_enabled") public val setRenderLoopEnabledPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "set_render_loop_enabled") public val getFrameSetupTimeCpuPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_frame_setup_time_cpu") public val forceSyncPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "force_sync") public val forceDrawPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "force_draw") public val getRenderingDevicePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "get_rendering_device") public val createLocalRenderingDevicePtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "create_local_rendering_device") public val callOnRenderThreadPtr: VoidPtr = TypeManager.getMethodBindPtr("RenderingServer", "call_on_render_thread") } } public infix fun Long.or(other: godot.RenderingServer.ArrayFormat): Long = this.or(other.flag) public infix fun Long.xor(other: godot.RenderingServer.ArrayFormat): Long = this.xor(other.flag) public infix fun Long.and(other: godot.RenderingServer.ArrayFormat): Long = this.and(other.flag) public operator fun Long.plus(other: godot.RenderingServer.ArrayFormat): Long = this.plus(other.flag) public operator fun Long.minus(other: godot.RenderingServer.ArrayFormat): Long = this.minus(other.flag) public operator fun Long.times(other: godot.RenderingServer.ArrayFormat): Long = this.times(other.flag) public operator fun Long.div(other: godot.RenderingServer.ArrayFormat): Long = this.div(other.flag) public operator fun Long.rem(other: godot.RenderingServer.ArrayFormat): Long = this.rem(other.flag)
64
null
39
580
fd1af79075e7b918200aba3302496b70c76a2028
391,638
godot-kotlin-jvm
MIT License
app/src/main/java/com/example/android/codelabs/navigation/HomeFragment.kt
android
132,657,708
false
null
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.codelabs.navigation import android.os.Bundle import android.view.* import android.widget.Button import androidx.fragment.app.Fragment import androidx.navigation.Navigation import androidx.navigation.fragment.findNavController import androidx.navigation.navOptions /** * Fragment used to show how to navigate to another destination */ class HomeFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { setHasOptionsMenu(true) return inflater.inflate(R.layout.home_fragment, container, false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) // Set an OnClickListener val button = view.findViewById<Button>(R.id.navigate_destination_button) button?.setOnClickListener { findNavController().navigate(R.id.flow_step_one_dest, null) } // Alternative Option: set an OnClickListener, using Navigation.createNavigateOnClickListener() // button?.setOnClickListener { // Navigation.createNavigateOnClickListener(R.id.flow_step_one_dest, null) // } // Set NavOptions // val options = navOptions { // anim { // enter = R.anim.slide_in_right // exit = R.anim.slide_out_left // popEnter = R.anim.slide_in_left // popExit = R.anim.slide_out_right // } // } // view.findViewById<Button>(R.id.navigate_destination_button)?.setOnClickListener { // findNavController().navigate(R.id.flow_step_one_dest, null, options) // } // Update the OnClickListener to navigate using an action view.findViewById<Button>(R.id.navigate_action_button)?.setOnClickListener { val flowStepNumberArg = 1 val action = HomeFragmentDirections.nextAction(flowStepNumberArg) findNavController().navigate(action) } } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.main_menu, menu) } }
9
null
84
634
026d28bbb47951e7105ec4de0c04549e493158dc
2,860
codelab-android-navigation
Apache License 2.0
src/main/kotlin/com/housing/movie/features/episode/domain/usecase/GetEpisodesByMovieIdUseCase.kt
thinhlh
431,658,207
false
null
package com.housing.movie.features.episode.domain.usecase import com.housing.movie.base.BaseUseCase import com.housing.movie.features.episode.domain.entity.Episode import com.housing.movie.features.episode.domain.service.EpisodeService import org.springframework.stereotype.Component import java.util.* @Component class GetEpisodesByMovieIdUseCase( private val episodeService: EpisodeService ) : BaseUseCase { override fun invoke(data: Any?): List<Episode> { return episodeService.getEpisodesByMovieId(data as UUID) } }
0
Kotlin
0
0
f88c15909040f54baf9be3f2adf47429eeccfac5
541
oo-movie-backend
MIT License
application/infrastructure/dataproviders/core-dataprovider/src/main/kotlin/com/redhat/demo/infra/dataproviders/core/repositories/OutboxRepository.kt
maarten-vandeperre
623,821,855
false
{"HTML": 982423, "Kotlin": 141101, "Shell": 30039}
package com.redhat.demo.infra.dataproviders.core.repositories import com.redhat.demo.infra.dataproviders.core.domain.OutboxEvent interface OutboxRepository { fun save(event: OutboxEvent) }
3
HTML
7
36
8f6a00f9516cd1af7bb663bd7f5e6b0ab4e00dd7
192
clean-architecture-software-sample-project
Apache License 2.0
application/infrastructure/dataproviders/core-dataprovider/src/main/kotlin/com/redhat/demo/infra/dataproviders/core/repositories/OutboxRepository.kt
maarten-vandeperre
623,821,855
false
{"HTML": 982423, "Kotlin": 141101, "Shell": 30039}
package com.redhat.demo.infra.dataproviders.core.repositories import com.redhat.demo.infra.dataproviders.core.domain.OutboxEvent interface OutboxRepository { fun save(event: OutboxEvent) }
3
HTML
7
36
8f6a00f9516cd1af7bb663bd7f5e6b0ab4e00dd7
192
clean-architecture-software-sample-project
Apache License 2.0
src/main/kotlin/no/nav/helse/sporbar/AzureAdAppAuthentication.kt
navikt
271,491,647
false
null
package no.nav.helse.sporbar import com.auth0.jwk.JwkProviderBuilder import com.fasterxml.jackson.databind.JsonNode import io.ktor.application.* import io.ktor.auth.* import io.ktor.auth.jwt.* import io.ktor.client.* import io.ktor.client.engine.apache.* import io.ktor.client.features.json.* import io.ktor.client.request.* import io.ktor.http.* import kotlinx.coroutines.runBlocking const val JWT_AUTH = "server_to_server" private val client: HttpClient = HttpClient(Apache) { engine { customizeClient { useSystemProperties() } } install(JsonFeature) } fun Application.azureAdAppAuthentication(wellKnownUrl: String, clientId: String) { val wellKnown = fetchWellKnown(wellKnownUrl) val issuer = wellKnown["issuer"].textValue() val jwksUrl = wellKnown["jwks_uri"].textValue() install(Authentication) { jwt(JWT_AUTH) { verifier(JwkProviderBuilder(jwksUrl).build(), issuer) { withAudience(clientId) } validate { credentials -> JWTPrincipal(credentials.payload) } } } } private fun fetchWellKnown(url: String) = runBlocking { client.get<JsonNode>(url) { accept(ContentType.Application.Json) } }
0
Kotlin
1
0
9ca85a5e3921f1f5688452497461dd8f42cc475f
1,231
helse-sporbar
MIT License
core/src/main/java/it/airgap/beaconsdk/core/internal/BeaconSdk.kt
airgap-it
303,679,512
false
null
package it.airgap.beaconsdk.core.internal import android.content.Context import androidx.annotation.RestrictTo import it.airgap.beaconsdk.core.blockchain.Blockchain import it.airgap.beaconsdk.core.internal.crypto.Crypto import it.airgap.beaconsdk.core.internal.crypto.data.KeyPair import it.airgap.beaconsdk.core.internal.data.BeaconApplication import it.airgap.beaconsdk.core.internal.di.CoreDependencyRegistry import it.airgap.beaconsdk.core.internal.di.DependencyRegistry import it.airgap.beaconsdk.core.internal.storage.StorageManager import it.airgap.beaconsdk.core.internal.utils.failWithUninitialized import it.airgap.beaconsdk.core.internal.utils.toHexString import it.airgap.beaconsdk.core.storage.SecureStorage import it.airgap.beaconsdk.core.storage.Storage @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public class BeaconSdk(context: Context) { private var isInitialized: Boolean = false public val applicationContext: Context = context.applicationContext private var _dependencyRegistry: DependencyRegistry? = null public var dependencyRegistry: DependencyRegistry get() = _dependencyRegistry ?: failWithUninitialized(TAG) private set(value) { _dependencyRegistry = value } private var _app: BeaconApplication? = null public var app: BeaconApplication get() = _app ?: failWithUninitialized(TAG) private set(value) { _app = value } public val beaconId: String get() = app.keyPair.publicKey.toHexString().asString() public suspend fun init( partialApp: BeaconApplication.Partial, configuration: BeaconConfiguration, blockchainFactories: List<Blockchain.Factory<*>>, storage: Storage, secureStorage: SecureStorage, ) { if (isInitialized) return dependencyRegistry = CoreDependencyRegistry(blockchainFactories, storage, secureStorage, configuration) val storageManager = dependencyRegistry.storageManager val crypto = dependencyRegistry.crypto setSdkVersion(storageManager) app = partialApp.toFinal(loadOrGenerateKeyPair(storageManager, crypto)) isInitialized = true } private suspend fun setSdkVersion(storageManager: StorageManager) { storageManager.setSdkVersion(BeaconConfiguration.sdkVersion) } private suspend fun loadOrGenerateKeyPair(storageManager: StorageManager, crypto: Crypto): KeyPair { val seed = storageManager.getSdkSecretSeed() ?: crypto.guid().getOrThrow().also { storageManager.setSdkSecretSeed(it) } return crypto.getKeyPairFromSeed(seed).getOrThrow() } public companion object { internal const val TAG = "BeaconSdk" @Suppress("ObjectPropertyName") private var _instance: BeaconSdk? = null public var instance: BeaconSdk get() = _instance ?: failWithUninitialized(TAG) private set(value) { _instance = value } internal fun create(context: Context) { instance = BeaconSdk(context) } } }
2
Kotlin
4
6
f4183c4f64f49cb2b453425465847f97542bdc8f
3,120
beacon-android-sdk
MIT License
kotlin-react-query/src/main/generated/react/query/queryObserver.core.kt
JetBrains
93,250,841
false
null
// Automatically generated - do not modify! @file:JsModule("react-query") @file:JsNonModule @file:Suppress( "UNUSED_TYPEALIAS_PARAMETER", "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE", ) package react.query typealias QueryObserverListener<TData, TError> = (result: QueryObserverResult<TData, TError>) -> Unit external interface NotifyOptions { var cache: Boolean var listeners: Boolean var onError: Boolean var onSuccess: Boolean } external interface ObserverFetchOptions : FetchOptions { var throwOnError: Boolean } open external class QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey : QueryKey>( client: QueryClient, options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, ) : Subscribable<QueryObserverListener<TData, TError>> { open var options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> protected open fun bindMethods() override fun onSubscribe() override fun onUnsubscribe() open fun shouldFetchOnReconnect(): Boolean open fun shouldFetchOnWindowFocus(): Boolean open fun destroy() open fun setOptions( options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> = definedExternally, notifyOptions: NotifyOptions = definedExternally, ) open fun getOptimisticResult(options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>): QueryObserverResult<TData, TError> open fun getCurrentResult(): QueryObserverResult<TData, TError> open fun trackResult(result: QueryObserverResult<TData, TError>): QueryObserverResult<TData, TError> open fun getNextResult(options: ResultOptions = definedExternally): kotlin.js.Promise<QueryObserverResult<TData, TError>> open fun getCurrentQuery(): Query<TQueryFnData, TError, TQueryData, TQueryKey> open fun remove() open fun refetch(options: RefetchOptions = definedExternally): kotlin.js.Promise<QueryObserverResult<TData, TError>> open fun fetchOptimistic(options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>): kotlin.js.Promise<QueryObserverResult<TData, TError>> protected open fun fetch(fetchOptions: ObserverFetchOptions = definedExternally): kotlin.js.Promise<QueryObserverResult<TData, TError>> protected open fun createResult( query: Query<TQueryFnData, TError, TQueryData, TQueryKey>, options: QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, ): QueryObserverResult<TData, TError> open fun updateResult(notifyOptions: NotifyOptions = definedExternally) open fun onQueryUpdate(action: Action<TData, TError>) }
11
null
6
983
7ef1028ba3e0982dc93edcdfa6ee1edb334ddf35
2,696
kotlin-wrappers
Apache License 2.0
app/src/main/java/io/github/wulkanowy/ui/modules/mobiledevice/MobileDeviceFragment.kt
wezuwiusz
827,505,734
false
null
package io.github.wulkanowy.ui.modules.mobiledevice import android.os.Bundle import android.view.View import android.view.View.GONE import android.view.View.VISIBLE import androidx.core.view.postDelayed import androidx.recyclerview.widget.LinearLayoutManager import com.google.android.material.snackbar.Snackbar import dagger.hilt.android.AndroidEntryPoint import io.github.wulkanowy.R import io.github.wulkanowy.data.db.entities.MobileDevice import io.github.wulkanowy.databinding.FragmentMobileDeviceBinding import io.github.wulkanowy.ui.base.BaseFragment import io.github.wulkanowy.ui.modules.main.MainActivity import io.github.wulkanowy.ui.modules.main.MainView import io.github.wulkanowy.ui.modules.mobiledevice.token.MobileDeviceTokenDialog import io.github.wulkanowy.ui.widgets.DividerItemDecoration import io.github.wulkanowy.utils.getThemeAttrColor import javax.inject.Inject @AndroidEntryPoint class MobileDeviceFragment : BaseFragment<FragmentMobileDeviceBinding>(R.layout.fragment_mobile_device), MobileDeviceView, MainView.TitledView { @Inject lateinit var presenter: MobileDevicePresenter @Inject lateinit var devicesAdapter: MobileDeviceAdapter companion object { fun newInstance() = MobileDeviceFragment() } override val titleStringId: Int get() = R.string.mobile_devices_title override val isViewEmpty: Boolean get() = devicesAdapter.items.isEmpty() override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding = FragmentMobileDeviceBinding.bind(view) messageContainer = binding.mobileDevicesRecycler presenter.onAttachView(this) } override fun initView() { devicesAdapter.onDeviceUnregisterListener = presenter::onUnregisterDevice with(binding.mobileDevicesRecycler) { layoutManager = LinearLayoutManager(context) adapter = devicesAdapter addItemDecoration(DividerItemDecoration(context)) } with(binding) { mobileDevicesSwipe.setOnRefreshListener(presenter::onSwipeRefresh) mobileDevicesSwipe.setColorSchemeColors(requireContext().getThemeAttrColor(R.attr.colorPrimary)) mobileDevicesSwipe.setProgressBackgroundColorSchemeColor(requireContext().getThemeAttrColor(R.attr.colorSwipeRefresh)) mobileDevicesErrorRetry.setOnClickListener { presenter.onRetry() } mobileDevicesErrorDetails.setOnClickListener { presenter.onDetailsClick() } mobileDeviceAddButton.setOnClickListener { presenter.onRegisterDevice() } } } override fun updateData(data: List<MobileDevice>) { with(devicesAdapter) { items = data.toMutableList() notifyDataSetChanged() } } override fun deleteItem(device: MobileDevice, position: Int) { with(devicesAdapter) { items.removeAt(position) notifyItemRemoved(position) notifyItemRangeChanged(position, itemCount) } } override fun restoreDeleteItem(device: MobileDevice, position: Int) { with(devicesAdapter) { items.add(position, device) notifyItemInserted(position) notifyItemRangeChanged(position, itemCount) } } override fun showUndo(device: MobileDevice, position: Int) { var confirmed = true Snackbar.make(binding.mobileDevicesRecycler, getString(R.string.mobile_device_removed), 3000) .setAction(R.string.all_undo) { confirmed = false presenter.onUnregisterCancelled(device, position) }.show() view?.postDelayed(3000) { if (confirmed) presenter.onUnregisterConfirmed(device) } } override fun showRefresh(show: Boolean) { binding.mobileDevicesSwipe.isRefreshing = show } override fun showProgress(show: Boolean) { binding.mobileDevicesProgress.visibility = if (show) VISIBLE else GONE } override fun showEmpty(show: Boolean) { binding.mobileDevicesEmpty.visibility = if (show) VISIBLE else GONE } override fun showErrorView(show: Boolean) { binding.mobileDevicesError.visibility = if (show) VISIBLE else GONE } override fun setErrorDetails(message: String) { binding.mobileDevicesErrorMessage.text = message } override fun enableSwipe(enable: Boolean) { binding.mobileDevicesSwipe.isEnabled = enable } override fun showContent(show: Boolean) { binding.mobileDevicesRecycler.visibility = if (show) VISIBLE else GONE } override fun showTokenDialog() { (activity as? MainActivity)?.showDialogFragment(MobileDeviceTokenDialog.newInstance()) } override fun onDestroyView() { presenter.onDetachView() super.onDestroyView() } }
72
null
6
28
82b4ea930e64d0d6e653fb9024201b372cdb5df2
4,933
neowulkanowy
Apache License 2.0
feature-onboarding-impl/src/main/java/jp/co/soramitsu/feature_onboarding_impl/presentation/welcome/di/WelcomeComponent.kt
soramitsu
278,060,397
false
null
package jp.co.soramitsu.feature_onboarding_impl.presentation.welcome.di import androidx.fragment.app.Fragment import dagger.BindsInstance import dagger.Subcomponent import jp.co.soramitsu.common.di.scope.ScreenScope import jp.co.soramitsu.feature_onboarding_impl.presentation.welcome.WelcomeFragment @Subcomponent( modules = [ WelcomeModule::class ] ) @ScreenScope interface WelcomeComponent { @Subcomponent.Factory interface Factory { fun create( @BindsInstance fragment: Fragment, @BindsInstance shouldShowBack: Boolean ): WelcomeComponent } fun inject(welcomeFragment: WelcomeFragment) }
3
null
14
53
6dafcbd972c4b510328feaf7459eefe76cab2075
668
fearless-Android
Apache License 2.0
tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/ContentTriggers.kt
InsanusMokrassar
163,152,024
false
null
@file:Suppress("unused", "UNCHECKED_CAST") package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CommonMessageFilterExcludeMediaGroups import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByChat import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory import dev.inmo.tgbotapi.extensions.utils.whenCommonMessage import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.abstracts.* import dev.inmo.tgbotapi.types.message.content.media.* import dev.inmo.tgbotapi.types.message.content.media.AudioMediaGroupContent import dev.inmo.tgbotapi.types.message.content.media.DocumentMediaGroupContent import dev.inmo.tgbotapi.types.message.payments.InvoiceContent import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.SentMediaGroupUpdate import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.Update typealias CommonMessageFilter<T> = SimpleFilter<CommonMessage<T>> inline fun <T : MessageContent> CommonMessageFilter(noinline block: CommonMessageFilter<T>) = block internal suspend inline fun <BC : BehaviourContext, reified T : MessageContent> BC.onContentMessageWithType( noinline initialFilter: CommonMessageFilter<T>? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<T>, Update>? = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<T>, Any> = ByChatMessageMarkerFactory, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<T>> ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { when (it) { is BaseSentMessageUpdate -> it.data.whenCommonMessage(::listOfNotNull) is SentMediaGroupUpdate -> it.data else -> null } ?.mapNotNull { message -> if (message.content is T) message as CommonMessage<T> else null } } /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onContentMessage( initialFilter: CommonMessageFilter<MessageContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MessageContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<MessageContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MessageContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onContact( initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<ContactContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<ContactContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<ContactContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onDice( initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DiceContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<DiceContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DiceContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onGame( initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<GameContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<GameContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<GameContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onLocation( initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<LocationContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<LocationContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<LocationContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onLiveLocation( initialFilter: CommonMessageFilter<LiveLocationContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<LiveLocationContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<LiveLocationContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<LiveLocationContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onStaticLocation( initialFilter: CommonMessageFilter<StaticLocationContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<StaticLocationContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<StaticLocationContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<StaticLocationContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onPoll( initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<PollContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PollContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onText( initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onVenue( initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VenueContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<VenueContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VenueContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup( initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioMediaGroupContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<AudioMediaGroupContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioMediaGroupContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onDocumentMediaGroupContent( initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentMediaGroupContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<DocumentMediaGroupContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentMediaGroupContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onTextedMediaContent( initialFilter: CommonMessageFilter<TextedMediaContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextedMediaContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<TextedMediaContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextedMediaContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onMediaCollection( initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaCollectionContent<TelegramMediaFile>>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onMedia( initialFilter: CommonMessageFilter<MediaContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<MediaContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onAnimation( initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AnimationContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<AnimationContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AnimationContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onAudio( initialFilter: CommonMessageFilter<AudioContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<AudioContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onDocument( initialFilter: CommonMessageFilter<DocumentContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<DocumentContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onPhoto( initialFilter: CommonMessageFilter<PhotoContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PhotoContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<PhotoContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PhotoContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onSticker( initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<StickerContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<StickerContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<StickerContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onVideo( initialFilter: CommonMessageFilter<VideoContent>? = null, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<VideoContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onVideoNote( initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoNoteContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<VideoNoteContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoNoteContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onVoice( initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VoiceContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<VoiceContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VoiceContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver ) /** * @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example, * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage]. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own. * Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times] * to combinate several filters * @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously * in one "stream". Output of [markerFactory] will be used as a key for "stream" * @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that * data */ suspend fun <BC : BehaviourContext> BC.onInvoice( initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<InvoiceContent>, Update> = MessageFilterByChat, markerFactory: MarkerFactory<in CommonMessage<InvoiceContent>, Any> = ByChatMessageMarkerFactory, scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<InvoiceContent>> ) = onContentMessageWithType( initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver )
9
null
9
99
8206aefbb661db936d4078a8ef7cc9cecb5384e4
40,491
TelegramBotAPI
Apache License 2.0
features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/BitmapPoolHelper.kt
DataDog
219,536,756
false
{"Kotlin": 9121111, "Java": 1179237, "C": 79303, "Shell": 63055, "C++": 32351, "Python": 5556, "CMake": 2000}
/* * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. * This product includes software developed at Datadog (https://www.datadoghq.com/). * Copyright 2016-Present Datadog, Inc. */ package com.datadog.android.sessionreplay.internal.recorder.resources import android.graphics.Bitmap import com.datadog.android.sessionreplay.internal.utils.InvocationUtils internal class BitmapPoolHelper( private val invocationUtils: InvocationUtils = InvocationUtils() ) { internal fun generateKey(bitmap: Bitmap) = generateKey(bitmap.width, bitmap.height, bitmap.config) internal fun generateKey(width: Int, height: Int, config: Bitmap.Config) = "$width-$height-$config" internal fun<R> safeCall(call: () -> R): R? = invocationUtils.safeCallWithErrorLogging( call = { call() }, failureMessage = BITMAP_OPERATION_FAILED ) private companion object { private const val BITMAP_OPERATION_FAILED = "operation failed for bitmap pool" } }
55
Kotlin
60
151
d7e640cf6440ab150c2bbfbac261e09b27e258f4
1,078
dd-sdk-android
Apache License 2.0
order/src/main/kotlin/com/jahs/context/order/modules/order/domain/create/CreateOrderCommandHandler.kt
jahs-es
236,151,708
false
null
package com.jahs.context.order.modules.order.domain.create import com.jahs.context.order.modules.order.domain.OrderId import com.jahs.context.order.modules.user.domain.UserId import com.kotato.cqrs.domain.command.CommandHandler import javax.inject.Inject import javax.inject.Named @Named open class CreateOrderCommandHandler(@Inject private val creator: OrderCreator) { @CommandHandler fun on(command: CreateOrderCommand) { creator(OrderId.fromString(command.id), UserId.fromString(command.userId)) } }
0
Kotlin
0
0
c2d02b22d7d3677dbe6550e214177fe7526b54df
527
cqrs-ddd-es-order-meetup
MIT License
shapes/src/main/java/shapes/feature/domain/DeleteAllShapesByType.kt
rahulsainani
198,700,715
false
null
package shapes.feature.domain import javax.inject.Inject class DeleteAllShapesByType @Inject constructor( private val repository: IShapesRepository ) { suspend fun delete(shapeType: ShapeDomainEntity.Type) = repository.deleteAllShapesByType(shapeType) }
0
Kotlin
0
8
962f33454933317205b93e9f2552d704766cffc3
273
shapes
Apache License 2.0
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/frame/tags/PVITag.kt
jnk-cons
691,762,451
false
{"Kotlin": 914173}
package de.jnkconsulting.e3dc.easyrscp.api.frame.tags import de.jnkconsulting.e3dc.easyrscp.api.frame.DataType import de.jnkconsulting.e3dc.easyrscp.api.frame.Namespace import de.jnkconsulting.e3dc.easyrscp.api.frame.Tag /** * Contains tags for controlling and reading the photovoltaic inverter * * @param namespace Der Namespace des Tags für die Abbildung des jeweiligen Bereichs * @param hex Code of the tag in HexString format (0x0304001) * @param type Tag data type [DataType] * * @since 2.0 */ enum class PVITag( override val namespace: Namespace = Namespace.PVI, override val hex: String, override val type: DataType ) : Tag { /** * hex = "0x02840000", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DATA&labels=documentation&body=Documentation+update+for+enum+PVITag.DATA:). * * Original E3DC Documentation: * * en: TAG_PVI_INDEX & TAG_PVI_... Response with all data of the REQ_DATA request * * de: TAG_PVI_INDEX & TAG_PVI_... Antwort mit allen Daten der REQ_DATA Anfrage * */ DATA(hex = "0x02840000", type = DataType.CONTAINER), /** * hex = "0x02040000", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DATA&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DATA:). * * Original E3DC Documentation: * * en: TAG_PVI_INDEX & TAG_PVI_REQ... Contains all request TAGs, the container MUST contain an index * * de: TAG_PVI_INDEX & TAG_PVI_REQ... Beinhaltet alle Anfrage-TAGs, der Container MUSS einen Index enthalten * */ REQ_DATA(hex = "0x02040000", type = DataType.CONTAINER), /** * hex = "0x02040001", type = DataType.UINT16 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.INDEX&labels=documentation&body=Documentation+update+for+enum+PVITag.INDEX:). * * Original E3DC Documentation: * * en: Index of the requested device (0?x), Must occur in the request and response to the DATA tag. * * de: Index des angefragten Gerätes (0?x), Muss in Anfrage und Antwort zum DATA-Tag vorkommen * */ INDEX(hex = "0x02040001", type = DataType.UINT16), /** * hex = "0x02040005", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VALUE&labels=documentation&body=Documentation+update+for+enum+PVITag.VALUE:). * * Original E3DC Documentation: * * en: dataType returns the respective data type! * * de: dataType gibt den jeweiligen Daten Typ zurück! * */ VALUE(hex = "0x02040005", type = DataType.NONE), /** * hex = "0x02FFFFFF", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.GENERAL_ERROR&labels=documentation&body=Documentation+update+for+enum+PVITag.GENERAL_ERROR:). * * Original E3DC Documentation: * * en: * * de: */ GENERAL_ERROR(hex = "0x02FFFFFF", type = DataType.CONTAINER), /** * hex = "0x02800001", type = DataType.BOOL * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.ON_GRID&labels=documentation&body=Documentation+update+for+enum+PVITag.ON_GRID:). * * Original E3DC Documentation: * * en: * * de: */ ON_GRID(hex = "0x02800001", type = DataType.BOOL), /** * hex = "0x02000001", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_ON_GRID&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_ON_GRID:). * * Original E3DC Documentation: * * en: * * de: */ REQ_ON_GRID(hex = "0x02000001", type = DataType.NONE), /** * hex = "0x02800002", type = DataType.STRING * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.STATE&labels=documentation&body=Documentation+update+for+enum+PVITag.STATE:). * * Original E3DC Documentation: * * en: * * de: */ STATE(hex = "0x02800002", type = DataType.STRING), /** * hex = "0x02000002", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_STATE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_STATE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_STATE(hex = "0x02000002", type = DataType.NONE), /** * hex = "0x02800003", type = DataType.STRING * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.LAST_ERROR&labels=documentation&body=Documentation+update+for+enum+PVITag.LAST_ERROR:). * * Original E3DC Documentation: * * en: * * de: */ LAST_ERROR(hex = "0x02800003", type = DataType.STRING), /** * hex = "0x02000003", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_LAST_ERROR&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_LAST_ERROR:). * * Original E3DC Documentation: * * en: * * de: */ REQ_LAST_ERROR(hex = "0x02000003", type = DataType.NONE), /** * hex = "0x02800007", type = DataType.STRING * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.FLASH_FILE&labels=documentation&body=Documentation+update+for+enum+PVITag.FLASH_FILE:). * * Original E3DC Documentation: * * en: * * de: */ FLASH_FILE(hex = "0x02800007", type = DataType.STRING), /** * hex = "0x02060000", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DEVICE_STATE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DEVICE_STATE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DEVICE_STATE(hex = "0x02060000", type = DataType.NONE), /** * hex = "0x02860000", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DEVICE_STATE&labels=documentation&body=Documentation+update+for+enum+PVITag.DEVICE_STATE:). * * Original E3DC Documentation: * * en: * * de: DEVICE_CONNECTED & DEVICE_WORKING & DEVICE_IN_SERVICE * */ DEVICE_STATE(hex = "0x02860000", type = DataType.CONTAINER), /** * hex = "0x02860001", type = DataType.BOOL * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DEVICE_CONNECTED&labels=documentation&body=Documentation+update+for+enum+PVITag.DEVICE_CONNECTED:). * * Original E3DC Documentation: * * en: * * de: */ DEVICE_CONNECTED(hex = "0x02860001", type = DataType.BOOL), /** * hex = "0x02860002", type = DataType.BOOL * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DEVICE_WORKING&labels=documentation&body=Documentation+update+for+enum+PVITag.DEVICE_WORKING:). * * Original E3DC Documentation: * * en: * * de: */ DEVICE_WORKING(hex = "0x02860002", type = DataType.BOOL), /** * hex = "0x02860003", type = DataType.BOOL * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DEVICE_IN_SERVICE&labels=documentation&body=Documentation+update+for+enum+PVITag.DEVICE_IN_SERVICE:). * * Original E3DC Documentation: * * en: * * de: */ DEVICE_IN_SERVICE(hex = "0x02860003", type = DataType.BOOL), /** * hex = "0x02000009", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_TYPE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_TYPE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_TYPE(hex = "0x02000009", type = DataType.NONE), /** * hex = "0x02800009", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.TYPE&labels=documentation&body=Documentation+update+for+enum+PVITag.TYPE:). * * Original E3DC Documentation: * * en: * * * de: * 1=SOLU * 2=KACO * 3=E3DC_E * */ TYPE(hex = "0x02800009", type = DataType.UCHAR8), /** * hex = "0x02800060", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.COS_PHI&labels=documentation&body=Documentation+update+for+enum+PVITag.COS_PHI:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_COS_PHI_VALUE & TAG_PVI_COS_PHI_IS_AKTIV & TAG_PVI_COS_PHI_EXCITED * */ COS_PHI(hex = "0x02800060", type = DataType.CONTAINER), /** * hex = "0x02000060", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_COS_PHI&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_COS_PHI:). * * Original E3DC Documentation: * * en: * * de: */ REQ_COS_PHI(hex = "0x02000060", type = DataType.NONE), /** * hex = "0x02000061", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_SET_COS_PHI&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_SET_COS_PHI:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_COS_PHI_VALUE & TAG_PVI_COS_PHI_IS_AKTIV & TAG_PVI_COS_PHI_EXCITED * */ REQ_SET_COS_PHI(hex = "0x02000061", type = DataType.CONTAINER), /** * hex = "0x02000062", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.COS_PHI_VALUE&labels=documentation&body=Documentation+update+for+enum+PVITag.COS_PHI_VALUE:). * * Original E3DC Documentation: * * en: * * de: */ COS_PHI_VALUE(hex = "0x02000062", type = DataType.FLOAT32), /** * hex = "0x02000063", type = DataType.BOOL * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.COS_PHI_IS_AKTIV&labels=documentation&body=Documentation+update+for+enum+PVITag.COS_PHI_IS_AKTIV:). * * Original E3DC Documentation: * * en: * * de: */ COS_PHI_IS_AKTIV(hex = "0x02000063", type = DataType.BOOL), /** * hex = "0x02000064", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.COS_PHI_EXCITED&labels=documentation&body=Documentation+update+for+enum+PVITag.COS_PHI_EXCITED:). * * Original E3DC Documentation: * * en: * * de: */ COS_PHI_EXCITED(hex = "0x02000064", type = DataType.UCHAR8), /** * hex = "0x02800070", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VOLTAGE_MONITORING&labels=documentation&body=Documentation+update+for+enum+PVITag.VOLTAGE_MONITORING:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_VOLTAGE_MONITORING_THRESHOLD_TOP & TAG_PVI_VOLTAGE_MONITORING_THRESHOLD_BOTTOM & TAG_PVI_VOLTAGE_MONITORING_SLOPE_UP & TAG_PVI_VOLTAGE_MONITORING_SLOPE_DOWN * */ VOLTAGE_MONITORING(hex = "0x02800070", type = DataType.CONTAINER), /** * hex = "0x02000070", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_VOLTAGE_MONITORING&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_VOLTAGE_MONITORING:). * * Original E3DC Documentation: * * en: * * de: */ REQ_VOLTAGE_MONITORING(hex = "0x02000070", type = DataType.NONE), /** * hex = "0x02000072", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VOLTAGE_MONITORING_THRESHOLD_TOP&labels=documentation&body=Documentation+update+for+enum+PVITag.VOLTAGE_MONITORING_THRESHOLD_TOP:). * * Original E3DC Documentation: * * en: * * de: */ VOLTAGE_MONITORING_THRESHOLD_TOP(hex = "0x02000072", type = DataType.FLOAT32), /** * hex = "0x02000073", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VOLTAGE_MONITORING_THRESHOLD_BOTTOM&labels=documentation&body=Documentation+update+for+enum+PVITag.VOLTAGE_MONITORING_THRESHOLD_BOTTOM:). * * Original E3DC Documentation: * * en: * * de: */ VOLTAGE_MONITORING_THRESHOLD_BOTTOM(hex = "0x02000073", type = DataType.FLOAT32), /** * hex = "0x02000074", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VOLTAGE_MONITORING_SLOPE_UP&labels=documentation&body=Documentation+update+for+enum+PVITag.VOLTAGE_MONITORING_SLOPE_UP:). * * Original E3DC Documentation: * * en: * * de: */ VOLTAGE_MONITORING_SLOPE_UP(hex = "0x02000074", type = DataType.FLOAT32), /** * hex = "0x02000075", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VOLTAGE_MONITORING_SLOPE_DOWN&labels=documentation&body=Documentation+update+for+enum+PVITag.VOLTAGE_MONITORING_SLOPE_DOWN:). * * Original E3DC Documentation: * * en: * * de: */ VOLTAGE_MONITORING_SLOPE_DOWN(hex = "0x02000075", type = DataType.FLOAT32), /** * hex = "0x02800080", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.FREQUENCY_UNDER_OVER&labels=documentation&body=Documentation+update+for+enum+PVITag.FREQUENCY_UNDER_OVER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_FREQUENCY_UNDER & TAG_PVI_FREQUENCY_OVER * */ FREQUENCY_UNDER_OVER(hex = "0x02800080", type = DataType.CONTAINER), /** * hex = "0x02000080", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_FREQUENCY_UNDER_OVER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_FREQUENCY_UNDER_OVER:). * * Original E3DC Documentation: * * en: * * de: */ REQ_FREQUENCY_UNDER_OVER(hex = "0x02000080", type = DataType.NONE), /** * hex = "0x02000082", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.FREQUENCY_UNDER&labels=documentation&body=Documentation+update+for+enum+PVITag.FREQUENCY_UNDER:). * * Original E3DC Documentation: * * en: * * de: */ FREQUENCY_UNDER(hex = "0x02000082", type = DataType.FLOAT32), /** * hex = "0x02000083", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.FREQUENCY_OVER&labels=documentation&body=Documentation+update+for+enum+PVITag.FREQUENCY_OVER:). * * Original E3DC Documentation: * * en: * * de: */ FREQUENCY_OVER(hex = "0x02000083", type = DataType.FLOAT32), /** * hex = "0x02800085", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.SYSTEM_MODE&labels=documentation&body=Documentation+update+for+enum+PVITag.SYSTEM_MODE:). * * Original E3DC Documentation: * * en: * * de: * * 0=IdleMode * 1=NormalMode * 2=GridChargeMode * 3=BackupPowerMode * */ SYSTEM_MODE(hex = "0x02800085", type = DataType.UCHAR8), /** * hex = "0x02000085", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_SYSTEM_MODE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_SYSTEM_MODE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_SYSTEM_MODE(hex = "0x02000085", type = DataType.NONE), /** * hex = "0x02800087", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.POWER_MODE&labels=documentation&body=Documentation+update+for+enum+PVITag.POWER_MODE:). * * Original E3DC Documentation: * * en: * * de: * * 1=PVI ON * 0=PVI OFF * 101=PVI ON_FORCE * 100=PVI OFF_FORCE * */ POWER_MODE(hex = "0x02800087", type = DataType.UCHAR8), /** * hex = "0x02000087", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_POWER_MODE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_POWER_MODE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_POWER_MODE(hex = "0x02000087", type = DataType.NONE), /** * hex = "0x02800100", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.TEMPERATURE&labels=documentation&body=Documentation+update+for+enum+PVITag.TEMPERATURE:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ TEMPERATURE(hex = "0x02800100", type = DataType.CONTAINER), /** * hex = "0x02000100", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_TEMPERATURE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_TEMPERATURE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_TEMPERATURE(hex = "0x02000100", type = DataType.UCHAR8), /** * hex = "0x02800101", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.TEMPERATURE_COUNT&labels=documentation&body=Documentation+update+for+enum+PVITag.TEMPERATURE_COUNT:). * * Original E3DC Documentation: * * en: * * de: */ TEMPERATURE_COUNT(hex = "0x02800101", type = DataType.NONE), /** * hex = "0x02000101", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_TEMPERATURE_COUNT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_TEMPERATURE_COUNT:). * * Original E3DC Documentation: * * en: * * de: */ REQ_TEMPERATURE_COUNT(hex = "0x02000101", type = DataType.UCHAR8), /** * hex = "0x02800102", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.MAX_TEMPERATURE&labels=documentation&body=Documentation+update+for+enum+PVITag.MAX_TEMPERATURE:). * * Original E3DC Documentation: * * en: * * de: */ MAX_TEMPERATURE(hex = "0x02800102", type = DataType.FLOAT32), /** * hex = "0x02000102", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_MAX_TEMPERATURE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_MAX_TEMPERATURE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_MAX_TEMPERATURE(hex = "0x02000102", type = DataType.UCHAR8), /** * hex = "0x02800103", type = DataType.FLOAT32 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.MIN_TEMPERATURE&labels=documentation&body=Documentation+update+for+enum+PVITag.MIN_TEMPERATURE:). * * Original E3DC Documentation: * * en: * * de: */ MIN_TEMPERATURE(hex = "0x02800103", type = DataType.FLOAT32), /** * hex = "0x02000103", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_MIN_TEMPERATURE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_MIN_TEMPERATURE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_MIN_TEMPERATURE(hex = "0x02000103", type = DataType.UCHAR8), /** * hex = "0x028ABC01", type = DataType.STRING * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.SERIAL_NUMBER&labels=documentation&body=Documentation+update+for+enum+PVITag.SERIAL_NUMBER:). * * Original E3DC Documentation: * * en: * * de: */ SERIAL_NUMBER(hex = "0x028ABC01", type = DataType.STRING), /** * hex = "0x020ABC01", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_SERIAL_NUMBER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_SERIAL_NUMBER:). * * Original E3DC Documentation: * * en: * * de: */ REQ_SERIAL_NUMBER(hex = "0x020ABC01", type = DataType.NONE), /** * hex = "0x028ABC02", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VERSION&labels=documentation&body=Documentation+update+for+enum+PVITag.VERSION:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_VERSION_MAIN |& TAG_PVI_VERSION_PIC |& ?. * */ VERSION(hex = "0x028ABC02", type = DataType.CONTAINER), /** * hex = "0x020ABC02", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_VERSION&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_VERSION:). * * Original E3DC Documentation: * * en: * * de: */ REQ_VERSION(hex = "0x020ABC02", type = DataType.NONE), /** * hex = "0x020ABC03", type = DataType.STRING * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VERSION_MAIN&labels=documentation&body=Documentation+update+for+enum+PVITag.VERSION_MAIN:). * * Original E3DC Documentation: * * en: * * de: */ VERSION_MAIN(hex = "0x020ABC03", type = DataType.STRING), /** * hex = "0x020ABC04", type = DataType.STRING * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.VERSION_PIC&labels=documentation&body=Documentation+update+for+enum+PVITag.VERSION_PIC:). * * Original E3DC Documentation: * * en: * * de: */ VERSION_PIC(hex = "0x020ABC04", type = DataType.STRING), /** * hex = "0x028AC000", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_MAX_PHASE_COUNT&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_MAX_PHASE_COUNT:). * * Original E3DC Documentation: * * en: * * de: */ AC_MAX_PHASE_COUNT(hex = "0x028AC000", type = DataType.UCHAR8), /** * hex = "0x028AC001", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_POWER&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_POWER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_POWER(hex = "0x028AC001", type = DataType.CONTAINER), /** * hex = "0x028AC002", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_VOLTAGE(hex = "0x028AC002", type = DataType.CONTAINER), /** * hex = "0x028AC003", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_CURRENT:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_CURRENT(hex = "0x028AC003", type = DataType.CONTAINER), /** * hex = "0x028AC004", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_APPARENTPOWER&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_APPARENTPOWER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_APPARENTPOWER(hex = "0x028AC004", type = DataType.CONTAINER), /** * hex = "0x028AC005", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_REACTIVEPOWER&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_REACTIVEPOWER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_REACTIVEPOWER(hex = "0x028AC005", type = DataType.CONTAINER), /** * hex = "0x028AC006", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_ENERGY_ALL&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_ENERGY_ALL:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_ENERGY_ALL(hex = "0x028AC006", type = DataType.CONTAINER), /** * hex = "0x028AC007", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_MAX_APPARENTPOWER&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_MAX_APPARENTPOWER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_MAX_APPARENTPOWER(hex = "0x028AC007", type = DataType.CONTAINER), /** * hex = "0x028AC008", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_ENERGY_DAY&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_ENERGY_DAY:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_ENERGY_DAY(hex = "0x028AC008", type = DataType.CONTAINER), /** * hex = "0x028AC009", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.AC_ENERGY_GRID_CONSUMPTION&labels=documentation&body=Documentation+update+for+enum+PVITag.AC_ENERGY_GRID_CONSUMPTION:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ AC_ENERGY_GRID_CONSUMPTION(hex = "0x028AC009", type = DataType.CONTAINER), /** * hex = "0x020AC000", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_MAX_PHASE_COUNT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_MAX_PHASE_COUNT:). * * Original E3DC Documentation: * * en: * * de: * */ REQ_AC_MAX_PHASE_COUNT(hex = "0x020AC000", type = DataType.NONE), /** * hex = "0x020AC001", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_POWER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_POWER:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_POWER(hex = "0x020AC001", type = DataType.UCHAR8), /** * hex = "0x020AC002", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_VOLTAGE:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_VOLTAGE(hex = "0x020AC002", type = DataType.UCHAR8), /** * hex = "0x020AC003", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_CURRENT:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_CURRENT(hex = "0x020AC003", type = DataType.UCHAR8), /** * hex = "0x020AC004", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_APPARENTPOWER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_APPARENTPOWER:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_APPARENTPOWER(hex = "0x020AC004", type = DataType.UCHAR8), /** * hex = "0x020AC005", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_REACTIVEPOWER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_REACTIVEPOWER:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_REACTIVEPOWER(hex = "0x020AC005", type = DataType.UCHAR8), /** * hex = "0x020AC006", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_ENERGY_ALL&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_ENERGY_ALL:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_ENERGY_ALL(hex = "0x020AC006", type = DataType.UCHAR8), /** * hex = "0x020AC007", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_MAX_APPARENTPOWER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_MAX_APPARENTPOWER:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_MAX_APPARENTPOWER(hex = "0x020AC007", type = DataType.UCHAR8), /** * hex = "0x020AC008", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_ENERGY_DAY&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_ENERGY_DAY:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_ENERGY_DAY(hex = "0x020AC008", type = DataType.UCHAR8), /** * hex = "0x020AC009", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_AC_ENERGY_GRID_CONSUMPTION&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_AC_ENERGY_GRID_CONSUMPTION:). * * Original E3DC Documentation: * * en: Value of the request includes the requested phase * * de: Value der Anfrage beinhaltet die angefragte Phase * */ REQ_AC_ENERGY_GRID_CONSUMPTION(hex = "0x020AC009", type = DataType.UCHAR8), /** * hex = "0x028DC000", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_MAX_STRING_COUNT&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_MAX_STRING_COUNT:). * * Original E3DC Documentation: * * en: * * de: */ DC_MAX_STRING_COUNT(hex = "0x028DC000", type = DataType.UCHAR8), /** * hex = "0x028DC001", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_POWER&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_POWER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_POWER(hex = "0x028DC001", type = DataType.CONTAINER), /** * hex = "0x028DC002", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_VOLTAGE(hex = "0x028DC002", type = DataType.CONTAINER), /** * hex = "0x028DC003", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_CURRENT:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_CURRENT(hex = "0x028DC003", type = DataType.CONTAINER), /** * hex = "0x028DC004", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_MAX_POWER&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_MAX_POWER:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_MAX_POWER(hex = "0x028DC004", type = DataType.CONTAINER), /** * hex = "0x028DC005", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_MAX_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_MAX_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_MAX_VOLTAGE(hex = "0x028DC005", type = DataType.CONTAINER), /** * hex = "0x028DC006", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_MIN_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_MIN_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_MIN_VOLTAGE(hex = "0x028DC006", type = DataType.CONTAINER), /** * hex = "0x028DC007", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_MAX_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_MAX_CURRENT:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_MAX_CURRENT(hex = "0x028DC007", type = DataType.CONTAINER), /** * hex = "0x028DC008", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_MIN_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_MIN_CURRENT:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_MIN_CURRENT(hex = "0x028DC008", type = DataType.CONTAINER), /** * hex = "0x028DC009", type = DataType.CONTAINER * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.DC_STRING_ENERGY_ALL&labels=documentation&body=Documentation+update+for+enum+PVITag.DC_STRING_ENERGY_ALL:). * * Original E3DC Documentation: * * en: * * de: TAG_PVI_INDEX & TAG_PVI_VALUE * */ DC_STRING_ENERGY_ALL(hex = "0x028DC009", type = DataType.CONTAINER), /** * hex = "0x020DC000", type = DataType.NONE * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_MAX_STRING_COUNT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_MAX_STRING_COUNT:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_MAX_STRING_COUNT(hex = "0x020DC000", type = DataType.NONE), /** * hex = "0x020DC001", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_POWER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_POWER:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_POWER(hex = "0x020DC001", type = DataType.UCHAR8), /** * hex = "0x020DC002", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_VOLTAGE(hex = "0x020DC002", type = DataType.UCHAR8), /** * hex = "0x020DC003", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_CURRENT:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_CURRENT(hex = "0x020DC003", type = DataType.UCHAR8), /** * hex = "0x020DC004", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_MAX_POWER&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_MAX_POWER:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_MAX_POWER(hex = "0x020DC004", type = DataType.UCHAR8), /** * hex = "0x020DC005", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_MAX_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_MAX_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_MAX_VOLTAGE(hex = "0x020DC005", type = DataType.UCHAR8), /** * hex = "0x020DC006", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_MIN_VOLTAGE&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_MIN_VOLTAGE:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_MIN_VOLTAGE(hex = "0x020DC006", type = DataType.UCHAR8), /** * hex = "0x020DC007", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_MAX_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_MAX_CURRENT:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_MAX_CURRENT(hex = "0x020DC007", type = DataType.UCHAR8), /** * hex = "0x020DC008", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_MIN_CURRENT&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_MIN_CURRENT:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_MIN_CURRENT(hex = "0x020DC008", type = DataType.UCHAR8), /** * hex = "0x020DC009", type = DataType.UCHAR8 * * You know what the tag means or want to improve the tag description? Create a [Ticket](https://github.com/jnk-cons/easy-rscp/issues/new?title=Documentation+improvement+for+PVITag.REQ_DC_STRING_ENERGY_ALL&labels=documentation&body=Documentation+update+for+enum+PVITag.REQ_DC_STRING_ENERGY_ALL:). * * Original E3DC Documentation: * * en: * * de: */ REQ_DC_STRING_ENERGY_ALL(hex = "0x020DC009", type = DataType.UCHAR8), }
5
Kotlin
0
1
14177964121eff69a707f91971721c40edc74405
49,906
easy-rscp
MIT License
library/src/main/java/tmg/aboutthisapp/configuration/Dependency.kt
thementalgoose
228,940,120
false
{"Kotlin": 67683}
package tmg.aboutthisapp.configuration import android.os.Parcelable import androidx.annotation.ColorInt import androidx.annotation.DrawableRes import androidx.annotation.Keep import androidx.compose.ui.graphics.Color import kotlinx.parcelize.Parcelize @Keep @Parcelize data class Dependency( val dependencyName: String, val author: String, val url: String, val icon: DependencyIcon ): Parcelable @Parcelize sealed class DependencyIcon: Parcelable { data class Image( val url: String, @ColorInt val backgroundColor: Int? = null ): DependencyIcon(), Parcelable data class Icon( val icon: Int, @ColorInt val backgroundColor: Int ): DependencyIcon(), Parcelable }
0
Kotlin
0
0
fe23b5b2e59a4c0b21a9cd18d27d3d2d0ad856e3
743
android-about-this-app
Apache License 2.0
app/src/main/java/com/reefii/atlasindonesia/zoom_compose.kt
Reefoldfiveteen
392,013,362
false
null
package com.reefii.atlasindonesia import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.gestures.detectTransformGestures import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.Role.Companion.Image import androidx.compose.ui.tooling.preview.Preview @Preview @Composable fun ZoomableImage() { val scale = remember { mutableStateOf(1f) } val rotationState = remember { mutableStateOf(1f) } Box( modifier = Modifier .clip(RectangleShape) // Clip the box content .fillMaxSize() // Give the size you want... .background(Color.Gray) .pointerInput(Unit) { detectTransformGestures { centroid, pan, zoom, rotation -> scale.value *= zoom rotationState.value += rotation } } ) { Image( modifier = Modifier .align(Alignment.Center) // keep the image centralized into the Box .graphicsLayer( // adding some zoom limits (min 50%, max 200%) scaleX = maxOf(.5f, minOf(3f, scale.value)), scaleY = maxOf(.5f, minOf(3f, scale.value)), rotationZ = rotationState.value ), contentDescription = null, painter = painterResource(R.drawable.papua) ) } }
0
Kotlin
0
0
dd0a8617df71c15f84940fdf867437eb0178645e
2,003
Atlas-Indonesia_Android-App
MIT License
app/src/main/java/com/reefii/atlasindonesia/zoom_compose.kt
Reefoldfiveteen
392,013,362
false
null
package com.reefii.atlasindonesia import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.gestures.detectTransformGestures import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.Role.Companion.Image import androidx.compose.ui.tooling.preview.Preview @Preview @Composable fun ZoomableImage() { val scale = remember { mutableStateOf(1f) } val rotationState = remember { mutableStateOf(1f) } Box( modifier = Modifier .clip(RectangleShape) // Clip the box content .fillMaxSize() // Give the size you want... .background(Color.Gray) .pointerInput(Unit) { detectTransformGestures { centroid, pan, zoom, rotation -> scale.value *= zoom rotationState.value += rotation } } ) { Image( modifier = Modifier .align(Alignment.Center) // keep the image centralized into the Box .graphicsLayer( // adding some zoom limits (min 50%, max 200%) scaleX = maxOf(.5f, minOf(3f, scale.value)), scaleY = maxOf(.5f, minOf(3f, scale.value)), rotationZ = rotationState.value ), contentDescription = null, painter = painterResource(R.drawable.papua) ) } }
0
Kotlin
0
0
dd0a8617df71c15f84940fdf867437eb0178645e
2,003
Atlas-Indonesia_Android-App
MIT License
app/src/main/java/com/fred_projects/education/main/model/verification/check_lvl/ICheckLVL.kt
FredNekrasov
781,117,526
false
{"Kotlin": 163096}
package com.fred_projects.education.main.model.verification.check_lvl interface ICheckLVL { fun check(inf: Int?): Int? }
0
Kotlin
0
0
bc5d3c4a9e8ee86c5f1850e22eb22ec48f81106b
125
Android-projects
MIT License
app/src/main/java/com/oldautumn/movie/ui/main/home/TrendingAdapter.kt
penkzhou
474,989,858
false
{"Kotlin": 285949}
package com.oldautumn.movie.ui.main.home import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView import androidx.recyclerview.widget.RecyclerView import coil.load import coil.transform.RoundedCornersTransformation import com.oldautumn.movie.R import com.oldautumn.movie.data.api.model.UnifyMovieTrendingItem import com.oldautumn.movie.utils.Utils class TrendingAdapter( private val popularList: MutableList<UnifyMovieTrendingItem>, private val onItemClick: (item: UnifyMovieTrendingItem) -> Unit, ) : RecyclerView.Adapter<TrendingAdapter.PopularViewHolder>() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PopularViewHolder { val rootView = LayoutInflater.from(parent.context).inflate(R.layout.item_popular_movie, parent, false) val holder = PopularViewHolder(rootView) rootView.setOnClickListener { val position = holder.bindingAdapterPosition if (position != RecyclerView.NO_POSITION) { val movie = popularList[position] onItemClick(movie) } } return holder } override fun onBindViewHolder(holder: PopularViewHolder, position: Int) { if (position < 0 || position >= popularList.size) { return } val movieTrendingItem = popularList[position] holder.updateViewWithItem(movieTrendingItem) } fun updateData(newPopularList: List<UnifyMovieTrendingItem>) { popularList.clear() popularList.addAll(newPopularList) notifyDataSetChanged() } override fun getItemCount(): Int { return popularList.size } class PopularViewHolder(view: View) : RecyclerView.ViewHolder(view) { private val moviePoster: ImageView = view.findViewById(R.id.movie_poster) fun updateViewWithItem(movieWithImage: UnifyMovieTrendingItem) { moviePoster.contentDescription = movieWithImage.movie.movie.title moviePoster.load(Utils.getImageFullUrl(movieWithImage.image.posters[0].file_path)) { placeholder(R.mipmap.default_poster) transformations(RoundedCornersTransformation(16f)) } } } }
1
Kotlin
0
0
57b16f003a91445d0684873336f4da42e93e84ef
2,285
Movie
MIT License
implementation/src/main/kotlin/io/github/tomplum/aoc/forest/satellite/MessageReport.kt
TomPlum
317,142,882
false
null
package io.github.tomplum.aoc.forest.satellite import io.github.tomplum.aoc.forest.satellite.rule.AndRule import io.github.tomplum.aoc.forest.satellite.rule.MatchRule import io.github.tomplum.aoc.forest.satellite.rule.MessageRule import io.github.tomplum.aoc.forest.satellite.rule.OrRule /** * A [MessageReport] from the Elves at the Mythical Information Bureau. * * They think their satellite has collected an image of a sea monster, but the satellite connection is having * problems, and many of the messages sent back from the satellite have been corrupted. * * This report contains a list of [rules] that the received satellite [messages] should obey. * * @param rules A map of message rules and their respective unique IDs. * @param messages A list of messages received from the satellite. Some are corrupt. */ data class MessageReport(private val rules: MutableMap<Int, MessageRule>, private val messages: List<Message>) { /** * Validates all the [messages] according to the rule with the given [id]. * @param id The id of the [AndRule] of which to verify the [messages] by. * @return The number of messages that completely matched the rules. */ fun getMessagesMatchingRule(id: Int): Int = messages.count { message -> isMatch(message, listOf(id)) } /** * Replaces the given [new] rules in the existing [rules]. * @param new A map of replacement rules with the IDs of the rules to replace. */ fun replaceRules(new: Map<Int, MessageRule>) = new.forEach { (id, rule) -> this.rules[id] = rule } /** * Checks to the see if the given [message] matches the given [rules]. * @param message The current un-checked part of the message. * @param currentRules A list of the rule IDs to check against. */ private fun isMatch(message: Message, currentRules: List<Int>) : Boolean { if (message.isEmpty()) return currentRules.isEmpty() else if (currentRules.isEmpty()) return false return when(val rule = rules[currentRules.first()]) { is AndRule -> isMatch(message, rule.ids + currentRules.drop(1)) is OrRule -> rule.ids.any { ids -> isMatch(message, ids + currentRules.drop(1)) } is MatchRule -> if (rule.isMatch(message)) isMatch(message.dropFirst(), currentRules.drop(1)) else false else -> throw IllegalArgumentException("Invalid Rule Type: ${rule?.javaClass?.simpleName}") } } }
1
Kotlin
0
0
e455d35213832bbd6b72277c0f9e5c0331fd732f
2,444
advent-of-code-2020
Apache License 2.0
platform/platform-impl/src/com/intellij/ide/impl/TrustedProjects.kt
ingokegel
72,937,917
false
null
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. @file:JvmName("TrustedProjects") @file:ApiStatus.Experimental package com.intellij.ide.impl import com.intellij.ide.trustedProjects.TrustedProjects import com.intellij.ide.trustedProjects.TrustedProjectsDialog import com.intellij.ide.trustedProjects.TrustedProjectsListener import com.intellij.ide.trustedProjects.TrustedProjectsLocator import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.* import com.intellij.openapi.project.Project import com.intellij.openapi.util.NlsContexts import com.intellij.util.ThreeState import com.intellij.util.messages.Topic import com.intellij.util.xmlb.annotations.Attribute import org.jetbrains.annotations.ApiStatus import java.nio.file.Path import java.util.function.Consumer @Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith") @ApiStatus.ScheduledForRemoval @Deprecated("Use com.intellij.ide.impl.trustedProjects.TrustedProjectsDialog instead") fun confirmOpeningOrLinkingUntrustedProject( projectRoot: Path, project: Project, @NlsContexts.DialogTitle title: String, @NlsContexts.DialogMessage message: String, @NlsContexts.Button trustButtonText: String, @NlsContexts.Button distrustButtonText: String, @NlsContexts.Button cancelButtonText: String ): Boolean = TrustedProjectsDialog.confirmOpeningOrLinkingUntrustedProject( projectRoot, project, title, message, trustButtonText, distrustButtonText, cancelButtonText ) @Suppress("DEPRECATION", "DeprecatedCallableAddReplaceWith") @Deprecated("Use com.intellij.ide.impl.trustedProjects.TrustedProjectsDialog instead") fun confirmLoadingUntrustedProject( project: Project, @NlsContexts.DialogTitle title: String, @NlsContexts.DialogMessage message: String, @NlsContexts.Button trustButtonText: String, @NlsContexts.Button distrustButtonText: String ): Boolean = TrustedProjectsDialog.confirmLoadingUntrustedProject( project, title, message, trustButtonText, distrustButtonText ) @ApiStatus.Internal enum class OpenUntrustedProjectChoice { TRUST_AND_OPEN, OPEN_IN_SAFE_MODE, CANCEL; } fun Project.isTrusted(): Boolean = TrustedProjects.isProjectTrusted(TrustedProjectsLocator.locateProject(this)) fun Project.setTrusted(isTrusted: Boolean): Unit = TrustedProjects.setProjectTrusted(TrustedProjectsLocator.locateProject(this), isTrusted) fun Project.getTrustedState(): ThreeState = TrustedProjects.getProjectTrustedState(TrustedProjectsLocator.locateProject(this)) @ApiStatus.Internal fun isTrustedCheckDisabled(): Boolean = TrustedProjects.isTrustedCheckDisabled() @JvmOverloads @ApiStatus.Internal @Suppress("DEPRECATION") @ApiStatus.ScheduledForRemoval @Deprecated("Use TrustedProjects.isProjectTrusted instead") fun isProjectImplicitlyTrusted(projectDir: Path?, project: Project? = null): Boolean = TrustedProjects.isProjectImplicitlyTrusted(projectDir, project) /** * Per-project "is this project trusted" setting from the previous version of the trusted API. * It shouldn't be used and is kept for migration purposes only. */ @State(name = "Trusted.Project.Settings", storages = [Storage(StoragePathMacros.PRODUCT_WORKSPACE_FILE)]) @Service(Service.Level.PROJECT) @ApiStatus.Internal @Suppress("DEPRECATION") @Deprecated("Use TrustedPaths instead") internal class TrustedProjectSettings : SimplePersistentStateComponent<TrustedProjectSettings.State>(State()) { class State : BaseState() { @get:Attribute var isTrusted: ThreeState by enum(ThreeState.UNSURE) } var trustedState: ThreeState get() = state.isTrusted set(value) { state.isTrusted = value } } @Suppress("DEPRECATION") @Deprecated("Use TrustedProjectsListener instead") interface TrustStateListener { fun onProjectTrusted(project: Project) { } fun onProjectUntrusted(project: Project) { } fun onProjectTrustedFromNotification(project: Project) { } class Bridge : TrustedProjectsListener { override fun onProjectTrusted(project: Project) { ApplicationManager.getApplication().messageBus .syncPublisher(TOPIC) .onProjectTrusted(project) } override fun onProjectUntrusted(project: Project) { ApplicationManager.getApplication().messageBus .syncPublisher(TOPIC) .onProjectUntrusted(project) } override fun onProjectTrustedFromNotification(project: Project) { ApplicationManager.getApplication().messageBus .syncPublisher(TOPIC) .onProjectTrustedFromNotification(project) } } companion object { @JvmField @Topic.AppLevel val TOPIC: Topic<TrustStateListener> = Topic(TrustStateListener::class.java, Topic.BroadcastDirection.NONE) } } @JvmOverloads @ApiStatus.ScheduledForRemoval @Deprecated("Use onceWhenProjectTrusted instead", ReplaceWith("onceWhenProjectTrusted(parentDisposable, listener)")) fun whenProjectTrusted(parentDisposable: Disposable? = null, listener: (Project) -> Unit) { TrustedProjectsListener.onceWhenProjectTrusted(parentDisposable, listener) } @JvmOverloads @ApiStatus.ScheduledForRemoval @Deprecated("Use onceWhenProjectTrusted instead", ReplaceWith("onceWhenProjectTrusted(parentDisposable, listener::accept)")) fun whenProjectTrusted(parentDisposable: Disposable? = null, listener: Consumer<Project>): Unit = TrustedProjectsListener.onceWhenProjectTrusted(parentDisposable, listener::accept) const val TRUSTED_PROJECTS_HELP_TOPIC: String = "Project_security"
249
null
5023
2
b07eabd319ad5b591373d63c8f502761c2b2dfe8
5,561
intellij-community
Apache License 2.0
test-utils-keyboard/src/jsMain/kotlin/MockFocusHandler.kt
splendo
191,371,940
false
null
/* Copyright 2022 Splendo Consulting B.V. The Netherlands Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.splendo.kaluga.test.keyboard import com.splendo.kaluga.keyboard.FocusHandler actual class MockFocusHandler : BaseMockFocusHandler(), FocusHandler { actual fun simulateGiveFocus() { super.giveFocus() } actual fun simulateRemoveFocus() { super.removeFocus() } }
126
null
6
156
1d77c756008e30aa0818b3ae5f06a63e0371850d
931
kaluga
Apache License 2.0
app/src/main/java/com/sublimetech/supervisor/domain/useCases/storage/FirebaseStorageUseCases.kt
Xget7
675,440,130
false
null
package com.sublimetech.supervisor.domain.useCases.storage import com.sublimetech.supervisor.domain.useCases.storage.files.DownloadFileUseCase import com.sublimetech.supervisor.domain.useCases.storage.images.UploadImageUseCase data class FirebaseStorageUseCases( val downloadFileUseCase: DownloadFileUseCase, val uploadImageUseCase: UploadImageUseCase )
0
Kotlin
0
0
b86ee2e9a33ec8ee6551c4284b0c0c03c80f0038
364
Data-Collector
MIT License
presentation/src/main/java/com/jsevilla/movieviewer/feature/base/BaseActivity.kt
sevilla1jose
289,142,821
false
null
package com.jsevilla.movieviewer.feature.base import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import androidx.databinding.ViewDataBinding /** * Created by Jose Sevilla on 20/08/2020. * [email protected] * * Movie Viewer * Lima, Peru. **/ abstract class BaseActivity<T : ViewDataBinding, out V : BaseViewModel<*>> : AppCompatActivity() { private lateinit var viewDataBinding: T // private variable just for set the viewModel variable to the view (Data binding) private var _viewModel: V? = null abstract val getLayoutId: Int abstract val getViewModel: V abstract val getBindingVariable: Int override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) viewDataBinding = DataBindingUtil.setContentView(this, getLayoutId) _viewModel = if (_viewModel == null) getViewModel else _viewModel viewDataBinding.setVariable(getBindingVariable, _viewModel) /** * use Fragment.viewLifecycleOwner for fragments */ viewDataBinding.lifecycleOwner = this viewDataBinding.executePendingBindings() } }
0
Kotlin
0
0
981da309e459e32f5a825b94e25294ded2608fcf
1,208
Movie-viewer
MIT License
Scanner/Android/app/src/main/java/ca/snmc/scanner/data/providers/VisitLogFileProvider.kt
snmcCode
272,461,777
false
{"C#": 420531, "Kotlin": 263098, "HTML": 148679, "TSQL": 22187, "CSS": 9706, "JavaScript": 920}
package ca.snmc.scanner.data.providers import android.content.Context import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import ca.snmc.scanner.models.VisitInfo import com.github.doyaaaaaken.kotlincsv.client.CsvReader import com.github.doyaaaaaken.kotlincsv.client.CsvWriter import java.io.File import java.util.* class VisitLogFileProvider( context: Context, fileName: String ) { private val file: File = File(context.filesDir, fileName) private val csvReader: CsvReader = CsvReader() private val csvWriter: CsvWriter = CsvWriter() private var logCountObservable : MutableLiveData<Int> init { checkIfFileExists() logCountObservable = MutableLiveData(getLogCount()) } fun checkIfFileExists() { if (!file.exists()) { file.createNewFile() } } private fun readLogs(): List<List<String>> { return csvReader.readAll(file) } private fun getLogCount(): Int { return readLogs().size } fun updateObsoleteLogs() { // Read the old logs val logs = readLogs() // Check if the old logs are empty if (logs.isNotEmpty()) { // Generate a list of new logs val newLogsVisitInfoList = mutableListOf<VisitInfo>() when (logs[0].size) { 9 -> { // Check if the logs have the old format V2.1 and lower // Copy each log from old list to new list logs.forEach { log -> newLogsVisitInfoList.add(VisitInfo( visitorId = UUID.fromString(log[0]), organization = log[1], door = log[2], direction = log[3], eventId = null, bookingOverride = null, capacityOverride = null, scannerVersion = log[4], deviceId = log[5], deviceLocation = log[6], dateTimeFromScanner = log[7], anti_duplication_timestamp = log[8].toLong() )) } } 11 -> { // Check if the logs have the old format V2.2-V2.3 // Copy each log from old list to new list logs.forEach { log -> newLogsVisitInfoList.add(VisitInfo( visitorId = UUID.fromString(log[0]), organization = log[1], door = log[2], direction = log[3], eventId = log[4].toIntOrNull(), bookingOverride = null, capacityOverride = null, scannerVersion = log[6], deviceId = log[7], deviceLocation = log[8], dateTimeFromScanner = log[9], anti_duplication_timestamp = log[10].toLong() )) } } else -> { // Copy each log from old list to new list logs.forEach { log -> newLogsVisitInfoList.add(VisitInfo( visitorId = UUID.fromString(log[0]), organization = log[1], door = log[2], direction = log[3], eventId = log[4].toIntOrNull(), bookingOverride = null, capacityOverride = log[6].toBoolean(), scannerVersion = log[7], deviceId = log[8], deviceLocation = log[9], dateTimeFromScanner = log[10], anti_duplication_timestamp = log[11].toLong() )) } } } // Delete old logs deleteLogs() // Write new logs updateLogs(newLogsVisitInfoList.toList()) } } fun getLogs(): List<VisitInfo>? { val rows = readLogs() var visitLogsList: List<VisitInfo>? = null if (rows.isNotEmpty()) { visitLogsList = MutableList(rows.size) { index -> when (rows[index].size) { 9 -> { // Backwards compatibility for scanner versions 2.1 and below return@MutableList VisitInfo( visitorId = UUID.fromString(rows[index][0]), organization = rows[index][1], door = rows[index][2], direction = rows[index][3], eventId = null, bookingOverride = null, capacityOverride = null, scannerVersion = rows[index][4], deviceId = rows[index][5], deviceLocation = rows[index][6], dateTimeFromScanner = rows[index][7], anti_duplication_timestamp = rows[index][8].toLong() ) } 11 -> { // Backwards compatibility for scanner versions 2.2-2.3 return@MutableList VisitInfo( visitorId = UUID.fromString(rows[index][0]), organization = rows[index][1], door = rows[index][2], direction = rows[index][3], eventId = rows[index][4].toIntOrNull(), bookingOverride = null, capacityOverride = null, scannerVersion = rows[index][6], deviceId = rows[index][7], deviceLocation = rows[index][8], dateTimeFromScanner = rows[index][9], anti_duplication_timestamp = rows[index][10].toLong() ) } else -> { return@MutableList VisitInfo( visitorId = UUID.fromString(rows[index][0]), organization = rows[index][1], door = rows[index][2], direction = rows[index][3], eventId = rows[index][4].toIntOrNull(), bookingOverride = null, capacityOverride = rows[index][6].toBoolean(), scannerVersion = rows[index][7], deviceId = rows[index][8], deviceLocation = rows[index][9], dateTimeFromScanner = rows[index][10], anti_duplication_timestamp = rows[index][11].toLong() ) } } }.toList() } return visitLogsList } fun writeLog(visitInfo: VisitInfo) { csvWriter.open(file, append = true) { writeRow(listOf( visitInfo.visitorId, visitInfo.organization, visitInfo.door, visitInfo.direction, visitInfo.eventId, visitInfo.bookingOverride, visitInfo.capacityOverride, visitInfo.scannerVersion, visitInfo.deviceId, visitInfo.deviceLocation, visitInfo.dateTimeFromScanner, visitInfo.anti_duplication_timestamp )) } logCountObservable.postValue(getLogCount()) } fun updateLogs(visitInfoList: List<VisitInfo>) { csvWriter.open(file, append = false) { visitInfoList.forEach { visitInfo -> writeRow(listOf( visitInfo.visitorId, visitInfo.organization, visitInfo.door, visitInfo.direction, visitInfo.eventId, visitInfo.bookingOverride, visitInfo.capacityOverride, visitInfo.scannerVersion, visitInfo.deviceId, visitInfo.deviceLocation, visitInfo.dateTimeFromScanner, visitInfo.anti_duplication_timestamp )) } } logCountObservable.postValue(getLogCount()) } fun deleteLogs() { if (file.exists()) { file.delete() } checkIfFileExists() logCountObservable.postValue(getLogCount()) } fun getLogCountObservable() : LiveData<Int> { return logCountObservable } }
29
C#
1
6
f1bb550397b4e959beb501e77c27110d439a64b3
9,204
covidTracking
MIT License
lint/tests/testSrc/com/android/tools/idea/lint/common/AnnotateQuickFixTest.kt
JetBrains
60,701,247
false
null
/* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.idea.lint.common import com.android.tools.idea.testing.moveCaret import com.android.tools.lint.client.api.LintClient import com.android.tools.lint.detector.api.DefaultPosition import com.android.tools.lint.detector.api.Incident import com.android.tools.lint.detector.api.LintFix import com.android.tools.lint.detector.api.Location import com.android.tools.tests.AdtTestProjectDescriptors import com.intellij.codeInspection.util.IntentionFamilyName import com.intellij.modcommand.ActionContext import com.intellij.modcommand.ModCommand import com.intellij.modcommand.ModCommandAction import com.intellij.modcommand.Presentation import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.vfs.VfsUtilCore import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.refactoring.suggested.endOffset import com.intellij.refactoring.suggested.startOffset import org.jetbrains.android.JavaCodeInsightFixtureAdtTestCase class AnnotateQuickFixTest : JavaCodeInsightFixtureAdtTestCase() { init { LintClient.clientName = LintClient.CLIENT_UNIT_TESTS } override fun getProjectDescriptor() = AdtTestProjectDescriptors.kotlin() fun testKotlinAnnotationArgs() { check( fileName = "src/p1/p2/AnnotateTest.kt", // language=kotlin originalSource = """ package p1.p2 const val someProperty = "" """, selected = "someProperty", name = "Add @Suppress(SomeInspection)", annotationSource = "@kotlin.Suppress(\"SomeInspection\")", replace = true, // language=kotlin expected = """ package p1.p2 @Suppress("SomeInspection") const val someProperty = "" """, ) } fun testKotlinClass() { check( fileName = "src/p1/p2/AnnotateTest.kt", // language=kotlin originalSource = """ /** Class */ class AnnotateTest """, selected = "class", name = "Add @Suppress(SomeInspection)", annotationSource = "@kotlin.Suppress(\"SomeInspection\")", replace = false, // language=kotlin expected = """ /** Class */ @Suppress("SomeInspection") class AnnotateTest """, ) } fun testJavaClass() { check( fileName = "src/p1/p2/AnnotateTest.java", // language=java originalSource = """ package p1.p2; class AnnotateTest { } """, selected = "class AnnotateTest", name = "Add @SuppressWarnings", annotationSource = "@java.lang.SuppressWarnings(\"SomeIssueId\")", replace = true, // language=java expected = """ package p1.p2; @SuppressWarnings("SomeIssueId") class AnnotateTest { } """, ) } fun testJavaClassReplace() { check( fileName = "src/p1/p2/AnnotateTest.java", // language=java originalSource = """ package p1.p2; @SuppressWarnings("SomeIssueId1") class AnnotateTest { } """, selected = "class AnnotateTest", name = "Add @SuppressWarnings", annotationSource = "@java.lang.SuppressWarnings(\"SomeIssueId2\")", replace = true, // language=java expected = """ package p1.p2; @SuppressWarnings("SomeIssueId2") class AnnotateTest { } """, ) } fun testKotlinUseSiteTarget() { check( fileName = "src/p1/p2/AnnotateTest.kt", // language=kotlin originalSource = """ package p1.p2 const val someProperty = "" """, selected = "someProperty", name = "Add @get:JvmSynthetic", annotationSource = "@get:JvmSynthetic", replace = true, // language=kotlin expected = """ package p1.p2 @get:JvmSynthetic const val someProperty = "" """, ) } fun testKotlinMultipleAnnotations() { check( fileName = "src/p1/p2/AnnotateTest.kt", // language=kotlin originalSource = """ package p1.p2 const val someProperty = "" """, selected = "someProperty", annotations = listOf( Triple("Add @Suppress(SomeInspection1)", "@kotlin.Suppress(\"SomeInspection1\")", false), Triple("Add @Suppress(SomeInspection2)", "@kotlin.Suppress(\"SomeInspection2\")", false), ), // language=kotlin expected = """ package p1.p2 @Suppress("SomeInspection2") @Suppress("SomeInspection1") const val someProperty = "" """, ) } fun testKotlinReplaceAnnotation() { check( fileName = "src/p1/p2/AnnotateTest.kt", // language=kotlin originalSource = """ package p1.p2 @Suppress("SomeInspection1") const val someProperty = "" """, selected = "someProperty", name = "Add @Suppress(SomeInspection2)", annotationSource = "@kotlin.Suppress(\"SomeInspection2\")", replace = true, // language=kotlin expected = """ package p1.p2 @Suppress("SomeInspection2") const val someProperty = "" """, ) } fun testAnnotateDifferentFile() { // Make sure that the annotate quickfix range works properly (such that // an inspection result can annotate a result in a different file or part // of the current file than the error location) var unrelatedFile: PsiFile? = null check( fileName = "src/p1/p2/AnnotateTest.kt", // language=kotlin originalSource = """ package p1.p2 class Test { fun test() { } } """, extraSetup = { unrelatedFile = myFixture.configureByText( "src/p1/p2/AnnotateTest.kt", // language="Java """ package p1.p2 class Unrelated { fun method() { } } """ .trimIndent(), ) }, selected = "test", name = "Add @Suppress(SomeInspection2)", annotationSource = "@kotlin.Suppress(\"SomeInspection2\")", replace = false, // language=kotlin // Make sure we *don't* insert the annotation here expected = """ package p1.p2 class Test { fun test() { } } """, rangeFactory = { annotationSource -> val targetFile = unrelatedFile!! assertEquals("@kotlin.Suppress(\"SomeInspection2\")", annotationSource) val text = targetFile.text val offset = text.indexOf("fun method") Location.create( targetFile.virtualFile.toNioPath().toFile(), DefaultPosition(-1, -1, offset), DefaultPosition(-1, -1, text.indexOf('\n', offset)), ) }, extraVerify = { assertEquals( // language="Java """ package p1.p2 class Unrelated { @Suppress("SomeInspection2") fun method() { } } """ .trimIndent(), unrelatedFile?.text, ) }, ) } fun testTomlSuppressFix() { val file = myFixture.configureByText( "src/test.toml", // language=TOML """ key1="value1" key<caret>2="value2" #noinspection MyId2 key3="value3" """ .trimIndent(), ) val element = myFixture.elementAtCaret val intention = SuppressLintIntentionAction("MyId1", element).asIntention() myFixture.checkPreviewAndLaunchAction(intention) assertEquals( // language=TOML """ key1="value1" #noinspection MyId1 key2="value2" #noinspection MyId2 key3="value3" """ .trimIndent(), file.text, ) } // Test infrastructure below private fun PsiElement.getIncident(): Incident { val file = containingFile!! val location = Location.create( VfsUtilCore.virtualToIoFile(file.virtualFile), DefaultPosition(-1, -1, startOffset), DefaultPosition(-1, -1, endOffset), ) return Incident().location(location) } private fun createMultipleAnnotationFixes( element: PsiElement, annotations: List<Triple<String, String, Boolean>>, rangeFactory: ((String) -> Location?)?, useLintFix: Boolean, ): Array<LintIdeQuickFix> { if (useLintFix) { val fixes = mutableListOf<LintFix>() for ((name, annotationSource, replace) in annotations) { fixes.add( LintFix.create() .name(name) .annotate(annotationSource, null, null, replace) .apply { val range = rangeFactory?.invoke(annotationSource) if (range != null) { range(range) } } .build() ) } val composite: LintFix = LintFix.create().name("Add multiple annotations").composite(fixes) return LintIdeFixPerformer.createIdeFixes( project, element.containingFile, element.getIncident(), composite, true, ) } else { val fixes = mutableListOf<AnnotateQuickFix>() for ((name, annotationSource, replace) in annotations) { val range = rangeFactory?.invoke(annotationSource) fixes.add(AnnotateQuickFix(project, name, null, annotationSource, replace, range)) } class CompositeLintFix( private val displayName: String, private val familyName: String, private val myFixes: Array<AnnotateQuickFix>, ) : ModCommandAction { override fun getPresentation(context: ActionContext): Presentation? = if (myFixes.any { it.getPresentation(context) == null }) null else Presentation.of(displayName) @Suppress("UnstableApiUsage") override fun perform(context: ActionContext) = // This illustrates composition for our quick fixes. Because they depend on the order in which they are applied (e.g. one // quick fix could add an annotation, and another would add or replace that annotation depending on context), we cannot directly // compose the corresponding ModCommands via ModCompositeCommand or .andThen() chaining. // We first collect all the elements to be updated (important because some of the quick fixes are non-local, they edit different // files), pass them through getWritable() to make copies, and then apply each quick fix in sequence, within a single // ModCommand.psiUpdate() call. ModCommand.psiUpdate(context) { updater -> val targets = myFixes.map { updater.getWritable(it.findPsiTarget(context)) } myFixes.zip(targets).map { (fix, target) -> fix.applyFixFun(target!!) } } override fun getFamilyName(): @IntentionFamilyName String = familyName } return arrayOf(ModCommandLintQuickFix(CompositeLintFix(name, "Fix", fixes.toTypedArray()))) } } private fun check( fileName: String, originalSource: String, selected: String, name: String, annotationSource: String, replace: Boolean, expected: String, extraSetup: (() -> Unit)? = null, rangeFactory: ((String) -> Location?)? = null, extraVerify: (() -> Unit)? = null, ) { check( fileName, originalSource, selected, listOf(Triple(name, annotationSource, replace)), extraSetup, rangeFactory, extraVerify, expected, ) } private fun check( fileName: String, originalSource: String, selected: String, annotations: List<Triple<String, String, Boolean>>, extraSetup: (() -> Unit)? = null, rangeFactory: ((String) -> Location?)? = null, extraVerify: (() -> Unit)? = null, expected: String, ) { // Test with PSI-based annotation insertion (AnnotateQuickFix) check( fileName, originalSource, selected, expected, annotations, extraSetup, rangeFactory, extraVerify, false, ) // Test with lint-based annotation insertion (LintIdeFixPerformer) check( fileName, originalSource, selected, expected, annotations, extraSetup, rangeFactory, extraVerify, true, ) } private fun check( fileName: String, originalSource: String, selected: String, expected: String, annotations: List<Triple<String, String, Boolean>>, extraSetup: (() -> Unit)? = null, rangeFactory: ((String) -> Location?)?, extraVerify: (() -> Unit)?, useLintFix: Boolean, ) { extraSetup?.invoke() val file = myFixture.configureByText(fileName, originalSource.trimIndent()) // Modify document slightly to make sure we're not holding on to stale offsets WriteCommandAction.runWriteCommandAction(project) { val documentManager = PsiDocumentManager.getInstance(project) val document = myFixture.editor.document documentManager.doPostponedOperationsAndUnblockDocument(document) document.insertString(0, "/*prefix*/") documentManager.commitDocument(document) } val element = myFixture.findElementByText(selected, PsiElement::class.java) val fixes = createMultipleAnnotationFixes(element, annotations, rangeFactory, useLintFix) val context = AndroidQuickfixContexts.EditorContext.getInstance(myFixture.editor, myFixture.file) myFixture.moveCaret("|$selected") for (fix in fixes) { if (fix is ModCommandLintQuickFix) { myFixture.launchAction(fix.rawIntention()) } else if (fix is DefaultLintQuickFix) { assertTrue(fix.isApplicable(element, element, context.type)) WriteCommandAction.runWriteCommandAction(project) { fix.apply(element, element, context) } } } assertEquals(expected.trimIndent(), file.text.removePrefix("/*prefix*/")) extraVerify?.invoke() } }
5
null
227
948
10110983c7e784122d94c7467e9d243aba943bf4
14,866
android
Apache License 2.0
src/test/kotlin/tornadofx/tests/TableViewTest.kt
edvin
49,143,977
false
null
package tornadofx.tests import javafx.beans.property.SimpleDoubleProperty import javafx.beans.property.SimpleIntegerProperty import javafx.beans.property.SimpleStringProperty import javafx.collections.FXCollections import javafx.scene.Scene import javafx.scene.layout.StackPane import javafx.stage.Stage import org.junit.Test import org.testfx.api.FxRobot import org.testfx.api.FxToolkit import tornadofx.column import tornadofx.makeIndexColumn import tornadofx.tableview import tornadofx.value import java.nio.file.Paths class TableViewTest { class TestObject(i: Int) { val A = SimpleIntegerProperty(5 * i) val B = SimpleDoubleProperty(3.14159 * i) val C = SimpleStringProperty("Test string $i") } val TestList = FXCollections.observableArrayList(Array(5, { TestObject(it) }).asList()) val primaryStage: Stage = FxToolkit.registerPrimaryStage() @Test fun columnTest() { FxToolkit.setupFixture { val root = StackPane().apply { tableview(TestList) { makeIndexColumn() column("A Column", TestObject::A) column("B Column", Double::class) { value { it.value.B } } column("C Column", TestObject::C) } setPrefSize(400.0, 160.0) } primaryStage.scene = Scene(root) primaryStage.show() } val robot = FxRobot() robot.robotContext().captureSupport.saveImage(robot.capture(primaryStage.scene.root), Paths.get("example-table.png")) } }
196
null
266
3,674
94fd553aced7a2ffe7528b1977a9f8406028432c
1,633
tornadofx
Apache License 2.0
src/main/kotlin/org/sol4k/Transaction.kt
sol4k
595,734,363
false
{"Kotlin": 98172}
package org.sol4k import org.sol4k.Constants.PUBLIC_KEY_LENGTH import org.sol4k.Constants.SIGNATURE_LENGTH import org.sol4k.instruction.BaseInstruction import org.sol4k.instruction.Instruction import java.nio.ByteBuffer import java.util.Base64 class Transaction( private val recentBlockhash: String, private val instructions: List<Instruction>, private val feePayer: PublicKey, ) { constructor( recentBlockhash: String, instruction: Instruction, feePayer: PublicKey, ) : this(recentBlockhash, listOf(instruction), feePayer) private val signatures: MutableList<String> = mutableListOf() fun sign(keypair: Keypair) { val message = transactionMessage() val signature = keypair.sign(message) signatures.add(Base58.encode(signature)) } private fun addSignature(signature: String) { signatures.add(signature) } private fun transactionMessage(): ByteArray { val accountKeys = buildAccountKeys() val transactionAccountPublicKeys = accountKeys.map { it.publicKey } val accountAddressesLength = Binary.encodeLength(accountKeys.size) val instructionBytes = instructions.map { instruction -> val keyIndices = ByteArray(instruction.keys.size) { transactionAccountPublicKeys.indexOf(instruction.keys[it].publicKey).toByte() } byteArrayOf(transactionAccountPublicKeys.indexOf(instruction.programId).toByte()) + Binary.encodeLength(instruction.keys.size) + keyIndices + Binary.encodeLength(instruction.data.size) + instruction.data } val instructionsLength = Binary.encodeLength(instructions.size) val bufferSize = HEADER_LENGTH + RECENT_BLOCK_HASH_LENGTH + accountAddressesLength.size + (accountKeys.size * PUBLIC_KEY_LENGTH) + instructionsLength.size + instructionBytes.sumOf { it.size } val buffer = ByteBuffer.allocate(bufferSize) val numRequiredSignatures = accountKeys.count { it.signer }.toByte() val numReadonlySignedAccounts = accountKeys.count { it.signer && !it.writable }.toByte() val numReadonlyUnsignedAccounts = accountKeys.count { !it.signer && !it.writable }.toByte() buffer.put(byteArrayOf(numRequiredSignatures, numReadonlySignedAccounts, numReadonlyUnsignedAccounts)) buffer.put(accountAddressesLength) accountKeys.forEach { accountMeta -> buffer.put(accountMeta.publicKey.bytes()) } buffer.put(Base58.decode(recentBlockhash)) buffer.put(instructionsLength) instructionBytes.forEach { buffer.put(it) } return buffer.array() } fun serialize(): ByteArray { val signaturesLength = Binary.encodeLength(signatures.size) val message = this.transactionMessage() val buffer = ByteBuffer.allocate( signaturesLength.size + signatures.size * SIGNATURE_LENGTH + message.size, ) buffer.put(signaturesLength) signatures.forEach { signature -> buffer.put(Base58.decode(signature)) } buffer.put(message) return buffer.array() } private fun buildAccountKeys(): List<AccountMeta> { val programIds = instructions .map { it.programId }.toSet() val baseAccountKeys = instructions .asSequence() .flatMap { it.keys } .filter { acc -> acc.publicKey != this.feePayer } .filter { acc -> acc.publicKey !in programIds } .distinctBy { it.publicKey } .sortedWith(compareBy({ it.signer }, { it.signer && !it.writable }, { !it.signer && !it.writable })) .toList() val programIdKeys = programIds .map { AccountMeta(it, writable = false, signer = false) } val feePayerList = listOf(AccountMeta(feePayer, writable = true, signer = true)) return feePayerList + baseAccountKeys + programIdKeys } companion object { private const val HEADER_LENGTH = 3 private const val RECENT_BLOCK_HASH_LENGTH = 32 @JvmStatic fun from(encodedTransaction: String): Transaction { var byteArray = Base64.getDecoder().decode(encodedTransaction) // 1. remove signatures val signaturesDecodedLength = Binary.decodeLength(byteArray) byteArray = signaturesDecodedLength.bytes val signatures = mutableListOf<String>() for (i in 0 until signaturesDecodedLength.length) { val signature = byteArray.slice(0 until SIGNATURE_LENGTH) byteArray = byteArray.drop(SIGNATURE_LENGTH).toByteArray() val encodedSignature = Base58.encode(signature.toByteArray()) val zeroSignature = Base58.encode(ByteArray(SIGNATURE_LENGTH)) if (encodedSignature != zeroSignature) { signatures.add(encodedSignature) } } // 2. decompile Message val numRequiredSignatures = byteArray.first().toInt() byteArray = byteArray.drop(1).toByteArray() val numReadonlySignedAccounts = byteArray.first().toInt() byteArray = byteArray.drop(1).toByteArray() val numReadonlyUnsignedAccounts = byteArray.first().toInt() byteArray = byteArray.drop(1).toByteArray() val accountDecodedLength = Binary.decodeLength(byteArray) byteArray = accountDecodedLength.bytes val accountKeys = mutableListOf<String>() // list of all accounts for (i in 0 until accountDecodedLength.length) { val account = byteArray.slice(0 until PUBLIC_KEY_LENGTH) byteArray = byteArray.drop(PUBLIC_KEY_LENGTH).toByteArray() accountKeys.add(Base58.encode(account.toByteArray())) } val recentBlockhash = byteArray.slice(0 until PUBLIC_KEY_LENGTH).toByteArray() byteArray = byteArray.drop(PUBLIC_KEY_LENGTH).toByteArray() val instructionDecodedLength = Binary.decodeLength(byteArray) byteArray = instructionDecodedLength.bytes val instructions = mutableListOf<Instruction>() for (i in 0 until instructionDecodedLength.length) { val programIdIndex = byteArray.first().toInt() byteArray = byteArray.drop(1).toByteArray() val programId = accountKeys[programIdIndex] val instructionAccountDecodedLength = Binary.decodeLength(byteArray) byteArray = instructionAccountDecodedLength.bytes val accountIndices = byteArray.slice(0 until instructionAccountDecodedLength.length).toByteArray().toList().map(Byte::toInt) byteArray = byteArray.drop(instructionAccountDecodedLength.length).toByteArray() val dataDecodedLength = Binary.decodeLength(byteArray) byteArray = dataDecodedLength.bytes val dataSlice = byteArray.slice(0 until dataDecodedLength.length).toByteArray() byteArray = byteArray.drop(dataDecodedLength.length).toByteArray() instructions.add( BaseInstruction( programId = PublicKey(programId), data = dataSlice, keys = accountIndices.map { accountIdx -> AccountMeta( publicKey = PublicKey(accountKeys[accountIdx]), signer = accountIdx < numRequiredSignatures, writable = accountIdx < numRequiredSignatures - numReadonlySignedAccounts || ( accountIdx >= numRequiredSignatures && accountIdx < accountKeys.count() - numReadonlyUnsignedAccounts ), ) }, ), ) } // 3. construct Transaction if (numRequiredSignatures <= 0) throw Exception("FeePayer does not exist") val tx = Transaction( feePayer = PublicKey(accountKeys[0]), recentBlockhash = Base58.encode(recentBlockhash), instructions = instructions, ) signatures.forEach { signature -> tx.addSignature(signature) } return tx } } }
6
Kotlin
9
53
6f56e80dbfe76d83a4d5d54daa3712e08a0c5ef1
9,002
sol4k
Apache License 2.0
SnailFFmpeg/ffmpeg/src/main/java/com/snail/ffmpeg/transform/MediaTransFormUtil.kt
SnailYue
273,255,269
false
{"C": 1064406, "C++": 98769, "Kotlin": 93761, "CMake": 3052, "Objective-C": 2355}
package com.snail.ffmpeg.transform import com.snail.ffmpeg.constant.MediaForm object MediaTransFormUtil { init { System.loadLibrary("transform") native_init() } fun transformMedia(form: MediaForm, inPath: String, outPath: String) { when (form) { MediaForm.MP4TOAVI -> { native_mp4_to_avi(inPath, outPath) } } } fun screenshotFromStream(url: String, name: String) { native_screenshot_from_stream(url, name) } fun addPictureLogo(video: String, picture: String, output: String) { native_add_logo(video, picture, output); } fun startPlayer(videoUrl: String, surface: Any) { native_start_player(videoUrl, surface) } fun startFilter(videoUrl: String, surface: Any) { native_video_filter(videoUrl, surface) } external fun native_init() external fun native_mp4_to_avi(inPath: String, outPath: String) external fun native_screenshot_from_stream(url: String, outputName: String) external fun native_add_logo(videoUrl: String, pictureUrl: String, outputName: String) external fun native_start_player(videoUrl: String, surface: Any) external fun native_video_filter(videoUrl: String, surface: Any); }
0
C
0
1
0ef45ae7a9f442aca6a757464230f79bd8253a77
1,279
SnailFFmpeg
MIT License
Parameters.kt
SomethingAwry
865,615,045
false
{"Kotlin": 39053, "F#": 17249}
import java.io.* class Parameters private constructor( val iNumHidden: Int, val iNeuronsPerHiddenLayer: Int, val iNumElite: Int, val iNumCopiesElite: Int, val iNumSweepers: Int, val dCrossoverRate: Double, val dMutationRate: Double, val dMaxPerturbation: Double, val iWindowWidth: Int, val iWindowHeight: Int, val iSweeperScale: Int, val dMaxTurnRate: Double, val iSpeedScale: Int, val iNumMines: Int, val dMineScale: Double, val iNumTicks: Int, val iFramesPerSecond: Int ) { companion object { lateinit var parameters: Parameters private val integer: Typed<Int> = "integer" to String::toIntOrNull private val floating: Typed<Double> = "float" to String::toDoubleOrNull private val positive: Passed<Int> = "must be positive" to { it > 0 } private val pos: Passed<Double> = "must be positive" to { it > 0.0 } private val nonNegative: Passed<Int> = "must not be negative" to { it >= 0 } private val nonNeg: Passed<Double> = "must not be negative" to { it >= 0.0 } private val inZeroOne: Passed<Double> = "must be between (inclusive): zero and one" to { it in 0.0..1.0 } fun loadInParameters(inputStream: InputStream) { val settings = inputStream.bufferedReader().readLines().mapNotNull { line -> val splitBySpace = line.trim().split(' ') if (splitBySpace.size == 2) Pair(splitBySpace[0], splitBySpace[1]) else null }.toMap() fun <T> String.checkFor(t: Typed<T>, p: Passed<T>): T { val unparsed = requireNotNull(settings[this]) { "$this: not found" } val untested = requireNotNull(t.second(unparsed)) { "$this: could not be parsed to ${t.first}" } require(p.second(untested)) { "$this: ${p.first}" } return untested } val noHidden: Boolean val elites: Int val copies: Int parameters = Parameters( // NeuralNet parameters --------------------------------------------------------- // are there any extra (hidden) layers? "iNumHidden".checkFor(integer, nonNegative).also { noHidden = it == 0 }, // and if so, how many neurons do each of those have? "iNeuronsPerHiddenLayer".checkFor(integer, "must be positive if any hidden" to { noHidden || it > 0 }), // Genetic Algorithm parameters --------------------------------------------------------- // the number of fittest members that move on to the next generation unchanged. "iNumElite".checkFor(integer, nonNegative).also { elites = it }, // how many copies of each elite are part of the next generation. "iNumCopiesElite".checkFor(integer, positive).also { copies = it }, // population size (needs to be an even number after removing any copied elites from above) "iNumSweepers".checkFor(integer, "must be bigger than elites*copies by an even number" to { val rm = it - elites * copies; rm >= 2 && rm % 2 == 0 }), // of the genetic pairings made, what rate (1.0 = 100%) actually produce children with // mixed genes (i.e. weights in the neural nets) from parents "dCrossoverRate".checkFor(floating, inZeroOne), // per child-gene, what chance (1.0 = 100%) is there of it changing from inherited ... "dMutationRate".checkFor(floating, inZeroOne), // ... and by how much "dMaxPerturbation".checkFor(floating, nonNeg), // Testing Ground parameters --------------------------------------------------------- // size of testing ground "iWindowWidth".checkFor(integer, positive), "iWindowHeight".checkFor(integer, positive), // size of a sweeper within testing ground "iSweeperScale".checkFor(integer, positive), // at most, how fast can it turn "dMaxTurnRate".checkFor(floating, pos), // helpful if testing ground gets bigger "iSpeedScale".checkFor(integer, positive), // the mines to be swept "iNumMines".checkFor(integer, positive), // how big they are "dMineScale".checkFor(floating, pos), // more significant than for just animation, the product of these two numbers is how // many "moves" a sweeper gets per generation to get to and sweep mines "iNumTicks".checkFor(integer, positive), // is actually seconds, not 'ticks' "iFramesPerSecond".checkFor(integer, positive) ) } } } typealias Typed<T> = Pair<String, (String) -> T?> typealias Passed<T> = Pair<String, (T) -> Boolean>
0
Kotlin
0
0
53f33c59f8fa5700dc48472971cbc5decd8ed832
5,062
BattleCity
Apache License 2.0
src/commonTest/kotlin/com/gw2tb/gw2chatlinks/ChatLinkTests.kt
GW2ToolBelt
378,287,871
false
null
/* * Copyright (c) 2021-2022 <NAME> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @file:OptIn(ExperimentalChatLinks::class) package com.gw2tb.gw2chatlinks import kotlin.test.* @ExperimentalUnsignedTypes class ChatLinkTests { private fun <T> assertDoesNotThrow(block: () -> T): T { try { return block() } catch (t: Throwable) { fail(message = "Caught unexpected throwable", cause = t) } } private fun <T> assertDoesNotThrow(result: Result<T>): T = assertDoesNotThrow { result.getOrThrow() } @Test fun testDecodeCoinLink() { assertEquals(ChatLink.Coin(amount = 10203u), assertDoesNotThrow(decodeChatLink("[&AdsnAAA=]"))) } @Test fun testEncodeCoinLink() { assertEquals("[&AdsnAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Coin(amount = 10203u)))) } @Test fun testDecodeItemLink() { val itemID = 46762u val skinID = 3709u val sigil1ID = 24575u val sigil2ID = 24615u assertEquals(ChatLink.Item(amount = 1u, itemID = itemID), assertDoesNotThrow(decodeChatLink("[&AgGqtgAA]"))) assertEquals(ChatLink.Item(amount = 1u, itemID = itemID, firstUpgradeSlot = sigil1ID), assertDoesNotThrow(decodeChatLink("[&AgGqtgBA/18AAA==]"))) assertEquals(ChatLink.Item(amount = 1u, itemID = itemID, firstUpgradeSlot = sigil1ID, secondUpgradeSlot = sigil2ID), assertDoesNotThrow(decodeChatLink("[&AgGqtgBg/18AACdgAAA=]"))) assertEquals(ChatLink.Item(amount = 1u, itemID = itemID, skinID = skinID), assertDoesNotThrow(decodeChatLink("[&AgGqtgCAfQ4AAA==]"))) assertEquals(ChatLink.Item(amount = 1u, itemID = itemID, skinID = skinID, firstUpgradeSlot = sigil1ID), assertDoesNotThrow(decodeChatLink("[&AgGqtgDAfQ4AAP9fAAA=]"))) assertEquals(ChatLink.Item(amount = 1u, itemID = itemID, skinID = skinID, firstUpgradeSlot = sigil1ID, secondUpgradeSlot = sigil2ID), assertDoesNotThrow(decodeChatLink("[&AgGqtgDgfQ4AAP9fAAAnYAAA]"))) } @Test fun testEncodeItemLink() { val itemID = 46762u val skinID = 3709u val sigil1ID = 24575u val sigil2ID = 24615u assertEquals("[&AgGqtgAA]", assertDoesNotThrow(encodeChatLink(ChatLink.Item(amount = 1u, itemID = itemID)))) assertEquals("[&AgGqtgBA/18AAA==]", assertDoesNotThrow(encodeChatLink(ChatLink.Item(amount = 1u, itemID = itemID, firstUpgradeSlot = sigil1ID)))) assertEquals("[&AgGqtgBg/18AACdgAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Item(amount = 1u, itemID = itemID, firstUpgradeSlot = sigil1ID, secondUpgradeSlot = sigil2ID)))) assertEquals("[&AgGqtgCAfQ4AAA==]", assertDoesNotThrow(encodeChatLink(ChatLink.Item(amount = 1u, itemID = itemID, skinID = skinID)))) assertEquals("[&AgGqtgDAfQ4AAP9fAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Item(amount = 1u, itemID = itemID, skinID = skinID, firstUpgradeSlot = sigil1ID)))) assertEquals("[&AgGqtgDgfQ4AAP9fAAAnYAAA]", assertDoesNotThrow(encodeChatLink(ChatLink.Item(amount = 1u, itemID = itemID, skinID = skinID, firstUpgradeSlot = sigil1ID, secondUpgradeSlot = sigil2ID)))) } @Test fun testDecodeNPCTextLink() { assertEquals(ChatLink.NPCText(textID = 10007u), assertDoesNotThrow(decodeChatLink("[&AxcnAAA=]"))) assertEquals(ChatLink.NPCText(textID = 10008u), assertDoesNotThrow(decodeChatLink("[&AxgnAAA=]"))) assertEquals(ChatLink.NPCText(textID = 10009u), assertDoesNotThrow(decodeChatLink("[&AxknAAA=]"))) assertEquals(ChatLink.NPCText(textID = 10016u), assertDoesNotThrow(decodeChatLink("[&AyAnAAA=]"))) } @Test fun testEncodeNPCTextLink() { assertEquals("[&AxcnAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.NPCText(textID = 10007u)))) assertEquals("[&AxgnAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.NPCText(textID = 10008u)))) assertEquals("[&AxknAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.NPCText(textID = 10009u)))) assertEquals("[&AyAnAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.NPCText(textID = 10016u)))) } @Test fun testDecodePoILink() { assertEquals(ChatLink.PoI(poiID = 56u), assertDoesNotThrow(decodeChatLink("[&BDgAAAA=]"))) assertEquals(ChatLink.PoI(poiID = 72u), assertDoesNotThrow(decodeChatLink("[&BEgAAAA=]"))) assertEquals(ChatLink.PoI(poiID = 825u), assertDoesNotThrow(decodeChatLink("[&BDkDAAA=]"))) } @Test fun testEncodePoILink() { assertEquals("[&BDgAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.PoI(poiID = 56u)))) assertEquals("[&BEgAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.PoI(poiID = 72u)))) assertEquals("[&BDkDAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.PoI(poiID = 825u)))) } @Test fun testEncodePvPGameLink() { assertFailsWith(EncodingUnsupportedException::class) { encodeChatLink(ChatLink.PvPGame).getOrThrow() } } @Test fun testDecodeSkillLink() { assertEquals(ChatLink.Skill(skillID = 743u), assertDoesNotThrow(decodeChatLink("[&BucCAAA=]"))) assertEquals(ChatLink.Skill(skillID = 5491u), assertDoesNotThrow(decodeChatLink("[&BnMVAAA=]"))) assertEquals(ChatLink.Skill(skillID = 5501u), assertDoesNotThrow(decodeChatLink("[&Bn0VAAA=]"))) } @Test fun testEncodeSkillLink() { assertEquals("[&BucCAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Skill(skillID = 743u)))) assertEquals("[&BnMVAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Skill(skillID = 5491u)))) assertEquals("[&Bn0VAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Skill(skillID = 5501u)))) } @Test fun testDecodeTraitLink() { assertEquals(ChatLink.Trait(traitID = 646u), assertDoesNotThrow(decodeChatLink("[&B4YCAAA=]"))) } @Test fun testEncodeTraitLink() { assertEquals("[&B4YCAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Trait(traitID = 646u)))) } @Test fun testDecodeUserLink() { val accountGUID = ubyteArrayOf(0x1u, 0x02u, 0x03u, 0x04u, 0x05u, 0x06u, 0x07u, 0x08u, 0x09u, 0x0Au, 0x0Bu, 0x0Cu, 0x0Du, 0x0Eu, 0x0Fu, 0x10u) val characterName = ubyteArrayOf(0x45u, 0x0u, 0x61u, 0x0u, 0x73u, 0x0u, 0x74u, 0x0u, 0x65u, 0x0u, 0x72u, 0x0u) assertEquals(ChatLink.User(accountGUID = accountGUID, characterName = characterName), assertDoesNotThrow(decodeChatLink("[&CAECAwQFBgcICQoLDA0ODxBFAGEAcwB0AGUAcgAAAA==]"))) } @Test fun testEncodeUserLink() { val accountGUID = ubyteArrayOf(0x1u, 0x02u, 0x03u, 0x04u, 0x05u, 0x06u, 0x07u, 0x08u, 0x09u, 0x0Au, 0x0Bu, 0x0Cu, 0x0Du, 0x0Eu, 0x0Fu, 0x10u) val characterName = ubyteArrayOf(0x45u, 0x0u, 0x61u, 0x0u, 0x73u, 0x0u, 0x74u, 0x0u, 0x65u, 0x0u, 0x72u, 0x0u) assertEquals("[&CAECAwQFBgcICQoLDA0ODxBFAGEAcwB0AGUAcgAAAA==]", assertDoesNotThrow(encodeChatLink(ChatLink.User(accountGUID = accountGUID, characterName = characterName)))) } @Test fun testDecodeRecipeLink() { assertEquals(ChatLink.Recipe(recipeID = 1u), assertDoesNotThrow(decodeChatLink("[&CQEAAAA=]"))) assertEquals(ChatLink.Recipe(recipeID = 2u), assertDoesNotThrow(decodeChatLink("[&CQIAAAA=]"))) assertEquals(ChatLink.Recipe(recipeID = 7u), assertDoesNotThrow(decodeChatLink("[&CQcAAAA=]"))) } @Test fun testEncodeRecipeLink() { assertEquals("[&CQEAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Recipe(recipeID = 1u)))) assertEquals("[&CQIAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Recipe(recipeID = 2u)))) assertEquals("[&CQcAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Recipe(recipeID = 7u)))) } @Test fun testDecodeSkinLink() { assertEquals(ChatLink.Skin(skinID = 4u), assertDoesNotThrow(decodeChatLink("[&CgQAAAA=]"))) } @Test fun testEncodeSkinLink() { assertEquals("[&CgQAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Skin(skinID = 4u)))) } @Test fun testDecodeOutfitLink() { assertEquals(ChatLink.Outfit(outfitID = 4u), assertDoesNotThrow(decodeChatLink("[&CwQAAAA=]"))) } @Test fun testEncodeOutfitLink() { assertEquals("[&CwQAAAA=]", assertDoesNotThrow(encodeChatLink(ChatLink.Outfit(outfitID = 4u)))) } @Test fun testDecodeWvWObjectiveLink() { assertEquals(ChatLink.WvWObjective(objectiveID = 6u, mapID = 38u), assertDoesNotThrow(decodeChatLink("[&DAYAAAAmAAAA]"))) } @Test fun testEncodeWvWObjectiveLink() { assertEquals("[&DAYAAAAmAAAA]", assertDoesNotThrow(encodeChatLink(ChatLink.WvWObjective(objectiveID = 6u, mapID = 38u)))) } @Test fun testWvWObjectiveLinkApiID() { assertEquals("38-6", ChatLink.WvWObjective(objectiveID = 6u, mapID = 38u).apiID) } @Test fun testDecodeBuildTemplate() { val buildTemplate = ChatLink.BuildTemplate( professionID = Profession.GUARDIAN.paletteID, specializations = listOf( ChatLink.BuildTemplate.Specialization(specializationID = 16u, majorTraits = listOf(2u, 2u, 1u)), ChatLink.BuildTemplate.Specialization(specializationID = 42u, majorTraits = listOf(1u, 1u, 2u)), ChatLink.BuildTemplate.Specialization(specializationID = 27u, majorTraits = listOf(0u, 1u, 2u)) ), skills = listOf(3878u, 4746u, 328u, 254u, 4789u), aquaticSkills = listOf(3878u, 310u, 328u, 254u, 4745u), professionContext = null ) val rangerBuildTemplate = ChatLink.BuildTemplate( professionID = Profession.RANGER.paletteID, specializations = listOf( ChatLink.BuildTemplate.Specialization(specializationID = 8u, majorTraits = listOf(1u, 1u, 0u)), ChatLink.BuildTemplate.Specialization(specializationID = 32u, majorTraits = listOf(2u, 2u, 2u)), ChatLink.BuildTemplate.Specialization(specializationID = 55u, majorTraits = listOf(1u, 1u, 1u)) ), skills = listOf(121u, 421u, 181u, 188u, 5678u), aquaticSkills = listOf(5934u, 421u, 188u, 428u, 5678u), professionContext = ChatLink.BuildTemplate.RangerContext( pets = listOf(59u, 46u), aquaticPets = listOf(21u, 47u) ) ) val revenantBuildTemplate = ChatLink.BuildTemplate( professionID = Profession.REVENANT.paletteID, specializations = listOf( ChatLink.BuildTemplate.Specialization(specializationID = 3u, majorTraits = listOf(1u, 0u, 1u)), ChatLink.BuildTemplate.Specialization(specializationID = 15u, majorTraits = listOf(1u, 0u, 1u)), ChatLink.BuildTemplate.Specialization(specializationID = 63u, majorTraits = listOf(0u, 2u, 2u)) ), skills = listOf(4572u, 4564u, 4651u, 4614u, 4554u), aquaticSkills = listOf(4572u, 4564u, 4651u, 4614u, 4554u), professionContext = ChatLink.BuildTemplate.RevenantContext( legends = listOf(5u, 2u), aquaticLegends = listOf(2u, 3u), inactiveLegendUtilitySkills = listOf(4564u, 4651u, 4614u), inactiveAquaticLegendUtilitySkills = listOf(4614u, 4564u, 4651u) ) ) assertEquals(buildTemplate, assertDoesNotThrow(decodeChatLink("[&DQEQLyo6GzkmDyYPihI2AUgBSAH+AP4AtRKJEgAAAAAAAAAAAAAAAAAAAAA=]"))) assertEquals(rangerBuildTemplate, assertDoesNotThrow(decodeChatLink("[&DQQIGiA/Nyp5AC4XpQGlAbUAvAC8AKwBLhYuFjsuFS8AAAAAAAAAAAAAAAA=]"))) assertEquals(revenantBuildTemplate, assertDoesNotThrow(decodeChatLink("[&DQkDJg8mPz3cEdwR1BHUESsSKxIGEgYSyhHKEQUCAgPUESsSBhIGEtQRKxI=]"))) } @Test fun testEncodeBuildTemplate() { val buildTemplate = ChatLink.BuildTemplate( professionID = Profession.GUARDIAN.paletteID, specializations = listOf( ChatLink.BuildTemplate.Specialization(specializationID = 16u, majorTraits = listOf(2u, 2u, 1u)), ChatLink.BuildTemplate.Specialization(specializationID = 42u, majorTraits = listOf(1u, 1u, 2u)), ChatLink.BuildTemplate.Specialization(specializationID = 27u, majorTraits = listOf(0u, 1u, 2u)) ), skills = listOf(3878u, 4746u, 328u, 254u, 4789u), aquaticSkills = listOf(3878u, 310u, 328u, 254u, 4745u), professionContext = null ) val rangerBuildTemplate = ChatLink.BuildTemplate( professionID = Profession.RANGER.paletteID, specializations = listOf( ChatLink.BuildTemplate.Specialization(specializationID = 8u, majorTraits = listOf(1u, 1u, 0u)), ChatLink.BuildTemplate.Specialization(specializationID = 32u, majorTraits = listOf(2u, 2u, 2u)), ChatLink.BuildTemplate.Specialization(specializationID = 55u, majorTraits = listOf(1u, 1u, 1u)) ), skills = listOf(121u, 421u, 181u, 188u, 5678u), aquaticSkills = listOf(5934u, 421u, 188u, 428u, 5678u), professionContext = ChatLink.BuildTemplate.RangerContext( pets = listOf(59u, 46u), aquaticPets = listOf(21u, 47u) ) ) val revenantBuildTemplate = ChatLink.BuildTemplate( professionID = Profession.REVENANT.paletteID, specializations = listOf( ChatLink.BuildTemplate.Specialization(specializationID = 3u, majorTraits = listOf(1u, 0u, 1u)), ChatLink.BuildTemplate.Specialization(specializationID = 15u, majorTraits = listOf(1u, 0u, 1u)), ChatLink.BuildTemplate.Specialization(specializationID = 63u, majorTraits = listOf(0u, 2u, 2u)) ), skills = listOf(4572u, 4564u, 4651u, 4614u, 4554u), aquaticSkills = listOf(4572u, 4564u, 4651u, 4614u, 4554u), professionContext = ChatLink.BuildTemplate.RevenantContext( legends = listOf(5u, 2u), aquaticLegends = listOf(2u, 3u), inactiveLegendUtilitySkills = listOf(4564u, 4651u, 4614u), inactiveAquaticLegendUtilitySkills = listOf(4614u, 4564u, 4651u) ) ) assertEquals("[&DQEQLyo6GzkmDyYPihI2AUgBSAH+AP4AtRKJEgAAAAAAAAAAAAAAAAAAAAA=]", assertDoesNotThrow(encodeChatLink(buildTemplate))) assertEquals("[&DQQIGiA/Nyp5AC4XpQGlAbUAvAC8AKwBLhYuFjsuFS8AAAAAAAAAAAAAAAA=]", assertDoesNotThrow(encodeChatLink(rangerBuildTemplate))) assertEquals("[&DQkDJg8mPz3cEdwR1BHUESsSKxIGEgYSyhHKEQUCAgPUESsSBhIGEtQRKxI=]", assertDoesNotThrow(encodeChatLink(revenantBuildTemplate))) } }
3
null
1
2
c83d438c08fc5da7ceb9f59ef19c29718320752c
15,810
GW2ChatLinks
MIT License
base-domain/src/test/kotlin/org/ossiaustria/lib/domain/repositories/SettingsRepositoryTest.kt
ossi-austria
430,606,582
false
{"Kotlin": 456155, "HTML": 2066, "Dockerfile": 441}
package org.ossiaustria.lib.domain.repositories import androidx.security.crypto.EncryptedSharedPreferences import androidx.security.crypto.MasterKeys import androidx.test.platform.app.InstrumentationRegistry import org.junit.Assert.assertEquals import org.junit.Assert.assertNotEquals import org.junit.Assert.assertNotNull import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.ossiaustria.lib.domain.FakeAndroidKeyStore import org.ossiaustria.lib.domain.auth.Account import org.ossiaustria.lib.domain.auth.TokenResult import org.ossiaustria.lib.domain.repositories.SettingsRepository.Companion.KEY_ACCESS_TOKEN import org.ossiaustria.lib.domain.repositories.SettingsRepository.Companion.KEY_ACCOUNT import org.ossiaustria.lib.domain.repositories.SettingsRepository.Companion.KEY_REFRESH_TOKEN import org.robolectric.RobolectricTestRunner import java.util.* import java.util.UUID.randomUUID @RunWith(RobolectricTestRunner::class) internal class SettingsRepositoryTest() { lateinit var subject: SettingsRepositoryImpl @Before fun before() { val context = InstrumentationRegistry.getInstrumentation().targetContext FakeAndroidKeyStore.setup val cryptPrefs = EncryptedSharedPreferences.create( SettingsRepository.SETTINGS_AMIGO_CRYPTED, MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC), context, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM ) subject = SettingsRepositoryImpl(context, cryptPrefs) } // IMPORTANT: Can fail on windows! @Test fun `should write and read TokenResult accessToken from crypted store`() { val tokenResult = TokenResult("token", "subject", Date(), Date(), "issuer") subject.accessToken = tokenResult val result = subject.accessToken assertNotNull(result) assertEquals(tokenResult.token, result!!.token) assertEquals(tokenResult.subject, result.subject) assertEquals(tokenResult.issuer, result.issuer) assertEquals("NONE", subject.sharedPreferences.getString(KEY_ACCESS_TOKEN, "NONE")) assertNotEquals("NONE", subject.cryptedPreferences.getString(KEY_ACCESS_TOKEN, "NONE")) } // IMPORTANT: Can fail on windows! @Test fun `should write and read TokenResult refreshToken from crypted store`() { val tokenResult = TokenResult("token", "subject", Date(), Date(), "issuer") subject.refreshToken = tokenResult val result = subject.refreshToken assertNotNull(result) assertEquals(tokenResult.token, result!!.token) assertEquals(tokenResult.subject, result.subject) assertEquals(tokenResult.issuer, result.issuer) assertEquals("NONE", subject.sharedPreferences.getString(KEY_REFRESH_TOKEN, "NONE")) assertNotEquals("NONE", subject.cryptedPreferences.getString(KEY_REFRESH_TOKEN, "NONE")) } // IMPORTANT: Can fail on windows! @Test fun `should write and read Account from crypted store`() { val account = Account(randomUUID(), "<EMAIL>", "", Date()) subject.account = account val result = subject.account assertNotNull(result) assertEquals(account.id, result!!.id) assertEquals(account.email, result.email) assertEquals("NONE", subject.sharedPreferences.getString(KEY_ACCOUNT, "NONE")) assertNotEquals("NONE", subject.cryptedPreferences.getString(KEY_ACCOUNT, "NONE")) } }
0
Kotlin
0
1
8d8b167555d62e6ceb58a20efe9d6ee0c609b199
3,586
amigo-box
MIT License
shared/src/commonMain/kotlin/demo/database/NoteEntity.kt
bettercalltolya
647,835,073
false
{"Kotlin": 48539, "Swift": 1970, "Shell": 228, "Ruby": 101}
package demo.database import com.arkivanov.essenty.parcelable.Parcelable import com.arkivanov.essenty.parcelable.Parcelize import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmUUID import io.realm.kotlin.types.annotations.PrimaryKey @Parcelize class NoteEntity private constructor(): RealmObject, Parcelable { @PrimaryKey var id: String = "" var title: String = "" var body: String = "" companion object { fun create( title: String, body: String ): NoteEntity { return NoteEntity().apply { this.id = RealmUUID.random().toString() this.title = title this.body = body } } } }
0
Kotlin
0
2
0d9b008e0bcffb0172875d25cef478fb0356b7d4
743
ComposeMultiplatformDemo
Apache License 2.0
app/src/main/java/com/mostafahelal/AtmoDrive/auth/data/model/modelresponse/OldUser.kt
mostafa399
670,688,724
false
{"Kotlin": 173866}
package com.mostafahelal.AtmoDrive.auth.data.model.modelresponse import com.google.gson.annotations.SerializedName import com.mostafahelal.AtmoDrive.auth.domain.model.CheckData import com.mostafahelal.AtmoDrive.auth.domain.model.UserData data class OldUser( @SerializedName("is_new") val isNew: Boolean, @SerializedName("user") val user: User? ){ public fun isDomain():CheckData=CheckData( isNew,user?.asDomain()) }
0
Kotlin
0
0
6bab70a76af1f1bbd0ee714c390324512fc3570f
438
AtmoDrive
MIT License
src/main/kotlin/com/saehyun/smonkey/domain/friend/exception/error/FriendErrorCode.kt
hackersground-kr
656,532,644
false
null
package com.saehyun.smonkey.domain.friend.exception.error import com.saehyun.smonkey.global.exception.error.ErrorResponse enum class FriendErrorCode( override val message: String, override val status: Int, ) : ErrorResponse { /** * 이미 친구이거나 신청을 보냈을 경우 */ FRIEND_ALREADY_EXIST( message = "friend already exist or you've sent a request", status = 409, ), /** * 친구를 찾을 수 없음 */ FRIEND_NOT_FOUND( message = "friend not found", status = 404, ), /** * 나를 친구로 추가할 수 없음 */ CAN_NOT_ADD_ME_FRIEND( message = "can not add me friend", status = 400, ), }
3
Kotlin
3
3
e6538ddb129b05a76c85171af7a2261989306510
668
smonkey
MIT License
cmpe/common/src/commonMain/kotlin/xyz/mcxross/cohesive/ui/impl/view/md/markup/StyledText.kt
mcxross
514,846,313
false
null
package xyz.mcxross.cohesive.ui.impl.view.md.markup import androidx.compose.foundation.layout.padding import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.ExperimentalUnitApi import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.dp import xyz.mcxross.cohesive.model.MarkdownKeysManager @OptIn(ExperimentalUnitApi::class) @Composable fun MKStyledText( text: String, layer: String, textSize: Float? = null, color: Color, ) { Text( color = color, text = text, modifier = Modifier.padding(5.dp), fontSize = TextUnit(textSize ?: getFontSize(layer), TextUnitType.Sp), ) } fun getFontSize(layer: String): Float { return when (layer) { MarkdownKeysManager.TEXT_HASH -> 17f MarkdownKeysManager.TEXT_HASH_2 -> 15f MarkdownKeysManager.TEXT_HASH_3 -> 13f MarkdownKeysManager.TEXT_HASH_4 -> 11f MarkdownKeysManager.TEXT_HASH_5 -> 9f MarkdownKeysManager.TEXT_HASH_6 -> 7f else -> 17f } } /** h1, h2, h3, h4, h5, h6 */ data class MarkdownStyledTextComponent( val text: String, val layer: String, ) : Element
0
Kotlin
0
3
be630e050c060bc5155e7ef7a65e3bc909ec58d6
1,263
cohesive
Apache License 2.0
compiler/testData/codegen/box/ieee754/smartCastToDoubleAndComparableToDouble.kt
danysantiago
224,251,838
true
{"Kotlin": 42226766, "Java": 7631507, "JavaScript": 197284, "HTML": 75183, "Lex": 23805, "TypeScript": 20278, "IDL": 11643, "CSS": 8804, "Shell": 7220, "Groovy": 6940, "Batchfile": 5362, "Swift": 2253, "Ruby": 668, "Objective-C": 293, "Scala": 80}
// !LANGUAGE: +ProperIeee754Comparisons // IGNORE_BACKEND_FIR: JVM_IR val minus: Any = -0.0 fun box(): String { if (minus is Comparable<*> && minus is Double) { if (minus < 0.0) return "fail 0" if ((minus) != 0.0) return "fail 1" if (minus != 0.0) return "fail 2" if (minus != 0.0F) return "fail 3" } return "OK" }
0
null
0
1
3d1061ee3cb5a888e9d77e407c73070f461de52a
360
kotlin
Apache License 2.0
compiler/testData/codegen/box/arrays/primitiveArrays.kt
JakeWharton
99,388,807
false
null
// WITH_RUNTIME import kotlin.test.* fun box(): String { assertTrue(eqBoolean(booleanArrayOf(false), BooleanArray(1))) assertTrue(eqBoolean(booleanArrayOf(false, true, false), BooleanArray(3) { it % 2 != 0 })) assertTrue(eqBoolean(booleanArrayOf(true), booleanArrayOf(true).copyOf())) assertTrue(eqBoolean(booleanArrayOf(true, false), booleanArrayOf(true).copyOf(2))) assertTrue(eqBoolean(booleanArrayOf(true), booleanArrayOf(true, true).copyOf(1))) assertTrue(eqBoolean(booleanArrayOf(false, true), booleanArrayOf(false) + true)) assertTrue(eqBoolean(booleanArrayOf(false, true, false), booleanArrayOf(false) + listOf(true, false))) assertTrue(eqBoolean(booleanArrayOf(true, false), booleanArrayOf(false, true, false, true).copyOfRange(1, 3))) assertTrue(eqBoolean(booleanArrayOf(false, true, false, true), customBooleanArrayOf(false, *booleanArrayOf(true, false), true))) assertTrue(booleanArrayOf(true).iterator() is BooleanIterator) assertEquals(true, booleanArrayOf(true).iterator().nextBoolean()) assertEquals(true, booleanArrayOf(true).iterator().next()) assertFalse(booleanArrayOf().iterator().hasNext()) assertTrue(assertFails { booleanArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqByte(byteArrayOf(0), ByteArray(1))) assertTrue(eqByte(byteArrayOf(1, 2, 3), ByteArray(3) { (it + 1).toByte() })) assertTrue(eqByte(byteArrayOf(1), byteArrayOf(1).copyOf())) assertTrue(eqByte(byteArrayOf(1, 0), byteArrayOf(1).copyOf(2))) assertTrue(eqByte(byteArrayOf(1), byteArrayOf(1, 2).copyOf(1))) assertTrue(eqByte(byteArrayOf(1, 2), byteArrayOf(1) + 2)) assertTrue(eqByte(byteArrayOf(1, 2, 3), byteArrayOf(1) + listOf(2.toByte(), 3.toByte()))) assertTrue(eqByte(byteArrayOf(2, 3), byteArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) assertTrue(eqByte(byteArrayOf(1, 2, 3, 4), customByteArrayOf(1.toByte(), *byteArrayOf(2, 3), 4.toByte()))) assertTrue(byteArrayOf(1).iterator() is ByteIterator) assertEquals(1, byteArrayOf(1).iterator().nextByte()) assertEquals(1, byteArrayOf(1).iterator().next()) assertFalse(byteArrayOf().iterator().hasNext()) assertTrue(assertFails { byteArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqShort(shortArrayOf(0), ShortArray(1))) assertTrue(eqShort(shortArrayOf(1, 2, 3), ShortArray(3) { (it + 1).toShort() })) assertTrue(eqShort(shortArrayOf(1), shortArrayOf(1).copyOf())) assertTrue(eqShort(shortArrayOf(1, 0), shortArrayOf(1).copyOf(2))) assertTrue(eqShort(shortArrayOf(1), shortArrayOf(1, 2).copyOf(1))) assertTrue(eqShort(shortArrayOf(1, 2), shortArrayOf(1) + 2)) assertTrue(eqShort(shortArrayOf(1, 2, 3), shortArrayOf(1) + listOf(2.toShort(), 3.toShort()))) assertTrue(eqShort(shortArrayOf(2, 3), shortArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) assertTrue(eqShort(shortArrayOf(1, 2, 3, 4), customShortArrayOf(1.toShort(), *shortArrayOf(2, 3), 4.toShort()))) assertTrue(shortArrayOf(1).iterator() is ShortIterator) assertEquals(1, shortArrayOf(1).iterator().nextShort()) assertEquals(1, shortArrayOf(1).iterator().next()) assertFalse(shortArrayOf().iterator().hasNext()) assertTrue(assertFails { shortArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqChar(charArrayOf(0.toChar()), CharArray(1))) assertTrue(eqChar(charArrayOf('a', 'b', 'c'), CharArray(3) { 'a' + it })) assertTrue(eqChar(charArrayOf('a'), charArrayOf('a').copyOf())) assertTrue(eqChar(charArrayOf('a', 0.toChar()), charArrayOf('a').copyOf(2))) assertTrue(eqChar(charArrayOf('a'), charArrayOf('a', 'b').copyOf(1))) assertTrue(eqChar(charArrayOf('a', 'b'), charArrayOf('a') + 'b')) assertTrue(eqChar(charArrayOf('a', 'b', 'c'), charArrayOf('a') + listOf('b', 'c'))) assertTrue(eqChar(charArrayOf('b', 'c'), charArrayOf('a', 'b', 'c', 'd').copyOfRange(1, 3))) assertTrue(eqChar(charArrayOf('a', 'b', 'c', 'd'), customCharArrayOf('a', *charArrayOf('b', 'c'), 'd'))) assertTrue(charArrayOf('a').iterator() is CharIterator) assertEquals('a', charArrayOf('a').iterator().nextChar()) assertEquals('a', charArrayOf('a').iterator().next()) assertFalse(charArrayOf().iterator().hasNext()) assertTrue(assertFails { charArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqInt(intArrayOf(0), IntArray(1))) assertTrue(eqInt(intArrayOf(1, 2, 3), IntArray(3) { it + 1 })) assertTrue(eqInt(intArrayOf(1), intArrayOf(1).copyOf())) assertTrue(eqInt(intArrayOf(1, 0), intArrayOf(1).copyOf(2))) assertTrue(eqInt(intArrayOf(1), intArrayOf(1, 2).copyOf(1))) assertTrue(eqInt(intArrayOf(1, 2), intArrayOf(1) + 2)) assertTrue(eqInt(intArrayOf(1, 2, 3), intArrayOf(1) + listOf(2, 3))) assertTrue(eqInt(intArrayOf(2, 3), intArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) assertTrue(eqInt(intArrayOf(1, 2, 3, 4), customIntArrayOf(1, *intArrayOf(2, 3), 4))) assertTrue(intArrayOf(1).iterator() is IntIterator) assertEquals(1, intArrayOf(1).iterator().nextInt()) assertEquals(1, intArrayOf(1).iterator().next()) assertFalse(intArrayOf().iterator().hasNext()) assertTrue(assertFails { intArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqFloat(floatArrayOf(0f), FloatArray(1))) assertTrue(eqFloat(floatArrayOf(1f, 2f, 3f), FloatArray(3) { (it + 1).toFloat() })) assertTrue(eqFloat(floatArrayOf(1f), floatArrayOf(1f).copyOf())) assertTrue(eqFloat(floatArrayOf(1f, 0f), floatArrayOf(1f).copyOf(2))) assertTrue(eqFloat(floatArrayOf(1f), floatArrayOf(1f, 2f).copyOf(1))) assertTrue(eqFloat(floatArrayOf(1f, 2f), floatArrayOf(1f) + 2f)) assertTrue(eqFloat(floatArrayOf(1f, 2f, 3f), floatArrayOf(1f) + listOf(2f, 3f))) assertTrue(eqFloat(floatArrayOf(2f, 3f), floatArrayOf(1f, 2f, 3f, 4f).copyOfRange(1, 3))) assertTrue(eqFloat(floatArrayOf(1f, 2f, 3f, 4f), customFloatArrayOf(1f, *floatArrayOf(2f, 3f), 4f))) assertTrue(floatArrayOf(1f).iterator() is FloatIterator) assertEquals(1f, floatArrayOf(1f).iterator().nextFloat()) assertEquals(1f, floatArrayOf(1f).iterator().next()) assertFalse(floatArrayOf().iterator().hasNext()) assertTrue(assertFails { floatArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqDouble(doubleArrayOf(0.0), DoubleArray(1))) assertTrue(eqDouble(doubleArrayOf(1.0, 2.0, 3.0), DoubleArray(3) { (it + 1).toDouble() })) assertTrue(eqDouble(doubleArrayOf(1.0), doubleArrayOf(1.0).copyOf())) assertTrue(eqDouble(doubleArrayOf(1.0, 0.0), doubleArrayOf(1.0).copyOf(2))) assertTrue(eqDouble(doubleArrayOf(1.0), doubleArrayOf(1.0, 2.0).copyOf(1))) assertTrue(eqDouble(doubleArrayOf(1.0, 2.0), doubleArrayOf(1.0) + 2.0)) assertTrue(eqDouble(doubleArrayOf(1.0, 2.0, 3.0), doubleArrayOf(1.0) + listOf(2.0, 3.0))) assertTrue(eqDouble(doubleArrayOf(2.0, 3.0), doubleArrayOf(1.0, 2.0, 3.0, 4.0).copyOfRange(1, 3))) assertTrue(eqDouble(doubleArrayOf(1.0, 2.0, 3.0, 4.0), customDoubleArrayOf(1.0, *doubleArrayOf(2.0, 3.0), 4.0))) assertTrue(doubleArrayOf(1.0).iterator() is DoubleIterator) assertEquals(1.0, doubleArrayOf(1.0).iterator().nextDouble()) assertEquals(1.0, doubleArrayOf(1.0).iterator().next()) assertFalse(doubleArrayOf().iterator().hasNext()) assertTrue(assertFails { doubleArrayOf().iterator().next() } is NoSuchElementException) assertTrue(eqLong(longArrayOf(0), LongArray(1))) assertTrue(eqLong(longArrayOf(1, 2, 3), LongArray(3) { it + 1L })) assertTrue(eqLong(longArrayOf(1), longArrayOf(1).copyOf())) assertTrue(eqLong(longArrayOf(1, 0), longArrayOf(1).copyOf(2))) assertTrue(eqLong(longArrayOf(1), longArrayOf(1, 2).copyOf(1))) assertTrue(eqLong(longArrayOf(1, 2), longArrayOf(1) + 2)) assertTrue(eqLong(longArrayOf(1, 2, 3), longArrayOf(1) + listOf(2L, 3L))) assertTrue(eqLong(longArrayOf(2, 3), longArrayOf(1, 2, 3, 4).copyOfRange(1, 3))) assertTrue(eqLong(longArrayOf(1, 2, 3, 4), customLongArrayOf(1L, *longArrayOf(2, 3), 4L))) assertTrue(longArrayOf(1).iterator() is LongIterator) assertEquals(1L, longArrayOf(1).iterator().nextLong()) assertEquals(1L, longArrayOf(1).iterator().next()) assertFalse(longArrayOf().iterator().hasNext()) assertTrue(assertFails { longArrayOf().iterator().next() } is NoSuchElementException) // If `is` checks work... if (intArrayOf() is IntArray) { assertTrue(booleanArrayOf(false) is BooleanArray) assertTrue(byteArrayOf(0) is ByteArray) assertTrue(shortArrayOf(0) is ShortArray) assertTrue(charArrayOf('a') is CharArray) assertTrue(intArrayOf(0) is IntArray) assertTrue(floatArrayOf(0f) is FloatArray) assertTrue(doubleArrayOf(0.0) is DoubleArray) assertTrue(longArrayOf(0) is LongArray) } // Rhino `instanceof` fails to distinguish TypedArray's if (intArrayOf() is IntArray && (byteArrayOf() as Any) !is IntArray) { assertTrue(checkExactArrayType(booleanArrayOf(false), booleanArray = true)) assertTrue(checkExactArrayType(byteArrayOf(0), byteArray = true)) assertTrue(checkExactArrayType(shortArrayOf(0), shortArray = true)) assertTrue(checkExactArrayType(charArrayOf('a'), charArray = true)) assertTrue(checkExactArrayType(intArrayOf(0), intArray = true)) assertTrue(checkExactArrayType(floatArrayOf(0f), floatArray = true)) assertTrue(checkExactArrayType(doubleArrayOf(0.0), doubleArray = true)) assertTrue(checkExactArrayType(longArrayOf(0), longArray = true)) assertTrue(checkExactArrayType(arrayOf<Any?>(), array = true)) } return "OK" } fun eqBoolean(expected: BooleanArray, actual: BooleanArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqByte(expected: ByteArray, actual: ByteArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqShort(expected: ShortArray, actual: ShortArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqChar(expected: CharArray, actual: CharArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqInt(expected: IntArray, actual: IntArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqLong(expected: LongArray, actual: LongArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqFloat(expected: FloatArray, actual: FloatArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun eqDouble(expected: DoubleArray, actual: DoubleArray): Boolean = actual.size == expected.size && actual.foldIndexed(true) { i, r, v -> r && expected[i] == v } fun customBooleanArrayOf(vararg arr: Boolean): BooleanArray = arr fun customByteArrayOf(vararg arr: Byte): ByteArray = arr fun customShortArrayOf(vararg arr: Short): ShortArray = arr fun customCharArrayOf(vararg arr: Char): CharArray = arr fun customIntArrayOf(vararg arr: Int): IntArray = arr fun customFloatArrayOf(vararg arr: Float): FloatArray = arr fun customDoubleArrayOf(vararg arr: Double): DoubleArray = arr fun customLongArrayOf(vararg arr: Long): LongArray = arr fun checkExactArrayType( a: Any?, booleanArray: Boolean = false, byteArray: Boolean = false, shortArray: Boolean = false, charArray: Boolean = false, intArray: Boolean = false, longArray: Boolean = false, floatArray: Boolean = false, doubleArray: Boolean = false, array: Boolean = false ): Boolean { return a is BooleanArray == booleanArray && a is ByteArray == byteArray && a is ShortArray == shortArray && a is CharArray == charArray && a is IntArray == intArray && a is LongArray == longArray && a is FloatArray == floatArray && a is DoubleArray == doubleArray && a is Array<*> == array }
181
null
5748
83
4383335168338df9bbbe2a63cb213a68d0858104
12,210
kotlin
Apache License 2.0
graphql-dgs-codegen-core/src/integTest/kotlin/com/netflix/graphql/dgs/codegen/cases/projectionWithUnion/expected/types/Employee.kt
Netflix
317,379,776
false
null
package com.netflix.graphql.dgs.codegen.cases.interfaceClassWithNonNullableFields.expected.types import com.fasterxml.jackson.`annotation`.JsonIgnoreProperties import com.fasterxml.jackson.`annotation`.JsonProperty import com.fasterxml.jackson.`annotation`.JsonTypeInfo import com.fasterxml.jackson.databind.`annotation`.JsonDeserialize import com.fasterxml.jackson.databind.`annotation`.JsonPOJOBuilder import java.lang.IllegalStateException import kotlin.String import kotlin.Suppress import kotlin.jvm.JvmName @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) @JsonDeserialize(builder = Employee.Builder::class) public class Employee( firstname: () -> String = firstnameDefault, lastname: () -> String? = lastnameDefault, company: () -> String? = companyDefault, ) : Person { private val __firstname: () -> String = firstname private val __lastname: () -> String? = lastname private val __company: () -> String? = company @Suppress("INAPPLICABLE_JVM_NAME") @get:JvmName("getFirstname") override val firstname: String get() = __firstname.invoke() @Suppress("INAPPLICABLE_JVM_NAME") @get:JvmName("getLastname") override val lastname: String? get() = __lastname.invoke() @get:JvmName("getCompany") public val company: String? get() = __company.invoke() public companion object { private val firstnameDefault: () -> String = { throw IllegalStateException("Field `firstname` was not requested") } private val lastnameDefault: () -> String? = { throw IllegalStateException("Field `lastname` was not requested") } private val companyDefault: () -> String? = { throw IllegalStateException("Field `company` was not requested") } } @JsonPOJOBuilder @JsonIgnoreProperties("__typename") public class Builder { private var firstname: () -> String = firstnameDefault private var lastname: () -> String? = lastnameDefault private var company: () -> String? = companyDefault @JsonProperty("firstname") public fun withFirstname(firstname: String): Builder = this.apply { this.firstname = { firstname } } @JsonProperty("lastname") public fun withLastname(lastname: String?): Builder = this.apply { this.lastname = { lastname } } @JsonProperty("company") public fun withCompany(company: String?): Builder = this.apply { this.company = { company } } public fun build(): Employee = Employee( firstname = firstname, lastname = lastname, company = company, ) } }
95
null
96
181
57b2e1e6db8da146cfa590a0c331ac15ef156085
2,538
dgs-codegen
Apache License 2.0
tibiakt-core/src/main/kotlin/com/galarzaa/tibiakt/core/models/forums/BoardEntry.kt
Galarzaa90
285,669,589
false
{"Kotlin": 530502, "Dockerfile": 1445}
/* * Copyright © 2022 Allan Galarza * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.galarzaa.tibiakt.core.models.forums import kotlinx.serialization.Serializable /** * A forum board listen within a [ForumSection]. * * @property name The name of the board. * @property description The description of the board. * @property posts The number of posts in the board. * @property threads The number of threads in the board. * @property lastPost The last post in the board. */ @Serializable public data class BoardEntry( val name: String, override val boardId: Int, val description: String, val posts: Int, val threads: Int, val lastPost: LastPost?, ) : BaseForumBoard
0
Kotlin
1
1
7274af579c1d4fa7865c05436c0e3ee5b293301a
1,224
TibiaKt
Apache License 2.0
common/src/main/kotlin/org/stardustmodding/interstellar/api/init/InitializedClient.kt
StardustModding
703,282,326
false
{"Kotlin": 83772, "Shell": 5565, "Java": 2839, "GLSL": 2679}
package org.stardustmodding.interstellar.api.init import net.minecraft.client.Minecraft interface InitializedClient : Initialized<Minecraft>
0
Kotlin
1
3
6185d241e7ceae7ab29f8e344d0c19596ad84b05
143
Interstellar
MIT License
src/main/kotlin/no/nav/eessi/pensjon/personoppslag/pdl/PersonService.kt
navikt
266,040,040
false
{"Kotlin": 108649}
package no.nav.eessi.pensjon.personoppslag.pdl import io.micrometer.core.instrument.simple.SimpleMeterRegistry import no.nav.eessi.pensjon.metrics.MetricsHelper import no.nav.eessi.pensjon.metrics.MetricsHelper.Metric import no.nav.eessi.pensjon.metrics.MetricsHelper.Toggle.OFF import no.nav.eessi.pensjon.personoppslag.pdl.model.AdressebeskyttelseGradering import no.nav.eessi.pensjon.personoppslag.pdl.model.AktoerId import no.nav.eessi.pensjon.personoppslag.pdl.model.GeografiskTilknytning import no.nav.eessi.pensjon.personoppslag.pdl.model.HentPerson import no.nav.eessi.pensjon.personoppslag.pdl.model.HentPersonUtenlandskIdent import no.nav.eessi.pensjon.personoppslag.pdl.model.Ident import no.nav.eessi.pensjon.personoppslag.pdl.model.IdentGruppe import no.nav.eessi.pensjon.personoppslag.pdl.model.IdentInformasjon import no.nav.eessi.pensjon.personoppslag.pdl.model.IdentType import no.nav.eessi.pensjon.personoppslag.pdl.model.NorskIdent import no.nav.eessi.pensjon.personoppslag.pdl.model.Npid import no.nav.eessi.pensjon.personoppslag.pdl.model.Person import no.nav.eessi.pensjon.personoppslag.pdl.model.PersonUtenlandskIdent import no.nav.eessi.pensjon.personoppslag.pdl.model.ResponseError import no.nav.eessi.pensjon.personoppslag.pdl.model.SokCriteria import no.nav.eessi.pensjon.personoppslag.pdl.model.SokKriterier import no.nav.eessi.pensjon.personoppslag.pdl.model.UtenlandskIdentifikasjonsnummer import org.springframework.beans.factory.annotation.Autowired import org.springframework.http.HttpStatus import org.springframework.stereotype.Service import org.springframework.web.client.HttpClientErrorException import javax.annotation.PostConstruct @Service class PersonService( private val client: PersonClient, @Autowired(required = false) private val metricsHelper: MetricsHelper = MetricsHelper(SimpleMeterRegistry()) ) { private lateinit var hentPersonMetric: Metric private lateinit var harAdressebeskyttelseMetric: Metric private lateinit var hentAktoerIdMetric: Metric private lateinit var hentIdentMetric: Metric private lateinit var hentIdenterMetric: Metric private lateinit var hentGeografiskTilknytningMetric: Metric private lateinit var sokPersonMetric: Metric private lateinit var hentPersonUidMetric: Metric @PostConstruct fun initMetrics() { hentPersonMetric = metricsHelper.init("hentPerson", alert = OFF) harAdressebeskyttelseMetric = metricsHelper.init("harAdressebeskyttelse", alert = OFF) hentAktoerIdMetric = metricsHelper.init("hentAktoerId", alert = OFF) hentIdentMetric = metricsHelper.init("hentIdent", alert = OFF) hentIdenterMetric = metricsHelper.init("hentIdenter", alert = OFF) hentGeografiskTilknytningMetric = metricsHelper.init("hentGeografiskTilknytning", alert = OFF) sokPersonMetric = metricsHelper.init("sokPersonMetric", alert = OFF) hentPersonUidMetric = metricsHelper.init("hentPersonUid", alert = OFF) } fun <T : IdentType> hentPersonUtenlandskIdent(ident: Ident<T>): PersonUtenlandskIdent? { return hentPersonMetric.measure { val response = client.hentPersonUtenlandsIdent(ident.id) if (!response.errors.isNullOrEmpty()) handleError(response.errors) return@measure response.data?.hentPerson ?.let { val identer = hentIdenter(ident) konverterTilPersonMedUid(it, identer) } } } internal fun konverterTilPersonMedUid( pdlPerson: HentPersonUtenlandskIdent, identer: List<IdentInformasjon>, ): PersonUtenlandskIdent { val navn = pdlPerson.navn .maxByOrNull { it.metadata.sisteRegistrertDato() } val kjoenn = pdlPerson.kjoenn .maxByOrNull { it.metadata.sisteRegistrertDato() } return PersonUtenlandskIdent( identer, navn, kjoenn, pdlPerson.utenlandskIdentifikasjonsnummer ) } /** * Funksjon for å hente ut person basert på fnr. * * @param ident: Identen til personen man vil hente ut identer for. Bruk [NorskIdent], [AktoerId], eller [Npid] * * @return [Person] */ fun <T : IdentType> hentPerson(ident: Ident<T>): Person? { return hentPersonMetric.measure { val response = client.hentPerson(ident.id) if (!response.errors.isNullOrEmpty()) handleError(response.errors) return@measure response.data?.hentPerson?.let { val identer = hentIdenter(ident) val geografiskTilknytning = hentGeografiskTilknytning(ident) val utenlandskIdentifikasjonsnummer = hentPersonUtenlandskIdent(ident)?.utenlandskIdentifikasjonsnummer ?: emptyList() konverterTilPerson(it, identer, geografiskTilknytning, utenlandskIdentifikasjonsnummer) } } } internal fun konverterTilPerson( pdlPerson: HentPerson, identer: List<IdentInformasjon>, geografiskTilknytning: GeografiskTilknytning?, utenlandskIdentifikasjonsnummer: List<UtenlandskIdentifikasjonsnummer> ): Person { val navn = pdlPerson.navn .maxByOrNull { it.metadata.sisteRegistrertDato() } val graderingListe = pdlPerson.adressebeskyttelse .map { it.gradering } .distinct() val statsborgerskap = pdlPerson.statsborgerskap .distinctBy { it.land } val foedsel = pdlPerson.foedsel .maxByOrNull { it.metadata.sisteRegistrertDato() } val bostedsadresse = pdlPerson.bostedsadresse .maxByOrNull { it.metadata.sisteRegistrertDato() } val oppholdsadresse = pdlPerson.oppholdsadresse .maxByOrNull { it.metadata.sisteRegistrertDato() } val kontaktadresse = pdlPerson.kontaktadresse ?.maxByOrNull { it.metadata.sisteRegistrertDato() } val kontaktinformasjonForDoedsbo = pdlPerson.kontaktinformasjonForDoedsbo .maxByOrNull { it.metadata.sisteRegistrertDato() } val kjoenn = pdlPerson.kjoenn .maxByOrNull { it.metadata.sisteRegistrertDato() } val doedsfall = pdlPerson.doedsfall .filterNot { it.doedsdato == null } .maxByOrNull { it.metadata.sisteRegistrertDato() } val forelderBarnRelasjon = pdlPerson.forelderBarnRelasjon val sivilstand = pdlPerson.sivilstand return Person( identer, navn, graderingListe, bostedsadresse, oppholdsadresse, statsborgerskap, foedsel, geografiskTilknytning, kjoenn, doedsfall, forelderBarnRelasjon, sivilstand, kontaktadresse, kontaktinformasjonForDoedsbo, utenlandskIdentifikasjonsnummer ) } /** * Funksjon for å sjekke om en liste med personer (fnr.) har en bestemt grad av adressebeskyttelse. * * @param fnr: Fødselsnummerene til personene man vil sjekke. * @param gradering: Graderingen man vil sjekke om personene har. * * @return [Boolean] "true" dersom en av personene har valgt gradering. */ fun harAdressebeskyttelse(fnr: List<String>, gradering: List<AdressebeskyttelseGradering>): Boolean { if (fnr.isEmpty() || gradering.isEmpty()) return false return harAdressebeskyttelseMetric.measure { val response = client.hentAdressebeskyttelse(fnr) if (!response.errors.isNullOrEmpty()) handleError(response.errors) val personer = response.data?.hentPersonBolk ?: return@measure false return@measure personer .filterNot { it.person == null } .flatMap { it.person!!.adressebeskyttelse } .any { it.gradering in gradering } } } /** * Funksjon for å hente ut en person sin Aktør ID. * * @param fnr: Fødselsnummeret til personen man vil hente ut Aktør ID for. * * @return [IdentInformasjon] med Aktør ID, hvis funnet */ fun hentAktorId(fnr: String): AktoerId { return hentAktoerIdMetric.measure { val response = client.hentAktorId(fnr) if (!response.errors.isNullOrEmpty()) handleError(response.errors) return@measure response.data?.hentIdenter?.identer ?.firstOrNull { it.gruppe == IdentGruppe.AKTORID } ?.let { AktoerId(it.ident) } ?: throw HttpClientErrorException(HttpStatus.NOT_FOUND) } } /** * Funksjon for å hente ut gjeldende [Ident] * * @param identTypeWanted: Hvilken [IdentType] man vil hente ut. * @param ident: Identen til personen man vil hente ut annen ident for. * * @return [Ident] av valgt [IdentType] */ fun <T : IdentType, R : IdentType> hentIdent(identTypeWanted: R, ident: Ident<T>): Ident<R> { return hentIdentMetric.measure { val result = hentIdenter(ident) .firstOrNull { it.gruppe == identTypeWanted.gruppe } ?.ident ?: throw HttpClientErrorException(HttpStatus.NOT_FOUND) @Suppress("USELESS_CAST", "UNCHECKED_CAST") return@measure when (identTypeWanted as IdentType) { is IdentType.NorskIdent -> NorskIdent(result) as Ident<R> is IdentType.AktoerId -> AktoerId(result) as Ident<R> is IdentType.Npid -> Npid(result) as Ident<R> } } } /** * Funksjon for å hente ut alle identer til en person. * * @param ident: Identen til personen man vil hente ut identer for. Bruk [NorskIdent], [AktoerId], eller [Npid] * * @return Liste med [IdentInformasjon] */ fun <T : IdentType> hentIdenter(ident: Ident<T>): List<IdentInformasjon> { return hentIdenterMetric.measure { val response = client.hentIdenter(ident.id) if (!response.errors.isNullOrEmpty()) handleError(response.errors) return@measure response.data?.hentIdenter?.identer ?: emptyList() } } fun sokPerson(sokKriterier: SokKriterier): Set<IdentInformasjon> { return sokPersonMetric.measure { val response = client.sokPerson(makeListCriteriaFromSok(sokKriterier)) if (!response.errors.isNullOrEmpty()) handleError(response.errors) val hits = response.data?.sokPerson?.hits return@measure if (hits?.size == 1) { hits.first().identer.toSet() } else { emptySet() } } } private fun makeListCriteriaFromSok(sokKriterier: SokKriterier): List<SokCriteria> { val INNEHOLDER = "contains" val ER_LIK = "equals" return listOf( SokCriteria("person.navn.fornavn",mapOf(INNEHOLDER to "${sokKriterier.fornavn}")), SokCriteria("person.navn.etternavn", mapOf(INNEHOLDER to "${sokKriterier.etternavn}")), SokCriteria("person.foedsel.foedselsdato", mapOf(ER_LIK to "${sokKriterier.foedselsdato}")) ) } /** * Funksjon for å hente ut en person sin geografiske tilknytning. * * @param ident: Identen til personen man vil hente ut identer for. Bruk [NorskIdent], [AktoerId], eller [Npid] * * @return [GeografiskTilknytning] */ fun <T : IdentType> hentGeografiskTilknytning(ident: Ident<T>): GeografiskTilknytning? { return hentGeografiskTilknytningMetric.measure { val response = client.hentGeografiskTilknytning(ident.id) if (!response.errors.isNullOrEmpty()) handleError(response.errors) return@measure response.data?.geografiskTilknytning } } private fun handleError(errors: List<ResponseError>) { val error = errors.first() val code = error.extensions?.code ?: "unknown_error" val message = error.message ?: "Error message from PDL is missing" throw PersonoppslagException("$code: $message") } } class PersonoppslagException(message: String) : RuntimeException(message)
0
Kotlin
0
2
c3f56674e3bc7b02834f7e88ce2044af59f3dbda
12,605
ep-personoppslag
MIT License
app/src/main/java/io/github/msh91/arch/di/module/NetworkModule.kt
msh91
134,849,661
false
null
package io.github.msh91.arch.di.module import com.google.gson.* import dagger.Module import dagger.Provides import io.github.msh91.arch.BuildConfig import io.github.msh91.arch.data.di.qualifier.Concrete import io.github.msh91.arch.data.di.qualifier.Stub import io.github.msh91.arch.data.source.local.file.BaseFileProvider import io.github.msh91.arch.data.source.remote.ChartDataSource import io.github.msh91.arch.data.source.remote.CryptoDataSource import io.github.msh91.arch.data.source.remote.StubCryptoDataSource import io.github.msh91.arch.util.SecretFields import okhttp3.Headers import okhttp3.Interceptor import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory import java.util.* import javax.inject.Singleton /** * The main [Module] for providing network-related classes */ @Module object NetworkModule { /** * provides Gson with custom [Date] converter for [Long] epoch times */ @Singleton @Provides fun provideGson(): Gson { return GsonBuilder() // Deserializer to convert json long value into Date .registerTypeAdapter( Date::class.java, JsonDeserializer { json, _, _ -> Date(json.asJsonPrimitive.asLong * 1000) } ) // Serializer to convert Date value into long json primitive .registerTypeAdapter( Date::class.java, JsonSerializer<Date> { src, _, _ -> JsonPrimitive(src.time) } ) .create() } /** * provides shared [Headers] to be added into [OkHttpClient] instances */ @Singleton @Provides fun provideSharedHeaders(): Headers { return Headers.Builder() .add("Accept", "*/*") .add("User-Agent", "mobile") .build() } /** * provides instance of [OkHttpClient] for api services * * @param headers default shared headers provided by [provideSharedHeaders] * @return an instance of [OkHttpClient] */ @Singleton @Provides fun provideOkHttpClient(headers: Headers, secretFields: SecretFields): OkHttpClient { val builder = OkHttpClient.Builder() if (BuildConfig.DEBUG) { val loggingInterceptor = HttpLoggingInterceptor() loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY builder.addInterceptor(loggingInterceptor) } builder.interceptors().add( Interceptor { chain -> val request = chain.request() val requestBuilder = request.newBuilder() .headers(headers) .addHeader("X-CMC_PRO_API_KEY", secretFields.apiKey) .method(request.method(), request.body()) chain.proceed(requestBuilder.build()) } ) return builder.build() } /** * provide an instance of [Retrofit] api services * * @param okHttpClient an instance of [okHttpClient] provided by [provideOkHttpClient] * @param gson an instance of gson provided by [provideGson] to use as retrofit converter factory * * @return an instance of [Retrofit] for api calls */ @Provides fun provideRetrofitBuilder(okHttpClient: OkHttpClient, gson: Gson, secretFields: SecretFields): Retrofit.Builder { return Retrofit.Builder().client(okHttpClient) // create gson converter factory .addConverterFactory(GsonConverterFactory.create(gson)) } @Provides @Singleton fun provideChartDataSource(retrofitBuilder: Retrofit.Builder, secretFields: SecretFields): ChartDataSource { return retrofitBuilder .baseUrl(secretFields.getChartBaseUrl()) .build() .create(ChartDataSource::class.java) } @Provides @Concrete @Singleton fun provideConcreteCryptoDataSource(retrofitBuilder: Retrofit.Builder, secretFields: SecretFields): CryptoDataSource { return retrofitBuilder .baseUrl(secretFields.getCoinMarketBaseUrl()) .build() .create(CryptoDataSource::class.java) } @Provides @Stub fun provideStubCryptoDataSource(gson: Gson, fileProvider: BaseFileProvider): CryptoDataSource { return StubCryptoDataSource(gson, fileProvider) } }
1
Kotlin
7
25
9f0bf81e3493ee733a0b64c9a64249eacd8b652b
4,499
arch
Apache License 2.0
idbdata/src/main/java/com/gmail/eamosse/idbdata/data/Director.kt
hamzabatr
428,301,037
true
{"Kotlin": 87259}
package com.gmail.eamosse.idbdata.data data class Director( val id: Int, val name: String )
0
Kotlin
0
0
304f641f2f7e4499538995b30892119070f517f2
101
the-movie-app
Apache License 2.0
alfos-core/src/main/kotlin/fr/cvlaminck/alfos/model/StorageCollection.kt
cyr62110
108,091,243
false
null
package fr.cvlaminck.alfos.model /** * Provide all information on a collection of objects stored in a storage. */ class StorageCollection( /** * [Storage] containing this collection. */ val storage: Storage, /** * Name of the collection. */ val name: String ) { override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is StorageCollection) return false // Hardcoded Storage equals to allow equals to work even if Storage equals has not been properly implemented // by third party. if (storage.name != other.storage.name) return false if (storage.provider.name != other.storage.provider.name) return false if (name != other.name) return false return true } override fun hashCode(): Int { var result = storage.name.hashCode() result = 31 * result + storage.provider.name.hashCode() result = 31 * result + name.hashCode() return result } override fun toString(): String { return "${name} <${storage.name}> [${storage.provider.name}]" } }
1
Kotlin
0
0
fa20692c300d6bff50e6491ffdab1153a4ad4967
1,171
alfos
Apache License 2.0
kotlin-react-router-dom/src/jsMain/generated/react/router/dom/useSubmit.kt
JetBrains
93,250,841
false
null
@file:JsModule("react-router-dom") @file:Suppress( "NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE", ) package react.router.dom /** * Returns a function that may be used to programmatically submit a form (or * some arbitrary data) to the server. */ external fun useSubmit(): SubmitFunction
28
null
173
1,250
d1f8f5d805ffa18431dfefb7a1aa2f67f48915f6
301
kotlin-wrappers
Apache License 2.0
design/src/main/kotlin/com/stepmate/design/component/lazyList/VerticalScrollBar.kt
step-Mate
738,437,093
false
{"Kotlin": 753362}
package com.stepmate.design.component.lazyList import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.gestures.detectVerticalDragGestures import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.geometry.Offset import androidx.compose.ui.input.nestedscroll.NestedScrollConnection import androidx.compose.ui.input.nestedscroll.NestedScrollSource import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.res.painterResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import com.stepmate.design.R import com.stepmate.design.theme.StepMateTheme import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch @Composable fun BoxWithConstraintsScope.VerticalScrollBar( scrollBarState: ScrollBarState, lazyListState: LazyListState, coroutineScope: CoroutineScope = rememberCoroutineScope(), density: Density = LocalDensity.current, headerItemHeight: Dp, perItemHeight: Dp, ) { val scrollBarViewHeight = 24.dp val maxHeight = with(density) { maxHeight.toPx() - scrollBarViewHeight.toPx() } Column( modifier = Modifier .fillMaxHeight() .align(Alignment.CenterEnd) .pointerInput(Unit) { detectVerticalDragGestures { change, dragAmount -> change.consume() scrollBarState.onScroll(-dragAmount / (maxHeight) * scrollBarState.threshold) coroutineScope.launch { val index = when { scrollBarState.offset <= headerItemHeight.toPx() -> 0 else -> { val newScrollOffset = (scrollBarState.offset - headerItemHeight.toPx()) / perItemHeight.toPx() + 2 (newScrollOffset.coerceAtLeast(0f)).toInt() } } lazyListState.scrollToItem(index) } } }, ) { Image( painter = painterResource( id = R.drawable.ic_scroll ), contentDescription = "Scroll Image", modifier = Modifier .width(16.dp) .height(24.dp) .offset { IntOffset( x = 0, y = (scrollBarState.progress * maxHeight).toInt() ) } .background(MaterialTheme.colorScheme.surface, CircleShape) .alpha(0.5f) .padding(vertical = 4.dp) ) } } fun Modifier.addScrollBarNestedScrollConnection( timer: TimeScheduler, isUpperScrollActive: Boolean, scrollBarState: ScrollBarState, ) = this.nestedScroll( ScrollBarNestedScrollConnection( setTime = timer::setTime, cancel = timer::cancel, isUpperScrollActive = isUpperScrollActive, onScroll = scrollBarState::onScroll, ) ) class ScrollBarNestedScrollConnection( private val setTime: () -> Unit, private val cancel: () -> Unit, private val isUpperScrollActive: Boolean, private val onScroll: (Float) -> Unit, ) : NestedScrollConnection { override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset { if (isUpperScrollActive) setTime() else cancel() onScroll(available.y) return Offset.Zero } } @Composable @Preview private fun PreviewVerticalScrollBar() = StepMateTheme { BoxWithConstraints { VerticalScrollBar( scrollBarState = rememberScrollBarState(viewHeight = maxHeight.value).apply { this.changeOffset(maxHeight.value) }, lazyListState = rememberLazyListState(), headerItemHeight = 100.dp, perItemHeight = 60.dp ) } }
3
Kotlin
0
0
d7907a8bd7fd5a7f842c994731c4f4f1bdad847e
5,098
Android
Apache License 2.0
Frontend/app/src/main/java/com/example/TeamApp/ui/theme/Type.kt
TeamApp-apk
826,845,157
false
null
package com.example.ui.theme import android.content.res.Resources import android.util.Log import androidx.compose.foundation.layout.Column import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Typography import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalFontFamilyResolver import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.createFontFamilyResolver import androidx.compose.ui.text.googlefonts.Font import androidx.compose.ui.text.googlefonts.GoogleFont import androidx.compose.ui.text.googlefonts.isAvailableOnDevice import androidx.compose.ui.unit.sp import com.example.TeamApp.R import kotlinx.coroutines.CoroutineExceptionHandler import androidx.compose.ui.text.googlefonts.Font import androidx.compose.ui.text.style.LineHeightStyle import androidx.compose.ui.text.style.TextAlign import kotlin.math.ceil import kotlin.math.floor val metrics = Resources.getSystem().displayMetrics val density = metrics.density / 2 val AppTypography = Typography() val provider = GoogleFont.Provider( providerAuthority = "com.google.android.gms.fonts", providerPackage = "com.google.android.gms", certificates = R.array.com_google_android_gms_fonts_certs ) val fontName = GoogleFont("Roboto") val fontFamily = FontFamily( Font( googleFont = fontName, fontProvider = provider, weight = FontWeight.Bold, style = FontStyle.Italic ) ) val textInUpperBoxForgotPassword = TextStyle( fontSize = 25.sp * com.example.TeamApp.auth.density, fontFamily = fontFamily, fontWeight = FontWeight(500), color = Color(0xFF003366), ) val textInLowerBoxForgotPassword = TextStyle( fontSize = 15.sp, lineHeight = 25.sp, fontFamily = FontFamily(Font(R.font.proximanovabold)), fontWeight = FontWeight(400), color = Color.Black ) val sendButton = TextStyle ( fontSize = 18.sp, fontFamily = FontFamily(Font(R.font.proximanovabold)), fontWeight = FontWeight(600), color = Color(0xFF003366), textAlign = TextAlign.Center, letterSpacing = 1.sp ) val googleAuthStyle = TextStyle ( fontSize = 18.sp, fontFamily = FontFamily(Font(R.font.proximanovabold)), fontWeight = FontWeight(500), color = Color(0xFF003366), textAlign = TextAlign.Center, letterSpacing = 1.sp ) val forgotPasswordLogin = TextStyle( fontSize = 14.sp, lineHeight = 23.sp, fontFamily = FontFamily(Font(R.font.proximanovabold)), fontWeight = FontWeight(400), color = Color(0xFF003366), textAlign = TextAlign.Right, ) val buttonLogIn = TextStyle( fontSize = 16.sp, fontFamily = FontFamily(Font(R.font.proximanovaregular)), fontWeight = FontWeight.Normal, color = Color(0xffe0e0e0), textAlign = TextAlign.Center, letterSpacing = 1.sp )
0
null
2
4
5823992ff825bc168d09ca93c95bd5aca3042db8
3,220
TeamApp
MIT License
straight/src/commonMain/kotlin/me/localx/icons/straight/bold/PlugAlt.kt
localhostov
808,861,591
false
{"Kotlin": 79430321, "HTML": 331, "CSS": 102}
package me.localx.icons.straight.bold import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.PathFillType.Companion.NonZero import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.graphics.StrokeCap.Companion.Butt import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector.Builder import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.unit.dp import me.localx.icons.straight.Icons public val Icons.Bold.PlugAlt: ImageVector get() { if (_plugAlt != null) { return _plugAlt!! } _plugAlt = Builder(name = "PlugAlt", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, viewportHeight = 24.0f).apply { path(fill = SolidColor(Color(0xFF000000)), stroke = null, strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, pathFillType = NonZero) { moveToRelative(20.003f, 3.059f) curveTo(17.466f, 0.786f, 14.054f, -0.298f, 10.64f, 0.075f) curveTo(5.127f, 0.685f, 0.684f, 5.127f, 0.076f, 10.64f) curveToRelative(-0.669f, 6.057f, 3.156f, 11.75f, 8.897f, 13.244f) curveToRelative(0.303f, 0.078f, 0.609f, 0.117f, 0.914f, 0.117f) curveToRelative(0.788f, 0.0f, 1.558f, -0.26f, 2.202f, -0.758f) curveToRelative(0.897f, -0.693f, 1.411f, -1.74f, 1.411f, -2.872f) verticalLineToRelative(-1.483f) curveToRelative(2.002f, -0.456f, 3.5f, -2.25f, 3.5f, -4.388f) verticalLineToRelative(-1.5f) horizontalLineToRelative(1.0f) verticalLineToRelative(-3.0f) horizontalLineToRelative(-2.0f) verticalLineToRelative(-4.0f) horizontalLineToRelative(-3.0f) verticalLineToRelative(4.0f) horizontalLineToRelative(-2.0f) verticalLineToRelative(-4.0f) horizontalLineToRelative(-3.0f) verticalLineToRelative(4.0f) horizontalLineToRelative(-2.0f) verticalLineToRelative(3.0f) horizontalLineToRelative(1.0f) verticalLineToRelative(1.5f) curveToRelative(0.0f, 2.138f, 1.498f, 3.932f, 3.5f, 4.388f) verticalLineToRelative(1.483f) curveToRelative(0.0f, 0.269f, -0.154f, 0.428f, -0.246f, 0.499f) curveToRelative(-0.089f, 0.068f, -0.276f, 0.177f, -0.526f, 0.109f) curveToRelative(-4.238f, -1.103f, -7.168f, -5.499f, -6.67f, -10.01f) curveToRelative(0.456f, -4.129f, 3.783f, -7.457f, 7.913f, -7.912f) curveToRelative(2.602f, -0.291f, 5.1f, 0.506f, 7.031f, 2.235f) curveToRelative(1.906f, 1.707f, 2.999f, 4.151f, 2.999f, 6.707f) reflectiveCurveToRelative(-1.093f, 5.0f, -2.999f, 6.707f) curveToRelative(-0.613f, 0.549f, -1.288f, 0.993f, -2.001f, 1.349f) verticalLineToRelative(3.244f) curveToRelative(1.463f, -0.516f, 2.828f, -1.306f, 4.003f, -2.358f) curveToRelative(2.54f, -2.274f, 3.997f, -5.533f, 3.997f, -8.941f) reflectiveCurveToRelative(-1.457f, -6.667f, -3.997f, -8.941f) close() moveTo(10.0f, 14.5f) verticalLineToRelative(-1.5f) horizontalLineToRelative(4.0f) verticalLineToRelative(1.5f) curveToRelative(0.0f, 0.827f, -0.673f, 1.5f, -1.5f, 1.5f) horizontalLineToRelative(-1.0f) curveToRelative(-0.827f, 0.0f, -1.5f, -0.673f, -1.5f, -1.5f) close() } } .build() return _plugAlt!! } private var _plugAlt: ImageVector? = null
1
Kotlin
0
5
cbd8b510fca0e5e40e95498834f23ec73cc8f245
4,021
icons
MIT License
app/src/test/kotlin/batect/config/io/ConfigurationFileSpec.kt
decomplected
168,092,476
true
{"Kotlin": 1678077, "Groovy": 11432, "Shell": 10841, "Python": 10312, "JavaScript": 4104, "Dockerfile": 4006, "Java": 1099, "HTML": 878}
/* Copyright 2017-2019 <NAME>. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package batect.config.io import batect.config.BuildImage import batect.config.Container import batect.config.ContainerMap import batect.config.LiteralValue import batect.config.PortMapping import batect.config.Task import batect.config.TaskMap import batect.config.TaskRunConfiguration import batect.config.VolumeMount import batect.os.Command import batect.os.PathResolver import com.natpryce.hamkrest.assertion.assertThat import com.natpryce.hamkrest.equalTo import com.natpryce.hamkrest.isEmpty import com.nhaarman.mockitokotlin2.mock import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on object ConfigurationFileSpec : Spek({ describe("a configuration file") { describe("converting to a configuration model object") { on("converting an empty configuration file") { val configFile = ConfigurationFile("the_project_name") val pathResolver = mock<PathResolver>() val resultingConfig = configFile.toConfiguration(pathResolver) it("returns a configuration object with the project name") { assertThat(resultingConfig.projectName, equalTo("the_project_name")) } it("returns a configuration object with no tasks") { assertThat(resultingConfig.tasks, isEmpty) } it("returns a configuration object with no containers") { assertThat(resultingConfig.containers, isEmpty) } } on("converting a configuration file with a task") { val runConfiguration = TaskRunConfiguration("some_container", Command.parse("some_command"), mapOf("SOME_VAR" to LiteralValue("some value")), setOf(PortMapping(123, 456))) val task = TaskFromFile(runConfiguration, "Some description", setOf("dependency-1"), listOf("other-task")) val taskName = "the_task_name" val configFile = ConfigurationFile("the_project_name", mapOf(taskName to task)) val pathResolver = mock<PathResolver>() val resultingConfig = configFile.toConfiguration(pathResolver) it("returns a configuration object with the project name") { assertThat(resultingConfig.projectName, equalTo("the_project_name")) } it("returns a configuration object with the task") { assertThat(resultingConfig.tasks, equalTo(TaskMap( Task( taskName, TaskRunConfiguration(runConfiguration.container, runConfiguration.command, runConfiguration.additionalEnvironmentVariables, runConfiguration.additionalPortMappings), "Some description", task.dependsOnContainers, task.prerequisiteTasks ) ))) } it("returns a configuration object with no containers") { assertThat(resultingConfig.containers, isEmpty) } } on("converting a configuration file with a container") { val container = ContainerFromFile( imageSource = BuildImage("/the_resolved_build_dir"), command = Command.parse("the-command"), environment = mapOf("ENV_VAR" to LiteralValue("/here")), workingDirectory = "working_dir", volumeMounts = setOf(VolumeMount("/local_volume_dir", "/remote", "some-options")), portMappings = setOf(PortMapping(1234, 5678)), dependencies = setOf("some-dependency")) val containerName = "the_container_name" val configFile = ConfigurationFile("the_project_name", containers = mapOf(containerName to container)) val pathResolver = mock<PathResolver>() val resultingConfig = configFile.toConfiguration(pathResolver) it("returns a configuration object with the project name") { assertThat(resultingConfig.projectName, equalTo("the_project_name")) } it("returns a configuration object with no tasks") { assertThat(resultingConfig.tasks, isEmpty) } it("returns a configuration object with the container") { assertThat(resultingConfig.containers, equalTo(ContainerMap( Container( containerName, container.imageSource, container.command, container.environment, container.workingDirectory, container.volumeMounts, container.portMappings, container.dependencies) ))) } } } } })
4
Kotlin
0
0
4f003ccc9c5a4c5b841209ca70891636f49562c7
5,774
batect
Apache License 2.0