├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src ├── commonMain │ ├── assetsSource │ │ ├── cube.blend │ │ ├── cube.blend1 │ │ └── cube.gltf │ ├── resources │ │ └── cube.protobuf │ └── kotlin │ │ └── your │ │ └── game │ │ ├── components │ │ └── Cube.kt │ │ ├── MyGame.kt │ │ └── systems │ │ └── RotatingCubeSystem.kt ├── jsMain │ ├── resources │ │ └── index.html │ └── kotlin │ │ └── your │ │ └── game │ │ └── Main.kt └── jvmMain │ └── kotlin │ └── your │ └── game │ └── Main.kt ├── .gitattributes ├── .gitignore ├── README.md ├── settings.gradle.kts ├── LICENSE ├── .github └── workflows │ └── build_bundles.yml ├── gradlew.bat └── gradlew /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minigdx/minigdx-game-template/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/commonMain/assetsSource/cube.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minigdx/minigdx-game-template/HEAD/src/commonMain/assetsSource/cube.blend -------------------------------------------------------------------------------- /src/commonMain/assetsSource/cube.blend1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minigdx/minigdx-game-template/HEAD/src/commonMain/assetsSource/cube.blend1 -------------------------------------------------------------------------------- /src/commonMain/resources/cube.protobuf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minigdx/minigdx-game-template/HEAD/src/commonMain/resources/cube.protobuf -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /build/ 3 | 4 | # Ignore Gradle GUI config 5 | gradle-app.setting 6 | 7 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 8 | !gradle-wrapper.jar 9 | 10 | # Cache of project 11 | .gradletasknamecache 12 | 13 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 14 | # gradle/wrapper/gradle-wrapper.properties 15 | 16 | .idea 17 | -------------------------------------------------------------------------------- /src/jsMain/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MiniGDX - Your Game 6 | 7 | 8 |
9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/commonMain/kotlin/your/game/components/Cube.kt: -------------------------------------------------------------------------------- 1 | package your.game.components 2 | 3 | import com.github.dwursteisen.minigdx.Seconds 4 | import com.github.dwursteisen.minigdx.ecs.components.Component 5 | 6 | /** 7 | * Cube component: tag to mark entities that are cube. 8 | */ 9 | class Cube( 10 | // Remaining time of the cube movement 11 | var duration: Seconds = 0f 12 | ) : Component 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MiniGDX Game Template 2 | 3 | Create your first game using miniGDX by clicking the "Use this Template" button above. 4 | 5 | The game will be configured for: 6 | 7 | - the JVM platform (try it by running `./gradlew runJvm` command!) 8 | - the Web platform (try it by running `./gradlew runJs` command!) 9 | 10 | 11 | Get [more informations](https://github.com/minigdx) on miniGDX. 12 | 13 | ## Github Actions 14 | 15 | This template contains [github actions](https://docs.github.com/en/actions) that generate 16 | the bundles of your game for you. 17 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.8.2/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = "minigdx-game-template" 11 | 12 | pluginManagement { 13 | repositories { 14 | gradlePluginPortal() 15 | google() 16 | maven { 17 | url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") 18 | }.mavenContent { 19 | includeVersionByRegex("com.github.minigdx.(.*)", "(.*)", "LATEST-SNAPSHOT") 20 | includeVersionByRegex("com.github.minigdx", "(.*)", "LATEST-SNAPSHOT") 21 | } 22 | mavenLocal() 23 | jcenter() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 dwursteisen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/build_bundles.yml: -------------------------------------------------------------------------------- 1 | name: Build bundles for all platforms 2 | # This workflow is triggered on pushes to the repository or can be trigger manually. 3 | on: [push, workflow_dispatch] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout the repo 11 | uses: actions/checkout@v2 12 | - name: Validate Gradle Wrapper 13 | uses: gradle/wrapper-validation-action@v1 14 | - name: Cache gradle 15 | uses: actions/cache@v1 16 | with: 17 | path: ~/.gradle/caches 18 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }} 19 | restore-keys: | 20 | ${{ runner.os }}-gradle 21 | - name: Set up JDK 11 22 | uses: actions/setup-java@v1 23 | with: 24 | java-version: 11 25 | - name: Bundle Game 26 | run: ./gradlew bundle-js bundle-jar 27 | - name: Archive production artifacts 28 | uses: actions/upload-artifact@v2 29 | with: 30 | name: bundles 31 | path: build/minigdx/* 32 | retention-days: 3 33 | 34 | env: 35 | GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" 36 | -------------------------------------------------------------------------------- /src/commonMain/kotlin/your/game/MyGame.kt: -------------------------------------------------------------------------------- 1 | package your.game 2 | 3 | import com.dwursteisen.minigdx.scene.api.Scene 4 | import com.dwursteisen.minigdx.scene.api.relation.ObjectType 5 | import com.github.dwursteisen.minigdx.GameContext 6 | import com.github.dwursteisen.minigdx.ecs.Engine 7 | import com.github.dwursteisen.minigdx.ecs.entities.EntityFactory 8 | import com.github.dwursteisen.minigdx.ecs.systems.System 9 | import com.github.dwursteisen.minigdx.file.get 10 | import com.github.dwursteisen.minigdx.game.Game 11 | import your.game.components.Cube 12 | import your.game.systems.RotatingCubeSystem 13 | 14 | class MyGame(override val gameContext: GameContext) : Game { 15 | 16 | private val scene by gameContext.fileHandler.get("cube.protobuf") 17 | 18 | override fun createEntities(entityFactory: EntityFactory) { 19 | // Create all entities needed at startup 20 | // The scene is the node graph that can be updated in Blender 21 | scene.children.forEach { node -> 22 | // Create an entity using all information from this node (model, position, camera, ...) 23 | val entity = entityFactory.createFromNode(node, scene) 24 | 25 | // The node is the cube from the Blender file 26 | if(node.type == ObjectType.MODEL) { 27 | // Mark this entity as being a cube 28 | entity.add(Cube()) 29 | } 30 | } 31 | } 32 | 33 | override fun createSystems(engine: Engine): List { 34 | // Create all systems used by the game 35 | return listOf(RotatingCubeSystem()) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/jvmMain/kotlin/your/game/Main.kt: -------------------------------------------------------------------------------- 1 | package your.game 2 | 3 | import com.github.dwursteisen.minigdx.GameApplicationBuilder 4 | import com.github.dwursteisen.minigdx.GameConfiguration 5 | import com.github.dwursteisen.minigdx.GameScreenConfiguration 6 | import com.github.dwursteisen.minigdx.Window 7 | 8 | object Main { 9 | 10 | @JvmStatic 11 | fun main(vararg args: String) { 12 | // This class can be run unsing the command `./gradlew runJvm` 13 | GameApplicationBuilder( 14 | gameConfigurationFactory = { 15 | GameConfiguration( 16 | // Name of the game 17 | gameName = "My Game", 18 | // Screen configuration used for your game (ie: how should render your game) 19 | gameScreenConfiguration = GameScreenConfiguration.WithRatio(16f / 9f), 20 | // Is your game should use show debug information? (hitbox, ...) 21 | debug = false, 22 | // (JVM Specific configuration) 23 | // Configuration of the window use to render your game 24 | window = Window( 25 | // Width of the window 26 | 1024, 27 | // Height of the window 28 | (1024 * 9f / 16f).toInt(), 29 | // Name of the window 30 | "My Game - running on the JVM" 31 | ) 32 | ) 33 | }, 34 | // Creation of your game 35 | gameFactory = { MyGame(it) } 36 | ).start() // Don't forget to call the start method to run your game! 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/commonMain/kotlin/your/game/systems/RotatingCubeSystem.kt: -------------------------------------------------------------------------------- 1 | package your.game.systems 2 | 3 | import com.github.dwursteisen.minigdx.Seconds 4 | import com.github.dwursteisen.minigdx.ecs.entities.Entity 5 | import com.github.dwursteisen.minigdx.ecs.entities.position 6 | import com.github.dwursteisen.minigdx.ecs.systems.EntityQuery 7 | import com.github.dwursteisen.minigdx.ecs.systems.System 8 | import com.github.dwursteisen.minigdx.input.Key 9 | import your.game.components.Cube 10 | import kotlin.math.abs 11 | import kotlin.math.cos 12 | 13 | /** 14 | * Rotate entities with [Cube] component by 90 degrees per second. 15 | */ 16 | class RotatingCubeSystem : System(EntityQuery.of(Cube::class)) { 17 | 18 | override fun update(delta: Seconds, entity: Entity) { 19 | val component = entity.get(Cube::class) 20 | // If the key SPACE is pressed one time, 21 | // then set the duration of the component to 2 seconds. 22 | if(input.isKeyJustPressed(Key.SPACE)) { 23 | component.duration = 2f 24 | } 25 | 26 | // If there is a duration, the cube can be scaled 27 | if(component.duration > 0f) { 28 | component.duration -= delta 29 | // Compute the scale regarding the remaining duration using a cosine function 30 | // and keep the absolute value so the scale is always positive. 31 | val scale = abs(cos(component.duration)) 32 | 33 | // Set the scale of the cube. 34 | entity.position.setLocalScale( 35 | x = scale, 36 | y = scale, 37 | z = scale 38 | ) 39 | } 40 | 41 | // Rotate the cube of 90 degrees per second. 42 | entity.position.addLocalRotation(y = 90f, delta = delta) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/jsMain/kotlin/your/game/Main.kt: -------------------------------------------------------------------------------- 1 | package your.game 2 | 3 | import com.github.dwursteisen.minigdx.GameApplicationBuilder 4 | import com.github.dwursteisen.minigdx.GameConfiguration 5 | import com.github.dwursteisen.minigdx.GameScreenConfiguration 6 | import org.w3c.dom.HTMLCanvasElement 7 | import org.w3c.dom.get 8 | import kotlinx.browser.document 9 | import kotlinx.browser.window 10 | 11 | fun main() { 12 | // Look for the first canvas in current page. 13 | val canvas = document.getElementsByTagName("canvas")[0] ?: throw IllegalArgumentException( 14 | "No has been found in the current page. Check that the page including your javascript game" + 15 | "has a tag to render the game in." 16 | ) 17 | 18 | // Get the actual root path and compute the root path to let the game load the resources from 19 | // the correct URL. 20 | // This portion may need to be customized regarding the service where the game is deployed (itch.io, ...) 21 | var rootPath = window.location.protocol + "//" + window.location.host + window.location.pathname 22 | rootPath = rootPath.replace("index.html", "") 23 | 24 | 25 | GameApplicationBuilder( 26 | gameConfigurationFactory = { 27 | GameConfiguration( 28 | // Configure how the game will be rendered in the canvas 29 | gameScreenConfiguration = GameScreenConfiguration.WithRatio(16f / 9f), 30 | // What canvas to use to render the game 31 | canvas = canvas as HTMLCanvasElement, 32 | // What root path to use. It's use so minigdx can access to resources with the correct URL. 33 | rootPath = rootPath, 34 | // Is debug information should be displayed? (hitbox, ...) 35 | debug = false, 36 | // The name of your game 37 | gameName = "My Game - running in a browser" 38 | ) 39 | }, 40 | // Creation of your game 41 | gameFactory = { MyGame(it) } 42 | ).start() // ! Don't forget to call this method to start your game! 43 | } 44 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /src/commonMain/assetsSource/cube.gltf: -------------------------------------------------------------------------------- 1 | { 2 | "asset" : { 3 | "generator" : "Khronos glTF Blender I/O v1.5.17", 4 | "version" : "2.0" 5 | }, 6 | "extensionsUsed" : [ 7 | "KHR_lights_punctual" 8 | ], 9 | "extensionsRequired" : [ 10 | "KHR_lights_punctual" 11 | ], 12 | "extensions" : { 13 | "KHR_lights_punctual" : { 14 | "lights" : [ 15 | { 16 | "color" : [ 17 | 1, 18 | 1, 19 | 1 20 | ], 21 | "intensity" : 1000, 22 | "type" : "point", 23 | "name" : "Light" 24 | } 25 | ] 26 | } 27 | }, 28 | "scene" : 0, 29 | "scenes" : [ 30 | { 31 | "extras" : { 32 | "glTF2ExportSettings" : { 33 | "export_apply" : 1, 34 | "export_cameras" : 1, 35 | "export_extras" : 1, 36 | "export_format" : "GLTF_EMBEDDED", 37 | "export_lights" : 1 38 | } 39 | }, 40 | "name" : "Scene", 41 | "nodes" : [ 42 | 0, 43 | 2, 44 | 4 45 | ] 46 | } 47 | ], 48 | "nodes" : [ 49 | { 50 | "mesh" : 0, 51 | "name" : "Cube" 52 | }, 53 | { 54 | "extensions" : { 55 | "KHR_lights_punctual" : { 56 | "light" : 0 57 | } 58 | }, 59 | "name" : "Light_Orientation", 60 | "rotation" : [ 61 | -0.7071067690849304, 62 | 0, 63 | 0, 64 | 0.7071067690849304 65 | ] 66 | }, 67 | { 68 | "children" : [ 69 | 1 70 | ], 71 | "name" : "Light", 72 | "rotation" : [ 73 | 0.16907575726509094, 74 | 0.7558803558349609, 75 | -0.27217137813568115, 76 | 0.570947527885437 77 | ], 78 | "translation" : [ 79 | 4.076245307922363, 80 | 5.903861999511719, 81 | -1.0054539442062378 82 | ] 83 | }, 84 | { 85 | "camera" : 0, 86 | "name" : "Camera_Orientation", 87 | "rotation" : [ 88 | -0.7071067690849304, 89 | 0, 90 | 0, 91 | 0.7071067690849304 92 | ] 93 | }, 94 | { 95 | "children" : [ 96 | 3 97 | ], 98 | "name" : "Camera", 99 | "rotation" : [ 100 | 0.483536034822464, 101 | 0.33687159419059753, 102 | -0.20870360732078552, 103 | 0.7804827094078064 104 | ], 105 | "translation" : [ 106 | 7.358891487121582, 107 | 4.958309173583984, 108 | 6.925790786743164 109 | ] 110 | } 111 | ], 112 | "cameras" : [ 113 | { 114 | "name" : "Camera", 115 | "perspective" : { 116 | "aspectRatio" : 1.7777777777777777, 117 | "yfov" : 0.39959648408210363, 118 | "zfar" : 100, 119 | "znear" : 0.10000000149011612 120 | }, 121 | "type" : "perspective" 122 | } 123 | ], 124 | "materials" : [ 125 | { 126 | "doubleSided" : true, 127 | "name" : "Material", 128 | "pbrMetallicRoughness" : { 129 | "baseColorTexture" : { 130 | "index" : 0 131 | }, 132 | "metallicFactor" : 0, 133 | "roughnessFactor" : 0.4000000059604645 134 | } 135 | } 136 | ], 137 | "meshes" : [ 138 | { 139 | "name" : "Cube", 140 | "primitives" : [ 141 | { 142 | "attributes" : { 143 | "POSITION" : 0, 144 | "NORMAL" : 1, 145 | "TEXCOORD_0" : 2 146 | }, 147 | "indices" : 3, 148 | "material" : 0 149 | } 150 | ] 151 | } 152 | ], 153 | "textures" : [ 154 | { 155 | "sampler" : 0, 156 | "source" : 0 157 | } 158 | ], 159 | "images" : [ 160 | { 161 | "bufferView" : 4, 162 | "mimeType" : "image/png", 163 | "name" : "simple-texture" 164 | } 165 | ], 166 | "accessors" : [ 167 | { 168 | "bufferView" : 0, 169 | "componentType" : 5126, 170 | "count" : 24, 171 | "max" : [ 172 | 1, 173 | 1, 174 | 1 175 | ], 176 | "min" : [ 177 | -1, 178 | -1, 179 | -1 180 | ], 181 | "type" : "VEC3" 182 | }, 183 | { 184 | "bufferView" : 1, 185 | "componentType" : 5126, 186 | "count" : 24, 187 | "type" : "VEC3" 188 | }, 189 | { 190 | "bufferView" : 2, 191 | "componentType" : 5126, 192 | "count" : 24, 193 | "type" : "VEC2" 194 | }, 195 | { 196 | "bufferView" : 3, 197 | "componentType" : 5123, 198 | "count" : 36, 199 | "type" : "SCALAR" 200 | } 201 | ], 202 | "bufferViews" : [ 203 | { 204 | "buffer" : 0, 205 | "byteLength" : 288, 206 | "byteOffset" : 0 207 | }, 208 | { 209 | "buffer" : 0, 210 | "byteLength" : 288, 211 | "byteOffset" : 288 212 | }, 213 | { 214 | "buffer" : 0, 215 | "byteLength" : 192, 216 | "byteOffset" : 576 217 | }, 218 | { 219 | "buffer" : 0, 220 | "byteLength" : 72, 221 | "byteOffset" : 768 222 | }, 223 | { 224 | "buffer" : 0, 225 | "byteLength" : 698, 226 | "byteOffset" : 840 227 | } 228 | ], 229 | "samplers" : [ 230 | { 231 | "magFilter" : 9728, 232 | "minFilter" : 9984 233 | } 234 | ], 235 | "buffers" : [ 236 | { 237 | "byteLength" : 1540, 238 | "uri" : "data:application/octet-stream;base64,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" 239 | } 240 | ] 241 | } 242 | --------------------------------------------------------------------------------