Created
January 23, 2016 14:21
-
-
Save FlorianCassayre/627df0037820f7df5444 to your computer and use it in GitHub Desktop.
Fractals generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by https://www.gitignore.io/api/intellij | |
### Intellij ### | |
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | |
*.iml | |
## Directory-based project format: | |
.idea/ | |
# if you remove the above rule, at least ignore the following: | |
# User-specific stuff: | |
# .idea/workspace.xml | |
# .idea/tasks.xml | |
# .idea/dictionaries | |
# .idea/shelf | |
# Sensitive or high-churn files: | |
# .idea/dataSources.ids | |
# .idea/dataSources.xml | |
# .idea/sqlDataSources.xml | |
# .idea/dynamic.xml | |
# .idea/uiDesigner.xml | |
# Gradle: | |
# .idea/gradle.xml | |
# .idea/libraries | |
# Mongo Explorer plugin: | |
# .idea/mongoSettings.xml | |
## File-based project format: | |
*.ipr | |
*.iws | |
## Plugin-specific files: | |
# IntelliJ | |
/out/ | |
# mpeltonen/sbt-idea plugin | |
.idea_modules/ | |
# JIRA plugin | |
atlassian-ide-plugin.xml | |
# Crashlytics plugin (for Android Studio and IntelliJ) | |
com_crashlytics_export_strings.xml | |
crashlytics.properties | |
crashlytics-build.properties | |
fabric.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fractals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CompilerConfiguration"> | |
<option name="DEFAULT_COMPILER" value="Javac" /> | |
<resourceExtensions /> | |
<wildcardResourcePatterns> | |
<entry name="!?*.java" /> | |
<entry name="!?*.form" /> | |
<entry name="!?*.class" /> | |
<entry name="!?*.groovy" /> | |
<entry name="!?*.scala" /> | |
<entry name="!?*.flex" /> | |
<entry name="!?*.kt" /> | |
<entry name="!?*.clj" /> | |
<entry name="!?*.aj" /> | |
</wildcardResourcePatterns> | |
<annotationProcessing> | |
<profile default="true" name="Default" enabled="false"> | |
<processorPath useClasspath="true" /> | |
</profile> | |
<profile default="false" name="Maven default annotation processors profile" enabled="true"> | |
<sourceOutputDir name="target/generated-sources/annotations" /> | |
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | |
<outputRelativeToContentRoot value="true" /> | |
<processorPath useClasspath="true" /> | |
<module name="Fractals" /> | |
</profile> | |
</annotationProcessing> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="CopyrightManager"> | |
<settings default="" /> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="CompilerConfiguration"> | |
<option name="DEFAULT_COMPILER" /> | |
<resourceExtensions /> | |
<wildcardResourcePatterns> | |
<entry name="!?*.java" /> | |
<entry name="!?*.form" /> | |
<entry name="!?*.class" /> | |
<entry name="!?*.groovy" /> | |
<entry name="!?*.scala" /> | |
<entry name="!?*.flex" /> | |
<entry name="!?*.kt" /> | |
<entry name="!?*.clj" /> | |
<entry name="!?*.aj" /> | |
</wildcardResourcePatterns> | |
<annotationProcessing> | |
<profile default="true" name="Default" enabled="false"> | |
<processorPath useClasspath="true" /> | |
</profile> | |
</annotationProcessing> | |
</component> | |
<component name="CopyrightManager" default="" /> | |
<component name="DaemonCodeAnalyzer"> | |
<disable_hints /> | |
</component> | |
<component name="DependencyValidationManager"> | |
<option name="SKIP_IMPORT_STATEMENTS" value="false" /> | |
</component> | |
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" /> | |
<component name="EntryPointsManager"> | |
<entry_points version="2.0" /> | |
</component> | |
<component name="IdProvider" IDEtalkID="88DBCCE2B6AAB27313C8C82ADC098B30" /> | |
<component name="MavenProjectsManager"> | |
<option name="originalFiles"> | |
<list> | |
<option value="$PROJECT_DIR$/pom.xml" /> | |
</list> | |
</option> | |
</component> | |
<component name="ProjectLevelVcsManager" settingsEditedManually="false"> | |
<OptionsSetting value="true" id="Add" /> | |
<OptionsSetting value="true" id="Remove" /> | |
<OptionsSetting value="true" id="Checkout" /> | |
<OptionsSetting value="true" id="Update" /> | |
<OptionsSetting value="true" id="Status" /> | |
<OptionsSetting value="true" id="Edit" /> | |
<ConfirmationsSetting value="0" id="Add" /> | |
<ConfirmationsSetting value="0" id="Remove" /> | |
</component> | |
<component name="ProjectModuleManager"> | |
<modules /> | |
</component> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
<component name="PropertiesComponent"> | |
<property name="GoToClass.includeLibraries" value="false" /> | |
<property name="GoToClass.toSaveIncludeLibraries" value="false" /> | |
<property name="GoToFile.includeJavaFiles" value="false" /> | |
<property name="MemberChooser.sorted" value="false" /> | |
<property name="MemberChooser.showClasses" value="true" /> | |
<property name="MemberChooser.copyJavadoc" value="false" /> | |
</component> | |
<component name="RunManager"> | |
<configuration default="true" type="JUnit" factoryName="JUnit"> | |
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> | |
<module name="" /> | |
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> | |
<option name="ALTERNATIVE_JRE_PATH" /> | |
<option name="PACKAGE_NAME" /> | |
<option name="MAIN_CLASS_NAME" /> | |
<option name="METHOD_NAME" /> | |
<option name="TEST_OBJECT" value="class" /> | |
<option name="VM_PARAMETERS" value="-ea" /> | |
<option name="PARAMETERS" /> | |
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> | |
<option name="ENV_VARIABLES" /> | |
<option name="PASS_PARENT_ENVS" value="true" /> | |
<option name="TEST_SEARCH_SCOPE"> | |
<value defaultName="singleModule" /> | |
</option> | |
<envs /> | |
<patterns /> | |
<method /> | |
</configuration> | |
<configuration default="true" type="Remote" factoryName="Remote"> | |
<option name="USE_SOCKET_TRANSPORT" value="true" /> | |
<option name="SERVER_MODE" value="false" /> | |
<option name="SHMEM_ADDRESS" value="javadebug" /> | |
<option name="HOST" value="localhost" /> | |
<option name="PORT" value="5005" /> | |
<method /> | |
</configuration> | |
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin"> | |
<module name="" /> | |
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" /> | |
<option name="PROGRAM_PARAMETERS" /> | |
<method /> | |
</configuration> | |
<configuration default="true" type="Applet" factoryName="Applet"> | |
<module name="" /> | |
<option name="MAIN_CLASS_NAME" /> | |
<option name="HTML_FILE_NAME" /> | |
<option name="HTML_USED" value="false" /> | |
<option name="WIDTH" value="400" /> | |
<option name="HEIGHT" value="300" /> | |
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> | |
<option name="VM_PARAMETERS" /> | |
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> | |
<option name="ALTERNATIVE_JRE_PATH" /> | |
<method /> | |
</configuration> | |
<configuration default="true" type="Application" factoryName="Application"> | |
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> | |
<option name="MAIN_CLASS_NAME" /> | |
<option name="VM_PARAMETERS" /> | |
<option name="PROGRAM_PARAMETERS" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | |
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> | |
<option name="ALTERNATIVE_JRE_PATH" /> | |
<option name="ENABLE_SWING_INSPECTOR" value="false" /> | |
<option name="ENV_VARIABLES" /> | |
<option name="PASS_PARENT_ENVS" value="true" /> | |
<module name="" /> | |
<envs /> | |
<method /> | |
</configuration> | |
<configuration default="true" type="TestNG" factoryName="TestNG"> | |
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> | |
<module name="" /> | |
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> | |
<option name="ALTERNATIVE_JRE_PATH" /> | |
<option name="SUITE_NAME" /> | |
<option name="PACKAGE_NAME" /> | |
<option name="MAIN_CLASS_NAME" /> | |
<option name="METHOD_NAME" /> | |
<option name="GROUP_NAME" /> | |
<option name="TEST_OBJECT" value="CLASS" /> | |
<option name="VM_PARAMETERS" value="-ea" /> | |
<option name="PARAMETERS" /> | |
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> | |
<option name="OUTPUT_DIRECTORY" /> | |
<option name="ANNOTATION_TYPE" /> | |
<option name="ENV_VARIABLES" /> | |
<option name="PASS_PARENT_ENVS" value="true" /> | |
<option name="TEST_SEARCH_SCOPE"> | |
<value defaultName="singleModule" /> | |
</option> | |
<option name="USE_DEFAULT_REPORTERS" value="false" /> | |
<option name="PROPERTIES_FILE" /> | |
<envs /> | |
<properties /> | |
<listeners /> | |
<method /> | |
</configuration> | |
<list size="0" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/Fractals.iml" filepath="$PROJECT_DIR$/Fractals.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="DependencyValidationManager"> | |
<state> | |
<option name="SKIP_IMPORT_STATEMENTS" value="false" /> | |
</state> | |
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="Palette2"> | |
<group name="Swing"> | |
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> | |
</item> | |
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> | |
</item> | |
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> | |
</item> | |
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> | |
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> | |
</item> | |
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> | |
<initial-values> | |
<property name="text" value="Button" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | |
<initial-values> | |
<property name="text" value="RadioButton" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> | |
<initial-values> | |
<property name="text" value="CheckBox" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> | |
<initial-values> | |
<property name="text" value="Label" /> | |
</initial-values> | |
</item> | |
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |
<preferred-size width="150" height="-1" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |
<preferred-size width="150" height="-1" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> | |
<preferred-size width="150" height="-1" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> | |
</item> | |
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> | |
<preferred-size width="150" height="50" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | |
<preferred-size width="200" height="200" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> | |
<preferred-size width="200" height="200" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | |
</item> | |
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> | |
</item> | |
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> | |
</item> | |
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> | |
</item> | |
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> | |
<preferred-size width="-1" height="20" /> | |
</default-constraints> | |
</item> | |
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> | |
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> | |
</item> | |
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> | |
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> | |
</item> | |
</group> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
<mapping directory="" vcs="" /> | |
</component> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="false"> | |
<output url="file://$MODULE_DIR$/target/classes" /> | |
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | |
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | |
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | |
<excludeFolder url="file://$MODULE_DIR$/target" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>me.cassayre.florian</groupId> | |
<artifactId>Fractals</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package layers; | |
import utils.IntCache; | |
public abstract class Layer | |
{ | |
private long mainSeed, layerSeed, chunkSeed; | |
protected Layer parent; | |
public Layer(long layerSeed) | |
{ | |
this.layerSeed = layerSeed; | |
this.layerSeed *= this.layerSeed * 6364136223846793005L + 1442695040888963407L; | |
this.layerSeed += layerSeed; | |
this.layerSeed *= this.layerSeed * 6364136223846793005L + 1442695040888963407L; | |
this.layerSeed += layerSeed; | |
this.layerSeed *= this.layerSeed * 6364136223846793005L + 1442695040888963407L; | |
this.layerSeed += layerSeed; | |
} | |
public Layer(long layerSeed, Layer parent) | |
{ | |
this(layerSeed); | |
this.parent = parent; | |
} | |
public void setMainSeed(long seed) { | |
this.mainSeed = seed; | |
if (this.parent != null) { | |
this.parent.setMainSeed(seed); | |
} | |
this.mainSeed *= this.mainSeed * 6364136223846793005L + 1442695040888963407L; | |
this.mainSeed += this.layerSeed; | |
this.mainSeed *= this.mainSeed * 6364136223846793005L + 1442695040888963407L; | |
this.mainSeed += this.layerSeed; | |
this.mainSeed *= this.mainSeed * 6364136223846793005L + 1442695040888963407L; | |
this.mainSeed += this.layerSeed; | |
} | |
public void setChunkSeed(long x, long y) { | |
this.chunkSeed = this.mainSeed; | |
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; | |
this.chunkSeed += x; | |
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; | |
this.chunkSeed += y; | |
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; | |
this.chunkSeed += x; | |
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; | |
this.chunkSeed += y; | |
} | |
protected int nextInt(int i) { | |
int rnd = (int) ((this.chunkSeed >> 24) % (long) i); | |
if (rnd < 0) { | |
rnd += i; | |
} | |
this.chunkSeed *= this.chunkSeed * 6364136223846793005L + 1442695040888963407L; | |
this.chunkSeed += this.mainSeed; | |
return rnd; | |
} | |
protected int[] copy(int[] ints) | |
{ | |
int[] array = IntCache.getArray(ints.length); | |
for(int i = 0; i < ints.length; i++) | |
array[i] = ints[i]; | |
return array; | |
} | |
public abstract int[] getInts(int x, int y, int sizeX, int sizeY); | |
public String toString(int x, int y, int sizeX, int sizeY, long seed) | |
{ | |
int[] ints = getInts(x, y, sizeX, sizeY); | |
StringBuilder builder = new StringBuilder(); | |
for(int i = 0; i < sizeX * sizeY; i++) | |
{ | |
if(i != 0 && i % sizeX == 0) | |
builder.append("\n"); | |
builder.append(ints[i]); | |
builder.append(" "); | |
} | |
builder.append("\n"); | |
return builder.toString(); | |
} | |
@Override | |
public String toString() | |
{ | |
return toString(0, 0, 16, 16, 42); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package layers; | |
import utils.IntCache; | |
public class LayerSmooth extends Layer | |
{ | |
public LayerSmooth(long layerSeed, Layer parent) | |
{ | |
super(layerSeed, parent); | |
} | |
@Override | |
public int[] getInts(int x, int y, int sizeX, int sizeY) | |
{ | |
int[] ints = parent.getInts(x << 1, y << 1, sizeX << 1, sizeY << 1); | |
int[] smooth = IntCache.getArray(sizeX, sizeY); | |
for(int x1 = 0; x1 < sizeX; x1++) | |
{ | |
for(int y1 = 0; y1 < sizeY; y1++) | |
{ | |
int rX = x1 << 1; | |
int rY = y1 << 1; | |
int total = ints[rX + rY * (sizeX << 1)] + ints[(rX + 1) + rY * (sizeX << 1)] + ints[(rX + 1) + (rY + 1) * (sizeX << 1)] + ints[rX + (rY + 1) * (sizeX << 1)]; | |
if(total >= 4) | |
{ | |
smooth[x1 + y1 * sizeX] = 1; | |
} | |
} | |
} | |
return smooth; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package layers; | |
import utils.IntCache; | |
public class LayerZoom extends Layer | |
{ | |
public LayerZoom(long layerSeed, Layer parent) | |
{ | |
super(layerSeed, parent); | |
} | |
@Override | |
public int[] getInts(int x, int y, int sizeX, int sizeY) | |
{ | |
int[] ints = parent.getInts((x >> 1) - 1, (y >> 1) - 1, 2 + (sizeX >> 1), 2 + (sizeY >> 1)); // 10 x 10 (100) | |
int[] zoom = IntCache.getArray(sizeX, sizeY); // 16 * 16 (256) | |
for(int x1 = 0; x1 < sizeX >> 1; x1++) | |
{ | |
for(int y1 = 0; y1 < sizeY >> 1; y1++) | |
{ | |
if(ints[(x1 + 1) + (y1 + 1) * (2 + (sizeX >> 1))] == 1) | |
{ | |
final int freq = 0; | |
int up = ints[(x1 + 1) + (y1 + 1 - 1) * (2 + (sizeX >> 1))]; | |
int down = ints[(x1 + 1) + (y1 + 1 + 1) * (2 + (sizeX >> 1))]; | |
int left = ints[(x1 + 1 - 1) + (y1 + 1) * (2 + (sizeX >> 1))]; | |
int right = ints[(x1 + 1 + 1) + (y1 + 1) * (2 + (sizeX >> 1))]; | |
int realX = x1 << 1; | |
int realY = y1 << 1; | |
if(up == 1 && left == 1) | |
{ | |
zoom[realX + realY * sizeX] = 1; | |
} | |
else | |
{ | |
zoom[realX + realY * sizeX] = random(realX + x, realY + y, 3 - up - left - freq); | |
} | |
if(up == 1 && right == 1) | |
{ | |
zoom[(realX + 1) + realY * sizeX] = 1; | |
} | |
else | |
{ | |
zoom[(realX + 1) + realY * sizeX] = random(realX + 1 + x, realY + y, 3 - up - right - freq); | |
} | |
if(down == 1 && left == 1) | |
{ | |
zoom[realX + (realY + 1) * sizeX] = 1; | |
} | |
else | |
{ | |
zoom[realX + (realY + 1) * sizeX] = random(realX + x, realY + 1 + y, 3 - down - left - freq); | |
} | |
if(down == 1 && right == 1) | |
{ | |
zoom[realX + 1 + (realY + 1) * sizeX] = 1; | |
} | |
else | |
{ | |
zoom[realX + 1 + (realY + 1) * sizeX] = random(realX + 1 + x, realY + 1 + y, 3 - down - right - freq); | |
} | |
} | |
} | |
} | |
return zoom; | |
} | |
protected int random(int x, int y, int frequency) | |
{ | |
this.setChunkSeed(x, y); | |
if(nextInt(frequency) == 0) | |
return 1; | |
return 0; | |
} | |
public static Layer zoom(Layer layer, long seed, int iterations) | |
{ | |
Layer zoomed = layer; | |
for(int i = 0; i < iterations; i++) | |
zoomed = new LayerZoom(seed, zoomed); | |
zoomed.setMainSeed(seed + 1); | |
return zoomed; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package layers; | |
import utils.IntCache; | |
public class MainLayer extends Layer | |
{ | |
private final int frequency; | |
public MainLayer(long layerSeed, int frequency) | |
{ | |
super(layerSeed); | |
this.frequency = frequency; | |
} | |
@Override | |
public int[] getInts(int x, int y, int sizeX, int sizeY) | |
{ | |
int[] ints = IntCache.getArray(sizeX, sizeY); | |
for(int x1 = 0; x1 < sizeX; x1++) | |
{ | |
for(int y1 = 0; y1 < sizeY; y1++) | |
{ | |
this.setChunkSeed(x + x1, y + y1); | |
if(nextInt(frequency) <= 50) | |
ints[x1 + y1 * sizeX] = 1; | |
} | |
} | |
return ints; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tests; | |
import layers.Layer; | |
import layers.LayerZoom; | |
import utils.IntCache; | |
public class CleanZoom extends LayerZoom | |
{ | |
public CleanZoom(long layerSeed, Layer parent) | |
{ | |
super(layerSeed, parent); | |
} | |
@Override | |
public int[] getInts(int x, int y, int sizeX, int sizeY) | |
{ | |
int[] ints = super.getInts(x - 1, y - 1, sizeX + 2, sizeY + 2); | |
int[] zoom = IntCache.getArray(sizeX, sizeY); | |
for(int x1 = 0; x1 < sizeX; x1++) | |
{ | |
for(int y1 = 0; y1 < sizeY; y1++) | |
{ | |
int total = 0; | |
total += ints[(x1 + 1) + (y1 + 1 + 1) * (sizeX + 2)]; | |
total += ints[(x1 + 1) + (y1 + 1 - 1) * (sizeX + 2)]; | |
total += ints[(x1 + 1 + 1) + (y1 + 1) * (sizeX + 2)]; | |
total += ints[(x1 + 1 - 1) + (y1 + 1) * (sizeX + 2)]; | |
if(total > 1) | |
zoom[x1 + y1 * sizeX] = 1; | |
} | |
} | |
return zoom; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tests; | |
import layers.Layer; | |
import layers.LayerZoom; | |
import layers.MainLayer; | |
import javax.imageio.ImageIO; | |
import java.awt.*; | |
import java.awt.image.BufferedImage; | |
import java.io.File; | |
import java.io.IOException; | |
public class Tester | |
{ | |
public static void main(String[] a) | |
{ | |
final long seed = 0; | |
MainLayer mainLayer = new MainLayer(seed, 5); | |
LayerZoom zoom = new LayerZoom(42, mainLayer); | |
LayerZoom zoom2 = new LayerZoom(42, zoom); | |
System.out.println(mainLayer); | |
System.out.println(zoom); | |
System.out.println(zoom2); | |
System.out.println(LayerZoom.zoom(mainLayer, 42, 5)); | |
draw(); | |
} | |
static void draw() | |
{ | |
final int n = 1000; | |
BufferedImage bimage = new BufferedImage(n, n, | |
BufferedImage.TYPE_BYTE_INDEXED); | |
Graphics2D g = bimage.createGraphics(); | |
Layer zoom = new CleanZoom(5, new MainLayer(42, 1000));//layers.LayerZoom.zoom(new layers.MainLayer(42, 70), 2, 2); | |
zoom = new CleanZoom(8, zoom); | |
for(int i = 0; i < 1; i++) | |
{ | |
zoom = new LayerZoom(i, zoom); | |
zoom = new CleanZoom(i, zoom); | |
//zoom = new layers.LayerZoom(1, zoom); | |
//zoom = new layers.LayerSmooth(2, zoom); | |
//zoom = new layers.LayerZoom(1, zoom); | |
} | |
//layers.Layer zoom = layers.LayerZoom.zoom(new layers.MainLayer(42, 2), 2, 5); | |
//layers.Layer smooth = new layers.LayerSmooth(654, zoom); | |
zoom.setMainSeed(200); | |
int[] ints = zoom.getInts(0, 0, n, n); | |
for(int x = 0; x < n; x++) | |
{ | |
for(int y = 0; y < n; y++) | |
{ | |
g.setColor(ints[x + y * n] == 0 ? Color.WHITE : Color.BLACK); | |
g.fillRect(x, y, 1, 1); | |
} | |
} | |
saveImage(bimage, "E:/fractales.png"); | |
/*g.setColor(Color.WHITE); | |
g.fillRect(0, 0, n, n); | |
ints = zoom.getInts(0 - 10, 0, n, n); | |
for(int x = 0; x < n; x++) | |
{ | |
for(int y = 0; y < n; y++) | |
{ | |
g.setColor(ints[x + y * n] == 0 ? Color.WHITE : Color.BLACK); | |
g.fillRect(x, y, 1, 1); | |
} | |
} | |
saveImage(bimage, "E:/fractales2.png");*/ | |
} | |
public static void saveImage(BufferedImage image, String path) | |
{ | |
File outputfile = new File(path); | |
try | |
{ | |
ImageIO.write(image, "png", outputfile); | |
} catch(IOException e) | |
{ | |
e.printStackTrace(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils; | |
public class IntCache | |
{ | |
public static int[] getArray(int sizeX, int sizeY) | |
{ | |
return new int[sizeX * sizeY]; | |
} | |
public static int[] getArray(int size) | |
{ | |
return getArray(size, size); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment