Compare commits
5 Commits
treemaps-c
...
intervaltr
Author | SHA1 | Date |
---|---|---|
EmaMaker | 23b9a9978e | |
EmaMaker | f1f2d57fde | |
EmaMaker | 37b7d673da | |
EmaMaker | 53cbce0b8e | |
EmaMaker | 51837f5adf |
|
@ -1,4 +1,8 @@
|
|||
.idea
|
||||
.vscode
|
||||
.gradle
|
||||
bin/**
|
||||
bin
|
||||
bin/**/*
|
||||
bin
|
||||
build/**/*
|
||||
hs_*
|
||||
out
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
|
@ -0,0 +1 @@
|
|||
Voxel
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenRepo" />
|
||||
<option name="name" value="MavenRepo" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenLocal" />
|
||||
<option name="name" value="MavenLocal" />
|
||||
<option name="url" value="file:$MAVEN_REPOSITORY$" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.jar" beforeDir="false" afterPath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.jar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.properties" beforeDir="false" afterPath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gradlew.bat" beforeDir="false" afterPath="$PROJECT_DIR$/gradlew.bat" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.bat" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.bat" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.command" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.command" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/settings.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/settings.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/Voxel.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/Voxel.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/Interval.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/Interval.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/IntervalTree.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/IntervalTree.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/renderer/ChunkRenderer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/renderer/ChunkRenderer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Utils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/Chunk.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/Chunk.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/WorldManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/WorldManager.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/blocks/Blocks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/blocks/Blocks.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Interface/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Interface/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/MatDefs/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/MatDefs/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Materials/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Materials/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Models/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Models/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Scenes/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Scenes/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Shaders/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Shaders/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Sounds/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Sounds/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Textures/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Textures/empty" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2DMUDc1tA9MP3T1Dy5SIqtjVcJl" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"last_opened_file_path": "/home/emamaker/Projects/voxel-engines/voxel-test-interval-trees-jme3",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Voxel" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.emamaker.voxeltest.intervaltrees.Voxel" />
|
||||
<module name="Voxel.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.emamaker.voxeltest.intervaltrees.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Voxel" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="" />
|
||||
<created>1660508329176</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1660508329176</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,94 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.jar" beforeDir="false" afterPath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.jar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.properties" beforeDir="false" afterPath="$PROJECT_DIR$/gradle/wrapper/gradle-wrapper.properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/gradlew.bat" beforeDir="false" afterPath="$PROJECT_DIR$/gradlew.bat" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.bat" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.bat" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.command" beforeDir="false" afterPath="$PROJECT_DIR$/scripts/desktopDeployment/Voxel.command" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/settings.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/settings.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/Voxel.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/Voxel.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/Interval.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/Interval.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/IntervalTree.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/data/IntervalTree.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/renderer/ChunkRenderer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/renderer/ChunkRenderer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Utils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/Chunk.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/Chunk.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/WorldManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/WorldManager.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/blocks/Blocks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/blocks/Blocks.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Interface/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Interface/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/MatDefs/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/MatDefs/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Materials/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Materials/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Models/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Models/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Scenes/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Scenes/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Shaders/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Shaders/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Sounds/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Sounds/empty" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/Textures/empty" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/Textures/empty" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2DMUDc1tA9MP3T1Dy5SIqtjVcJl" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"last_opened_file_path": "/home/emamaker/Projects/voxel-engines/voxel-test-interval-trees-jme3",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Voxel" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.emamaker.voxeltest.intervaltrees.Voxel" />
|
||||
<module name="Voxel.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.emamaker.voxeltest.intervaltrees.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Voxel" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="" />
|
||||
<created>1660508329176</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1660508329176</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2DMUDc1tA9MP3T1Dy5SIqtjVcJl" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"last_opened_file_path": "/home/emamaker/Projects/voxel-engines/voxel-test-interval-trees-jme3",
|
||||
"settings.editor.selected.configurable": "editor.preferences.fonts.default"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Voxel" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.emamaker.voxeltest.intervaltrees.Voxel" />
|
||||
<module name="Voxel.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.emamaker.voxeltest.intervaltrees.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Voxel" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="" />
|
||||
<created>1660508329176</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1660508329176</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/WorldManager.java</url>
|
||||
<line>81</line>
|
||||
<option name="timeStamp" value="2" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/utils/Config.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2DMUDc1tA9MP3T1Dy5SIqtjVcJl" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"last_opened_file_path": "/home/emamaker/Projects/voxel-engines/voxel-test-interval-trees-jme3",
|
||||
"settings.editor.selected.configurable": "editor.preferences.fonts.default"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Voxel" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.emamaker.voxeltest.intervaltrees.Voxel" />
|
||||
<module name="Voxel.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.emamaker.voxeltest.intervaltrees.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Voxel" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="4278855e-9616-4151-87cc-faf088cca663" name="Changes" comment="" />
|
||||
<created>1660508329176</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1660508329176</updated>
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/emamaker/voxeltest/intervaltrees/world/WorldManager.java</url>
|
||||
<line>81</line>
|
||||
<option name="timeStamp" value="2" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
<select />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1 @@
|
|||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,7 @@ package com.emamaker.voxeltest.intervaltrees;
|
|||
|
||||
import com.emamaker.voxeltest.intervaltrees.utils.Config;
|
||||
import com.emamaker.voxeltest.intervaltrees.world.WorldManager;
|
||||
import com.emamaker.voxeltest.intervaltrees.world.blocks.Blocks;
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
|
@ -15,36 +16,36 @@ import com.jme3.util.BufferUtils;
|
|||
public class Voxel extends SimpleApplication {
|
||||
|
||||
WorldManager worldManager = new WorldManager(this);
|
||||
Vector3f oldCamPos = new Vector3f(), pos = new Vector3f();
|
||||
public Vector3f oldCamPos = new Vector3f(), pos = new Vector3f();
|
||||
|
||||
public static void main(String[] args) {
|
||||
Voxel app = new Voxel();
|
||||
app.setShowSettings(false); // Settings dialog not supported on mac
|
||||
app.setShowSettings(true); // Settings dialog not supported on mac
|
||||
app.start();
|
||||
|
||||
BufferUtils.setTrackDirectMemoryEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleInitApp() {
|
||||
getFlyByCamera().setMoveSpeed(20f);
|
||||
getCamera().setLocation(new Vector3f(32f, 32f, 32f));
|
||||
getFlyByCamera().setMoveSpeed(40f);
|
||||
getCamera().setLocation(new Vector3f(Config.RENDER_DISTANCE, Config.RENDER_DISTANCE, Config.RENDER_DISTANCE).mult(Config.CHUNK_SIZE));
|
||||
getCamera().lookAt(new Vector3f(Config.CHUNK_SIZE,Config.CHUNK_SIZE, Config.CHUNK_SIZE), Vector3f.UNIT_Y);
|
||||
|
||||
pos.set(this.getCamera().getLocation());
|
||||
worldManager.initWorld();
|
||||
worldManager.render();
|
||||
// worldManager.benchmark();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleUpdate(float tpf) {
|
||||
pos.set(this.getCamera().getLocation());
|
||||
// if (!(pos.equals(oldCamPos))) System.out.println(pos);
|
||||
oldCamPos.set(pos);
|
||||
}
|
||||
|
||||
worldManager.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void simpleRender(RenderManager rm) {
|
||||
// add render code here (if any)
|
||||
worldManager.render();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,99 +1,25 @@
|
|||
package com.emamaker.voxeltest.intervaltrees.renderer;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
import com.emamaker.voxeltest.intervaltrees.data.IntervalTree;
|
||||
import com.emamaker.voxeltest.intervaltrees.utils.Config;
|
||||
import com.emamaker.voxeltest.intervaltrees.world.Chunk;
|
||||
import com.emamaker.voxeltest.intervaltrees.world.WorldManager;
|
||||
import com.emamaker.voxeltest.intervaltrees.world.blocks.Blocks;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.FaceCullMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Mesh;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.VertexBuffer.Type;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.util.BufferUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ChunkRenderer {
|
||||
|
||||
// Just render a full cube for every block
|
||||
public void stupidMeshing(WorldManager mgr, Chunk chunk) {
|
||||
// Breadth-first visit each node of the tree
|
||||
chunk.blocks.print();
|
||||
|
||||
Queue<IntervalTree<Blocks>.TreeNode> queue = new ArrayDeque<>();
|
||||
queue.add(chunk.blocks.getRoot());
|
||||
|
||||
IntervalTree<Blocks>.TreeNode t;
|
||||
Box b;
|
||||
Geometry geom;
|
||||
Material mat;
|
||||
int[] coords1, coords2;
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
t = queue.poll();
|
||||
if (t.getLeft() != null)
|
||||
queue.add(t.getLeft());
|
||||
if (t.getRight() != null)
|
||||
queue.add(t.getRight());
|
||||
|
||||
if (!t.getValue().equals(Blocks.AIR)) {
|
||||
|
||||
int start = t.getInterval().getLow();
|
||||
for (int i = t.getInterval().getLow(); i <= t.getInterval().getHigh(); i++) {
|
||||
|
||||
if ((i % Config.CHUNK_SIZE == 0 && i != t.getInterval().getLow())
|
||||
|| i == t.getInterval().getHigh()) {
|
||||
if (i == t.getInterval().getHigh())
|
||||
i++;
|
||||
b = new Box((i - start) * 0.5f, 0.5f, 0.5f);
|
||||
|
||||
geom = new Geometry("Box", b);
|
||||
mat = new Material(mgr.game.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
mat.getAdditionalRenderState().setWireframe(true);
|
||||
geom.setMaterial(mat);
|
||||
|
||||
coords1 = Chunk.coord1DTo3D(start);
|
||||
coords2 = Chunk.coord1DTo3D(i);
|
||||
|
||||
geom.getLocalTransform().setTranslation(coords1[0] + b.xExtent, coords1[1] + b.yExtent,
|
||||
coords1[2] + b.zExtent);
|
||||
System.out.println(Arrays.toString(coords1) + "-" + Arrays.toString(coords2)
|
||||
+ "\t\tBox with extext " + b.xExtent + " (both directions) with center"
|
||||
+ geom.getLocalTransform().getTranslation());
|
||||
|
||||
chunk.chunkNode.attachChild(geom);
|
||||
|
||||
if (t.getValue() == Blocks.DIRT) {
|
||||
mat.setColor("Color", ColorRGBA.Brown);
|
||||
} else if (t.getValue() == Blocks.STONE) {
|
||||
mat.setColor("Color", ColorRGBA.Gray);
|
||||
} else if (t.getValue() == Blocks.GRASS) {
|
||||
mat.setColor("Color", ColorRGBA.Green);
|
||||
}
|
||||
|
||||
start = i;
|
||||
}
|
||||
}
|
||||
|
||||
// System.out.println("Placing a box long " + b.xExtent + " at "
|
||||
// + Arrays.toString(coords));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Blocks[] blocks;
|
||||
public void stupidArrayMeshing(WorldManager mgr, Chunk chunk) {
|
||||
Blocks[] blocks = chunk.treeTo1DArray();
|
||||
blocks = chunk.treeTo1DArray();
|
||||
|
||||
int idx;
|
||||
for (int i = 0; i < Config.CHUNK_SIZE; i++) {
|
||||
|
@ -149,21 +75,22 @@ public class ChunkRenderer {
|
|||
* containing all the quads. In the future, maybe traslucent blocks and liquids
|
||||
* will need a separate mesh, but still on a per-chunk basis
|
||||
*/
|
||||
Vector3f[] vertices = new Vector3f[Config.CHUNK_3DCOORD_MAX_INDEX + 1];
|
||||
float[] colors = new float[(Config.CHUNK_3DCOORD_MAX_INDEX + 1) * 4];
|
||||
short[] indices = new short[(Config.CHUNK_3DCOORD_MAX_INDEX + 1) * 4];
|
||||
Vector3f[] vertices = new Vector3f[(Config.CHUNK_3DCOORD_MAX_INDEX + 1) * 8];
|
||||
float[] colors = new float[(Config.CHUNK_3DCOORD_MAX_INDEX + 1) * 8];
|
||||
short[] indices = new short[(Config.CHUNK_3DCOORD_MAX_INDEX + 1) * 8];
|
||||
|
||||
short vIndex = 0;
|
||||
short iIndex = 0;
|
||||
short cIndex = 0;
|
||||
|
||||
public void greedyMeshing(WorldManager mgr, Chunk chunk) {
|
||||
|
||||
vIndex = 0;
|
||||
iIndex = 0;
|
||||
cIndex = 0;
|
||||
|
||||
// convert tree to array since it is easier to work with it
|
||||
Blocks[] blocks = chunk.treeTo1DArray();
|
||||
blocks = chunk.treeTo1DArray();
|
||||
|
||||
// System.out.println(Arrays.toString(blocks));
|
||||
|
||||
|
@ -328,10 +255,10 @@ public class ChunkRenderer {
|
|||
|
||||
// System.out.println(vIndex + ", " + iIndex);
|
||||
|
||||
vertices[vIndex] = bottomLeft;
|
||||
vertices[vIndex + 1] = bottomRight;
|
||||
vertices[vIndex + 2] = topLeft;
|
||||
vertices[vIndex + 3] = topRight;
|
||||
vertices[vIndex] = bottomLeft.mult(Config.VOXEL_SIZE);
|
||||
vertices[vIndex + 1] = bottomRight.mult(Config.VOXEL_SIZE);
|
||||
vertices[vIndex + 2] = topLeft.mult(Config.VOXEL_SIZE);
|
||||
vertices[vIndex + 3] = topRight.mult(Config.VOXEL_SIZE);
|
||||
|
||||
if (backFace) {
|
||||
indices[iIndex] = (short) (vIndex + 2);
|
||||
|
|
|
@ -8,5 +8,8 @@ public class Config {
|
|||
public static int CHUNK_SIZE = 16;
|
||||
// return x + maxX * (y + z * maxY);
|
||||
public static int CHUNK_3DCOORD_MAX_INDEX = (CHUNK_SIZE-1) + CHUNK_SIZE * ( (CHUNK_SIZE - 1) + (CHUNK_SIZE - 1) * CHUNK_SIZE);
|
||||
public static int RENDER_DISTANCE = 8;
|
||||
public static int VOXEL_SIZE = 1 ;
|
||||
public static int CHUNK_LENGTH = CHUNK_SIZE * VOXEL_SIZE;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package com.emamaker.voxeltest.intervaltrees.utils;
|
||||
|
||||
public class Utils {
|
||||
|
||||
|
||||
public static boolean withinDistance(int startx, int starty, int startz, int x, int y, int z, int dist) {
|
||||
return (x-startx)*(x-startx) + (y - starty)*(y-starty) + (z-startz)*(z-startz) <= dist*dist;
|
||||
}
|
||||
// https://stackoverflow.com/questions/20266201/3d-array-1d-flat-indexing
|
||||
//flatten 3d coords to 1d array cords
|
||||
public static int coord3DTo1D (int x, int y, int z, int maxX, int maxY, int maxZ){
|
||||
|
|
|
@ -16,20 +16,42 @@ import com.jme3.scene.Node;
|
|||
|
||||
public class Chunk {
|
||||
|
||||
Vector3f pos;
|
||||
public IntervalTree<Blocks> blocks = new IntervalTree<Blocks>();
|
||||
public int posx, posy, posz;
|
||||
public Node chunkNode = new Node();
|
||||
|
||||
// A bit field representing the state of the chunk, where each bit is an operation done on the chunk
|
||||
private byte state = 0;
|
||||
// Convenient access to the bit field, each state is the position in the byte (0 is LSB)
|
||||
public static byte CHUNK_STATE_GENERATED = 1;
|
||||
public static byte CHUNK_STATE_MESHED = 2;
|
||||
public static byte CHUNK_STATE_LOADED = 4;
|
||||
public Chunk() {
|
||||
this(Vector3f.ZERO);
|
||||
this(0,0,0);
|
||||
}
|
||||
|
||||
public Chunk(Vector3f pos_) {
|
||||
public Chunk(int x_, int y_, int z_) {
|
||||
this.posx = x_;
|
||||
this.posy = y_;
|
||||
this.posz = z_;
|
||||
chunkNode.setLocalTranslation(posx, posy, posz);
|
||||
chunkNode.setLocalTranslation(chunkNode.getLocalTranslation().mult(Config.CHUNK_SIZE).mult(Config.VOXEL_SIZE));
|
||||
|
||||
// I still have to decided if this is necessary. With an empty tree this
|
||||
// takes O(1)
|
||||
blocks.insertValue(Blocks.AIR, new Interval(0, Config.CHUNK_3DCOORD_MAX_INDEX));
|
||||
}
|
||||
|
||||
public void setState(byte nstate, boolean value){
|
||||
if(value) state |= nstate;
|
||||
else state &= ~nstate;
|
||||
}
|
||||
|
||||
public boolean bgetState(byte nstate){
|
||||
return (state & nstate) != 0;
|
||||
}
|
||||
public int getState(byte nstate){
|
||||
return state & nstate;
|
||||
}
|
||||
public static int coord3DTo1D(int x, int y, int z) {
|
||||
return Utils.coord3DTo1D(x, y, z, Config.CHUNK_SIZE, Config.CHUNK_SIZE, Config.CHUNK_SIZE);
|
||||
}
|
||||
|
|
|
@ -1,42 +1,117 @@
|
|||
package com.emamaker.voxeltest.intervaltrees.world;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
|
||||
import com.emamaker.voxeltest.intervaltrees.Voxel;
|
||||
import com.emamaker.voxeltest.intervaltrees.renderer.ChunkRenderer;
|
||||
import com.emamaker.voxeltest.intervaltrees.utils.Config;
|
||||
import com.emamaker.voxeltest.intervaltrees.utils.Utils;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Node;
|
||||
|
||||
public class WorldManager {
|
||||
|
||||
public final Voxel game;
|
||||
public final Voxel game;
|
||||
|
||||
public int camx, camy, camz;
|
||||
|
||||
ChunkRenderer chunkRenderer = new ChunkRenderer();
|
||||
|
||||
HashMap<Vector3f, Chunk> chunks = new HashMap<>();
|
||||
Queue<Chunk> chunkToModel = new ArrayDeque();
|
||||
ArrayList<Chunk> chunksToRender = new ArrayList<>();
|
||||
Node worldNode = new Node();
|
||||
|
||||
ConcurrentHashMap<String, Chunk> chunks = new ConcurrentHashMap<>();
|
||||
|
||||
public WorldManager(final Voxel game_) {
|
||||
this.game = game_;
|
||||
}
|
||||
|
||||
public void initWorld() {
|
||||
chunks.put(Vector3f.ZERO, new Chunk());
|
||||
chunks.get(Vector3f.ZERO).arrayGenerateCorner();
|
||||
|
||||
chunkToModel.add(chunks.get(Vector3f.ZERO));
|
||||
}
|
||||
|
||||
public void render() {
|
||||
for (Chunk c : chunkToModel) {
|
||||
// chunkRenderer.stupidArrayMeshing(this, c);
|
||||
chunkRenderer.greedyMeshing(this, c);
|
||||
|
||||
game.getRootNode().attachChild(c.chunkNode);
|
||||
String s;
|
||||
int chunkX, chunkY, chunkZ;
|
||||
public boolean generated = false, meshed = false;
|
||||
|
||||
public void update() {
|
||||
camx = (int) (game.pos.getX());
|
||||
camy = (int) (game.pos.getY());
|
||||
camz = (int) (game.pos.getZ());
|
||||
|
||||
// // clamp to "chunk" coordinates
|
||||
// // The chunk with origin at x,y,z in chunk coords actually has the origin at
|
||||
// x*chunksize, y*chunksize, z*chunksize in world coords
|
||||
chunkX = (int) (camx / Config.CHUNK_LENGTH);
|
||||
chunkY = (int) (camy / Config.CHUNK_LENGTH);
|
||||
chunkZ = (int) (camz / Config.CHUNK_LENGTH);
|
||||
|
||||
// System.out.println("camera at" + game.pos + new Vector3f(chunkX, chunkY,
|
||||
// chunkZ));
|
||||
|
||||
for (int i = Math.max(0, chunkX - Config.RENDER_DISTANCE); i < chunkX + Config.RENDER_DISTANCE; i++) {
|
||||
for (int j = Math.max(0, chunkY - Config.RENDER_DISTANCE); j < chunkY + Config.RENDER_DISTANCE; j++) {
|
||||
// for (int j = Math.max(0,chunkY - Config.RENDER_DISTANCE); j < chunkY +
|
||||
// Config.RENDER_DISTANCE; j++) {
|
||||
for (int k = Math.max(0, chunkZ - Config.RENDER_DISTANCE); k < chunkZ + Config.RENDER_DISTANCE; k++) {
|
||||
if(!Utils.withinDistance(chunkX, chunkY, chunkZ, i,j,k,Config.RENDER_DISTANCE)) continue;
|
||||
|
||||
s = i + "," + j + "," + k;
|
||||
if (!chunks.containsKey(s)) chunks.put(s, new Chunk(i,j,k));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
generated = false;
|
||||
meshed = false;
|
||||
for(Chunk c : chunks.values()){
|
||||
if(!generated && !c.bgetState(Chunk.CHUNK_STATE_GENERATED)) {
|
||||
c.arrayGenerateCorner();
|
||||
c.setState(Chunk.CHUNK_STATE_GENERATED, true);
|
||||
generated = true;
|
||||
}
|
||||
if(!meshed && c.bgetState(Chunk.CHUNK_STATE_GENERATED)&& !c.bgetState(Chunk.CHUNK_STATE_MESHED)) {
|
||||
chunkRenderer.greedyMeshing(this, c);
|
||||
c.setState(Chunk.CHUNK_STATE_MESHED, true);
|
||||
meshed = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!generated && ! meshed) System.out.println("Finished world generation");
|
||||
|
||||
}
|
||||
public void render(){
|
||||
for(Chunk c : chunks.values()){
|
||||
if(!c.bgetState(Chunk.CHUNK_STATE_LOADED) && c.bgetState(Chunk.CHUNK_STATE_GENERATED) && c.bgetState(Chunk.CHUNK_STATE_MESHED)){
|
||||
game.getRootNode().attachChild(c.chunkNode);
|
||||
c.setState(Chunk.CHUNK_STATE_LOADED, true);
|
||||
}
|
||||
if(!Utils.withinDistance(chunkX, chunkY, chunkZ, (int)c.posx, (int)c.posy, (int)c.posz, Config.RENDER_DISTANCE)){
|
||||
c.chunkNode.removeFromParent();
|
||||
chunks.remove(c.posx + "," + c.posy + "," + c.posz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean chunkInCameraLimits(Chunk c) {
|
||||
int vx = (int) c.posx;
|
||||
int vy = (int) c.posy;
|
||||
int vz = (int) c.posz;
|
||||
return vx >= Math.min(0, chunkX - Config.RENDER_DISTANCE ) && vx < Math.min(0, chunkX + Config.RENDER_DISTANCE) && vy >= chunkY - Config.RENDER_DISTANCE && vy < Math.min(0, chunkY + Config.RENDER_DISTANCE) && vz >= chunkZ - Config.RENDER_DISTANCE && vz < Math.min(0, chunkZ + Config.RENDER_DISTANCE);
|
||||
}
|
||||
|
||||
public void benchmark(){
|
||||
for(int i = 0; i < Config.RENDER_DISTANCE*2; i++)
|
||||
for(int j = 0; j < Config.RENDER_DISTANCE*2; j++)
|
||||
for(int k = 0; k < Config.RENDER_DISTANCE*2; k++){
|
||||
Chunk c = new Chunk(i,j,k);
|
||||
c.arrayGenerateCorner();
|
||||
chunkRenderer.greedyMeshing(this, c);
|
||||
game.getRootNode().attachChild(c.chunkNode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue