commit
5dc4978f48
|
@ -0,0 +1,13 @@
|
||||||
|
/.gradle/
|
||||||
|
/.nb-gradle/
|
||||||
|
/build/
|
||||||
|
/private/
|
||||||
|
/*.dll
|
||||||
|
/*.dylib
|
||||||
|
/*.so
|
||||||
|
|
||||||
|
#Although most of the .idea directory should not be committed there is a legitimate purpose for committing run configurations
|
||||||
|
/.idea/
|
||||||
|
!/.idea/runConfigurations/
|
||||||
|
|
||||||
|
local.properties
|
|
@ -0,0 +1,310 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
# This is the code style that should be applied to JME PRs.
|
||||||
|
# It should mirror netbeans default style.
|
||||||
|
#
|
||||||
|
# Based on Sun coding style:
|
||||||
|
# Copyright (c) 2013 NEC Corporation
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This program and the accompanying materials are made available under the
|
||||||
|
# terms of the Eclipse Public License v1.0 which accompanies this
|
||||||
|
# distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
-->
|
||||||
|
|
||||||
|
<profiles version="12">
|
||||||
|
<profile kind="CodeFormatterProfile" name="JmeCodeStyle" version="12">
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="180"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_if_on_one_line" value="true"/>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "java",
|
||||||
|
"name": "Launch Voxel",
|
||||||
|
"request": "launch",
|
||||||
|
"mainClass": "com.emamaker.voxeltest.intervaltrees.Voxel",
|
||||||
|
"osx": {
|
||||||
|
"vmArgs": "-XstartOnFirstThread -ea"
|
||||||
|
},
|
||||||
|
"vmArgs": "-ea"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
|
"java.refactor.renameFromFileExplorer": "prompt",
|
||||||
|
"java.format.settings.url": "./.vscode/JME_style.xml",
|
||||||
|
"editor.formatOnPaste": true,
|
||||||
|
"editor.formatOnType": true
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
# Voxel
|
||||||
|
|
||||||
|
This is the readme for Voxel, try to keep it up to date with any information future-you will wish past-you
|
||||||
|
remembered to write down
|
||||||
|
|
||||||
|
## Project set up
|
||||||
|
This is a gradle project using JMonkey Engine and other java libraries
|
||||||
|
|
||||||
|
## How to run (for development)
|
||||||
|
You'll want a java 11 JDK installed on your machine (Your IDE may do this for you, IntelliJ does)
|
||||||
|
|
||||||
|
Open this application in your preferred IDE (IntelliJ and Eclipse will support Gradle by default, netbeans will support it with a plugin). The remaining instructions are for IntelliJ but the basic principle will be the same for any IDE)
|
||||||
|
|
||||||
|
|
||||||
|
### Development in IntelliJ
|
||||||
|
- Download the latest version of IntelliJ Community (IntelliJ Ultimate is a paid for version the features of which you may consider useful but are not essential for a JMonkey project)
|
||||||
|
- File > Open > select the top level folder of this project ( i.e. Voxel) > Ok.
|
||||||
|
- The project will open with your project files on the left had side (IntelliJ may need to "think" for a couple of seconds before they appear)
|
||||||
|
- IntelliJ may say "No SDK set up" and prompt you to download one, follow its instructions and allow it to download a java 11 JDK. A JDK is used for compiling java applications, a JRE is used for running them.
|
||||||
|
- You can now add more java source files or assets to the project
|
||||||
|
- To run the project find Voxel.java (which will be in under src/main/java/com/emamaker/voxeltest/intervaltrees) and right click > Run 'Voxel'
|
||||||
|
|
||||||
|
## How to package the game
|
||||||
|
|
||||||
|
### Distribute without a JRE
|
||||||
|
|
||||||
|
Either:
|
||||||
|
|
||||||
|
In your IDE execute the gradle task distZip (which you'll find under gradle > distributions > distZip)
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
|
In the command line open at the root of this project enter the following command: gradlew distZip
|
||||||
|
|
||||||
|
Then you will find a zip in the build/distributions folder. This zip will contain your game, all the libraries to run it and in the bin folder launch files (for windows and linux).
|
||||||
|
|
||||||
|
Note that the distribution does not contain a JRE, so java will need to be installed on the machine of anyone you give this distribution to. Alternatively you may wish to bundle a JRE with your game to remove this requirement.
|
||||||
|
|
||||||
|
|
||||||
|
### Distribute with a JRE
|
||||||
|
|
||||||
|
Distributing with a JRE means you'll need to provide an operating specific bundle for each OS you are
|
||||||
|
targeting (which is a disadvantage) but your end use will not have to have a JRE locally installed
|
||||||
|
(which is an advantage).
|
||||||
|
|
||||||
|
Either:
|
||||||
|
|
||||||
|
In your IDE execute the gradle task distZip (which you'll find under gradle > distributions > buildAllDistributions)
|
||||||
|
|
||||||
|
Or:
|
||||||
|
|
||||||
|
In the command line open at the root of this project enter the following command: gradlew buildAllDistributions
|
||||||
|
|
||||||
|
Then you will find a series of zip in the build/distributions folder. These zip will contain your game, all the libraries to run it and an
|
||||||
|
OS specific JRE. (The same files will also be available unzipped in a folder, which may be useful if distributing via steampipe or similar).
|
||||||
|
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
You may wish to commit your project to a git repository to keep track of your changes (so you can roll back if anything goes wrong)
|
||||||
|
|
||||||
|
## Adding more libraries
|
||||||
|
During the JMonkey Initializer you chose from a small subset of the available java libraries.
|
||||||
|
You can add more by editing the dependencies section in the build.gradle file
|
||||||
|
|
||||||
|
## txt vs md
|
||||||
|
|
||||||
|
This readme is provided as a .txt as that is a common format openable on any machine. However, it would more normally be a .md, this will allow it to be nicely formatted by most git repositories (assuming you commit it to git). Just change the extension from .txt to .md, the syntax is already correct for an md file
|
|
@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,203 @@
|
||||||
|
plugins {
|
||||||
|
id 'application'
|
||||||
|
id 'java'
|
||||||
|
id "de.undercouch.download" version "5.1.0"
|
||||||
|
id 'idea'
|
||||||
|
id "io.github.0ffz.github-packages" version "1.2.1" // Plugin for anonymous inclusion of artifacts hosted in github package registry
|
||||||
|
}
|
||||||
|
|
||||||
|
description = 'Voxel application'
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = '11'
|
||||||
|
targetCompatibility = '11'
|
||||||
|
}
|
||||||
|
|
||||||
|
ext.jmonkeyengineVersion = '3.5.2-stable'
|
||||||
|
|
||||||
|
mainClassName = 'com.emamaker.voxeltest.intervaltrees.Voxel'
|
||||||
|
if (!hasProperty('mainClass')) {
|
||||||
|
ext.mainClass = mainClassName
|
||||||
|
}
|
||||||
|
jar.manifest.attributes('Main-Class': mainClassName)
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// You can read more about how to add dependencies here:
|
||||||
|
// https://docs.gradle.org/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
|
||||||
|
|
||||||
|
implementation 'org.jmonkeyengine:jme3-core:' + jmonkeyengineVersion
|
||||||
|
runtimeOnly 'org.jmonkeyengine:jme3-jogg:' + jmonkeyengineVersion
|
||||||
|
runtimeOnly 'org.jmonkeyengine:jme3-plugins:' + jmonkeyengineVersion
|
||||||
|
|
||||||
|
|
||||||
|
runtimeOnly 'org.jmonkeyengine:jme3-lwjgl3:' + jmonkeyengineVersion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
distZip {
|
||||||
|
//having a degenerate folder within the dist zip complicates generating the other zips
|
||||||
|
eachFile { file ->
|
||||||
|
String path = file.relativePath
|
||||||
|
file.setPath(path.substring(path.indexOf("/") + 1, path.length()))
|
||||||
|
}
|
||||||
|
includeEmptyDirs(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
//See https://api.adoptium.net/v3/assets/feature_releases/11/ga?image_type=jre for jre urls
|
||||||
|
def windowsJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_windows_hotspot_11.0.15_10.zip"
|
||||||
|
def linuxJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_linux_hotspot_11.0.15_10.tar.gz"
|
||||||
|
def macJreUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15%2B10/OpenJDK11U-jre_x64_mac_hotspot_11.0.15_10.tar.gz"
|
||||||
|
|
||||||
|
|
||||||
|
task downloadWindowsJre(type: Download) {
|
||||||
|
src windowsJreUrl
|
||||||
|
dest new File(buildDir, '/jres/windowsJre.zip')
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
task downloadAndUnzipWindowsJre(dependsOn: downloadWindowsJre, type: Copy) {
|
||||||
|
from zipTree(downloadWindowsJre.dest)
|
||||||
|
into "${buildDir}/jres/windowsJre/"
|
||||||
|
includeEmptyDirs(false)
|
||||||
|
filesMatching("**") {
|
||||||
|
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildWindowsDistribution(dependsOn: [distZip, downloadAndUnzipWindowsJre], type: Copy)
|
||||||
|
{
|
||||||
|
group 'distribution'
|
||||||
|
from files("${projectDir}/scripts/desktopDeployment/Voxel.bat"), zipTree(distZip.archiveFile), "${buildDir}/jres/windowsJre"
|
||||||
|
into new File(buildDir, 'distributions/Voxel-windows')
|
||||||
|
includeEmptyDirs false
|
||||||
|
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
|
||||||
|
}
|
||||||
|
|
||||||
|
task zipWindowsDistribution( dependsOn:buildWindowsDistribution, type: Zip) {
|
||||||
|
group 'distribution'
|
||||||
|
archiveFileName = "Voxel-windows.zip"
|
||||||
|
destinationDirectory = file("$buildDir/distributions")
|
||||||
|
from "$buildDir/distributions/Voxel-windows"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task downloadLinuxJre(type: Download) {
|
||||||
|
src linuxJreUrl
|
||||||
|
dest new File(buildDir, '/jres/linuxJre.tar.gz')
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
task downloadAndUnzipLinuxJre(dependsOn: downloadLinuxJre, type: Copy) {
|
||||||
|
from tarTree(downloadLinuxJre.dest)
|
||||||
|
into "${buildDir}/jres/linuxJre/"
|
||||||
|
includeEmptyDirs(false)
|
||||||
|
filesMatching("**") {
|
||||||
|
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildLinuxDistribution(dependsOn: [distZip, downloadAndUnzipLinuxJre], type: Copy)
|
||||||
|
{
|
||||||
|
group 'distribution'
|
||||||
|
from files("${projectDir}/scripts/desktopDeployment/Voxel.sh"){
|
||||||
|
fileMode 0755
|
||||||
|
}
|
||||||
|
from zipTree(distZip.archiveFile)
|
||||||
|
from "${buildDir}/jres/linuxJre"
|
||||||
|
into new File(buildDir, 'distributions/Voxel-linux')
|
||||||
|
includeEmptyDirs false
|
||||||
|
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
|
||||||
|
}
|
||||||
|
|
||||||
|
task zipLinuxDistribution( dependsOn:buildLinuxDistribution, type: Zip) {
|
||||||
|
group 'distribution'
|
||||||
|
archiveFileName = "Voxel-linux.tar.gz"
|
||||||
|
destinationDirectory = file("$buildDir/distributions")
|
||||||
|
from ("$buildDir/distributions/Voxel-linux"){
|
||||||
|
include('**.sh')
|
||||||
|
include('**/java')
|
||||||
|
fileMode 0755
|
||||||
|
}
|
||||||
|
from ("$buildDir/distributions/Voxel-linux"){
|
||||||
|
exclude('**.sh')
|
||||||
|
exclude('**/java')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task downloadMacJre(type: Download) {
|
||||||
|
src macJreUrl
|
||||||
|
dest new File(buildDir, '/jres/macJre.tar.gz')
|
||||||
|
overwrite false
|
||||||
|
}
|
||||||
|
|
||||||
|
task downloadAndUnzipMacJre(dependsOn: downloadMacJre, type: Copy) {
|
||||||
|
from tarTree(downloadMacJre.dest)
|
||||||
|
into "${buildDir}/jres/macJre/"
|
||||||
|
includeEmptyDirs(false)
|
||||||
|
filesMatching("**") {
|
||||||
|
it.path = it.path.replaceAll("^[a-zA-Z0-9.+-]*[/\\\\]", "jre/") //rename the top level to something standard so the rest of the script will be easier
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildMacDistribution(dependsOn: [distZip, downloadAndUnzipMacJre], type: Copy)
|
||||||
|
{
|
||||||
|
group 'distribution'
|
||||||
|
from files("${projectDir}/scripts/desktopDeployment/Voxel.command"){
|
||||||
|
fileMode 0755
|
||||||
|
}
|
||||||
|
from zipTree(distZip.archiveFile)
|
||||||
|
from "${buildDir}/jres/macJre"
|
||||||
|
into new File(buildDir, 'distributions/Voxel-mac')
|
||||||
|
includeEmptyDirs false
|
||||||
|
exclude 'bin/**' //we are adding our own run scripts, exclude the ones coming from distZip
|
||||||
|
}
|
||||||
|
|
||||||
|
task zipMacDistribution( dependsOn:buildMacDistribution, type: Zip) {
|
||||||
|
group 'distribution'
|
||||||
|
archiveFileName = "Voxel-mac.tar.gz"
|
||||||
|
destinationDirectory = file("$buildDir/distributions")
|
||||||
|
from ("$buildDir/distributions/Voxel-mac"){
|
||||||
|
include('**.command')
|
||||||
|
include('**/java')
|
||||||
|
fileMode 0755
|
||||||
|
}
|
||||||
|
from ("$buildDir/distributions/Voxel-mac"){
|
||||||
|
exclude('**.command')
|
||||||
|
exclude('**/java')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildAllDistributions{
|
||||||
|
group 'distribution'
|
||||||
|
dependsOn 'zipWindowsDistribution'
|
||||||
|
dependsOn 'zipLinuxDistribution'
|
||||||
|
dependsOn 'zipMacDistribution'
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup tasks
|
||||||
|
clean.dependsOn('cleanDLLs', 'cleanDyLibs', 'cleanLogs', 'cleanSOs')
|
||||||
|
task cleanDLLs(type: Delete) {
|
||||||
|
delete fileTree(dir: '.', include: '*.dll')
|
||||||
|
}
|
||||||
|
task cleanDyLibs(type: Delete) {
|
||||||
|
delete fileTree(dir: '.', include: '*.dylib')
|
||||||
|
}
|
||||||
|
task cleanLogs(type: Delete) {
|
||||||
|
delete fileTree(dir: '.', include: 'hs_err_pid*.log')
|
||||||
|
}
|
||||||
|
task cleanSOs(type: Delete) {
|
||||||
|
delete fileTree(dir: '.', include: '*.so')
|
||||||
|
}
|
||||||
|
|
||||||
|
task fund(){
|
||||||
|
doLast {
|
||||||
|
java.awt.Desktop.desktop.browse "https://start.jmonkeyengine.org/#!funding=JME_DESKTOP".toURI()
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,5 @@
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
|
@ -0,0 +1,234 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
|
@ -0,0 +1,89 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
|
@ -0,0 +1,2 @@
|
||||||
|
"jre/bin/java" -XX:MaxRAMPercentage=60 -classpath "lib/*" com.emamaker.voxeltest.intervaltrees.Voxel
|
||||||
|
exit 0
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
|
cd "${DIR}"
|
||||||
|
./jre/Contents/Home/bin/java -XX:MaxRAMPercentage=60 -XstartOnFirstThread -classpath "lib/*" com.emamaker.voxeltest.intervaltrees.Voxel
|
||||||
|
exit 0
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
jre/bin/java -XX:MaxRAMPercentage=60 -classpath "lib/*" com.emamaker.voxeltest.intervaltrees.Voxel
|
||||||
|
exit 0
|
|
@ -0,0 +1 @@
|
||||||
|
rootProject.name = 'Voxel'
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees;
|
||||||
|
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.world.WorldManager;
|
||||||
|
import com.jme3.app.SimpleApplication;
|
||||||
|
import com.jme3.font.BitmapText;
|
||||||
|
import com.jme3.renderer.RenderManager;
|
||||||
|
import com.jme3.util.BufferUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the Main Class of your Game. It should boot up your game and do initial initialisation
|
||||||
|
* Move your Logic into AppStates or Controls or other java classes
|
||||||
|
*/
|
||||||
|
public class Voxel extends SimpleApplication {
|
||||||
|
|
||||||
|
WorldManager worldManager = new WorldManager(this);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Voxel app = new Voxel();
|
||||||
|
app.setShowSettings(false); //Settings dialog not supported on mac
|
||||||
|
app.start();
|
||||||
|
|
||||||
|
BufferUtils.setTrackDirectMemoryEnabled(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleInitApp() {
|
||||||
|
getFlyByCamera().setMoveSpeed(20f);
|
||||||
|
|
||||||
|
worldManager.initWorld();
|
||||||
|
worldManager.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleUpdate(float tpf) {
|
||||||
|
// System.out.println(this.getCamera().getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void simpleRender(RenderManager rm) {
|
||||||
|
//add render code here (if any)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.data;
|
||||||
|
|
||||||
|
/* When visualizing as a 1D array, high indicates the last index with a valid position (es. if there are 10 values), the interval will be (0,9) */
|
||||||
|
|
||||||
|
public class Interval {
|
||||||
|
int low, high;
|
||||||
|
|
||||||
|
public Interval() {
|
||||||
|
set(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Interval(int low_, int high_) {
|
||||||
|
set(low_, high_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(int low_, int high_) {
|
||||||
|
this.low = low_;
|
||||||
|
this.high = high_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLow(){
|
||||||
|
return low;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHigh(){
|
||||||
|
return high;
|
||||||
|
}
|
||||||
|
public boolean isValid() {
|
||||||
|
return this.low < this.high;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return if is contained in another interval
|
||||||
|
public boolean contains(Interval i) {
|
||||||
|
return this.low <= i.low && i.high <= this.high;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if contains another interval
|
||||||
|
public boolean isContainedBy(Interval i) {
|
||||||
|
return i.contains(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean fullyLeftOf(Interval i) {
|
||||||
|
return this.high < i.low;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean fullyRightOf(Interval i) {
|
||||||
|
return this.low > i.high;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean partiallyContainsLeft(Interval i) {
|
||||||
|
return i.low < this.low && i.high >= this.low && i.high < this.high;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean partiallyContainsRight(Interval i) {
|
||||||
|
return this.high >= i.low && this.low < i.low && this.high < i.high;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[" + low + ", " + high + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,243 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class IntervalTree<V> {
|
||||||
|
|
||||||
|
TreeNode root = null;
|
||||||
|
int size = 0;
|
||||||
|
|
||||||
|
public void insertValue(V value, Interval i) {
|
||||||
|
root = insertNode(root, new TreeNode(i, value, null, null));
|
||||||
|
// if (isEmpty()) {
|
||||||
|
// root = new TreeNode(i, value, null, null);
|
||||||
|
// size++;
|
||||||
|
// } else
|
||||||
|
// insertValue(root, value, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode getRoot() {
|
||||||
|
return this.root;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For what we're doing, when we add new values that (partially) overlap old
|
||||||
|
// ones, we can't have the old ones laying around, so intervals need to be
|
||||||
|
// readjusted accordingly
|
||||||
|
// For a normal interval tree, there's no need no check for partial overrides
|
||||||
|
// Also, no values can be shared from one node to another (no limits in common, e.g. one node has the high limit that is the same as the low limit of its right child)
|
||||||
|
public TreeNode insertNode(TreeNode currentNode, TreeNode newNode) {
|
||||||
|
if (!newNode.interval.isValid()) return null;
|
||||||
|
if (currentNode == null)
|
||||||
|
return newNode;
|
||||||
|
|
||||||
|
// System.out.println(currentNode.interval.toString() +", "+
|
||||||
|
// newNode.interval.toString());
|
||||||
|
|
||||||
|
if (newNode.interval.fullyLeftOf(currentNode.interval)) {
|
||||||
|
currentNode.setLeft(insertNode(currentNode.left, newNode));
|
||||||
|
return currentNode;
|
||||||
|
} else if (newNode.interval.fullyRightOf(currentNode.interval)) {
|
||||||
|
currentNode.setRight(insertNode(currentNode.right, newNode));
|
||||||
|
return currentNode;
|
||||||
|
} else if (newNode.interval.contains(currentNode.interval)) {
|
||||||
|
// check is they carry the same value
|
||||||
|
if (newNode.value.equals(currentNode.value)) {
|
||||||
|
currentNode.interval = newNode.interval;
|
||||||
|
} else {
|
||||||
|
TreeNode newLeftNode = new TreeNode(new Interval(newNode.interval.low, currentNode.interval.low - 1),
|
||||||
|
newNode.value, currentNode.left, null);
|
||||||
|
|
||||||
|
newNode.setInterval(currentNode.interval.high + 1, newNode.interval.high);
|
||||||
|
newNode.setRight(currentNode.right);
|
||||||
|
|
||||||
|
// Important! otherwhise already existing nodes will node by replaced
|
||||||
|
currentNode.value = newNode.value;
|
||||||
|
|
||||||
|
currentNode.setLeft(newLeftNode);
|
||||||
|
currentNode.setRight(newNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
constrainIntervals(currentNode, currentNode.interval);
|
||||||
|
return currentNode;
|
||||||
|
|
||||||
|
} else if (newNode.interval.isContainedBy(currentNode.interval)) {
|
||||||
|
|
||||||
|
if (newNode.value.equals(currentNode.value)) return currentNode;
|
||||||
|
|
||||||
|
if (currentNode.interval.low < newNode.interval.low)
|
||||||
|
newNode.setLeft(new TreeNode(new Interval(currentNode.interval.low, newNode.interval.low - 1),
|
||||||
|
currentNode.value, currentNode.left, null));
|
||||||
|
else newNode.setLeft(null);
|
||||||
|
|
||||||
|
if (newNode.interval.high < currentNode.interval.high)
|
||||||
|
newNode.setRight(new TreeNode(new Interval(newNode.interval.high + 1, currentNode.interval.high),
|
||||||
|
currentNode.value, null, currentNode.right));
|
||||||
|
else
|
||||||
|
newNode.setRight(null);
|
||||||
|
|
||||||
|
return newNode;
|
||||||
|
|
||||||
|
} else if (newNode.interval.partiallyContainsLeft(currentNode.interval)) {
|
||||||
|
currentNode.setInterval(currentNode.interval.low, newNode.interval.low - 1);
|
||||||
|
|
||||||
|
newNode.setLeft(currentNode);
|
||||||
|
constrainIntervals(currentNode, currentNode.interval);
|
||||||
|
|
||||||
|
return newNode;
|
||||||
|
} else if (newNode.interval.partiallyContainsRight(currentNode.interval)) {
|
||||||
|
currentNode.setInterval(newNode.interval.high + 1, currentNode.interval.high);
|
||||||
|
|
||||||
|
newNode.setRight(currentNode);
|
||||||
|
constrainIntervals(currentNode, currentNode.interval);
|
||||||
|
return currentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("How did we get here?");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the value from n to n+1
|
||||||
|
public V getSingleValue(int n) {
|
||||||
|
return getValues(new Interval(n, n + 1)).get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<V> getValues(Interval interval) {
|
||||||
|
ArrayList<V> values = new ArrayList<>();
|
||||||
|
if (root != null && interval != null)
|
||||||
|
getValues(interval, root, values);
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getValues(Interval interval, TreeNode start, ArrayList<V> results) {
|
||||||
|
System.out.println(interval.toString() + ", " + start.toString() + ", " + Arrays.toString(results.toArray()));
|
||||||
|
|
||||||
|
if (interval.fullyLeftOf(start.interval) && start.left != null)
|
||||||
|
getValues(interval, start.left, results);
|
||||||
|
else if (interval.fullyRightOf(start.interval) && start.right != null)
|
||||||
|
getValues(interval, start.right, results);
|
||||||
|
else if (interval.isContainedBy(start.interval))
|
||||||
|
results.add(start.value); // base case
|
||||||
|
else if (interval.contains(start.interval)) {
|
||||||
|
results.add(start.value);
|
||||||
|
Interval intLeft = new Interval(interval.low, start.interval.low);
|
||||||
|
Interval intRight = new Interval(interval.high, start.interval.high);
|
||||||
|
if (start.left != null && intLeft.isValid())
|
||||||
|
getValues(intLeft, start.left, results);
|
||||||
|
if (start.right != null && intRight.isValid())
|
||||||
|
getValues(intRight, start.right, results);
|
||||||
|
} else if (interval.partiallyContainsLeft(start.interval)) {
|
||||||
|
results.add(start.value);
|
||||||
|
Interval newInt = new Interval(start.interval.high, interval.high);
|
||||||
|
if (start.right != null && newInt.isValid())
|
||||||
|
getValues(newInt, start.right, results);
|
||||||
|
} else if (interval.partiallyContainsRight(start.interval)) {
|
||||||
|
results.add(start.value);
|
||||||
|
Interval newInt = new Interval(interval.low, start.interval.low);
|
||||||
|
if (start.left != null && newInt.isValid())
|
||||||
|
getValues(newInt, start.left, results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode constrainIntervals(TreeNode start, Interval i) {
|
||||||
|
if (start == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
start.interval.high = Math.min(start.interval.high, i.high);
|
||||||
|
start.interval.low = Math.max(start.interval.low, i.low);
|
||||||
|
|
||||||
|
if (!start.interval.isValid())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (start.left != null)
|
||||||
|
start.setLeft(constrainIntervals(start.left, new Interval(start.left.interval.low, start.interval.low)));
|
||||||
|
if (start.right != null)
|
||||||
|
start.setRight(
|
||||||
|
constrainIntervals(start.right, new Interval(start.interval.high, start.right.interval.high)));
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void print() {
|
||||||
|
System.out.println("================");
|
||||||
|
print(root, 0);
|
||||||
|
System.out.println("================");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void print(TreeNode tree, int level) {
|
||||||
|
for (int i = 0; i < level; i++)
|
||||||
|
System.out.print("\t");
|
||||||
|
if (level != 0)
|
||||||
|
System.out.print("|");
|
||||||
|
for (int i = 0; i < level * 4; i++)
|
||||||
|
System.out.print("-");
|
||||||
|
|
||||||
|
if (tree == null)
|
||||||
|
System.out.println("NULL");
|
||||||
|
else {
|
||||||
|
System.out.println(tree.interval.toString() + ": " + tree.value);
|
||||||
|
print(tree.left, level + 1);
|
||||||
|
print(tree.right, level + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isEmpty() {
|
||||||
|
return size == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TreeNode {
|
||||||
|
|
||||||
|
V value;
|
||||||
|
Interval interval;
|
||||||
|
TreeNode left, right;
|
||||||
|
|
||||||
|
public TreeNode(Interval interval_, V value_, TreeNode left_, TreeNode right_) {
|
||||||
|
this.setInterval(interval_);
|
||||||
|
this.setValue(value_);
|
||||||
|
this.setLeft(left_);
|
||||||
|
this.setRight(right_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return this.interval.toString() + ": " + this.value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterval(int low_, int high_) {
|
||||||
|
this.interval.set(low_, high_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterval(Interval i) {
|
||||||
|
this.interval = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Interval getInterval() {
|
||||||
|
return this.interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(V value_) {
|
||||||
|
this.value = value_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public V getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeft(TreeNode left_) {
|
||||||
|
this.left = left_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRight(TreeNode right_) {
|
||||||
|
this.right = right_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode getLeft() {
|
||||||
|
return this.left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode getRight() {
|
||||||
|
return this.right;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,192 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.renderer;
|
||||||
|
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
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.math.ColorRGBA;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.scene.Geometry;
|
||||||
|
import com.jme3.scene.shape.Box;
|
||||||
|
import com.jme3.scene.shape.Sphere;
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!mgr.game.getRootNode().hasChild(chunk.chunkNode)) mgr.game.getRootNode().attachChild(chunk.chunkNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stupidArrayMeshing(WorldManager mgr, Chunk chunk) {
|
||||||
|
Blocks[] blocks = chunk.treeTo1DArray();
|
||||||
|
|
||||||
|
int idx;
|
||||||
|
for (int i = 0; i < Config.CHUNK_SIZE; i++) {
|
||||||
|
for (int j = 0; j < Config.CHUNK_SIZE; j++) {
|
||||||
|
|
||||||
|
for (int k = 0; k < Config.CHUNK_SIZE; k++) {
|
||||||
|
idx = Chunk.coord3DTo1D(i, j, k);
|
||||||
|
if (blocks[idx] != Blocks.AIR) {
|
||||||
|
Box b = new Box(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
|
Geometry geom = new Geometry("Box", b);
|
||||||
|
Material mat = new Material(mgr.game.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
|
// mat.getAdditionalRenderState().setWireframe(true);
|
||||||
|
geom.setMaterial(mat);
|
||||||
|
geom.getLocalTransform().setTranslation(i - 0.5f, j - 0.5f, k - 0.5f);
|
||||||
|
|
||||||
|
chunk.chunkNode.attachChild(geom);
|
||||||
|
|
||||||
|
if (blocks[idx] == Blocks.DIRT) {
|
||||||
|
mat.setColor("Color", ColorRGBA.Brown);
|
||||||
|
} else if (blocks[idx] == Blocks.STONE) {
|
||||||
|
mat.setColor("Color", ColorRGBA.Gray);
|
||||||
|
} else if (blocks[idx] == Blocks.GRASS) {
|
||||||
|
mat.setColor("Color", ColorRGBA.Green);
|
||||||
|
} else {
|
||||||
|
mat.setColor("Color", ColorRGBA.Red);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void greedyMeshing(WorldManager mgr, Chunk chunk) {
|
||||||
|
HashMap<Vector3f, Sphere> points = new HashMap<>();
|
||||||
|
|
||||||
|
// convert tree to array since it is easier to work with it
|
||||||
|
Blocks[] blocks = chunk.treeTo1DArray();
|
||||||
|
System.out.println(Arrays.toString(blocks));
|
||||||
|
|
||||||
|
Vector3f pos, belowPos;
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
for (int j = 0; j < 1; j++) {
|
||||||
|
Blocks prevBlock = null;
|
||||||
|
|
||||||
|
// For now I'm placing little spheres to show vertices instead of
|
||||||
|
// actually constructing a mesh
|
||||||
|
// Currently only meshing on XZ plane
|
||||||
|
|
||||||
|
for (int k = 0; k < Config.CHUNK_SIZE; k++) {
|
||||||
|
|
||||||
|
for (int i = 0; i < Config.CHUNK_SIZE; i++) {
|
||||||
|
idx = Chunk.coord3DTo1D(i, j, k);
|
||||||
|
pos = new Vector3f(i, j, k);
|
||||||
|
belowPos = new Vector3f(i, j, k - 1);
|
||||||
|
|
||||||
|
// Got a new type of block, place a vertex
|
||||||
|
if (blocks[idx] != prevBlock || prevBlock == null) {
|
||||||
|
// Check if we are at the start, if so just place
|
||||||
|
// vertices
|
||||||
|
if (k == 0) {
|
||||||
|
points.put(pos, new Sphere(25, 25, 0.25f));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if we are at the second step (right after
|
||||||
|
// start)
|
||||||
|
// if so, a new vertex needs to be placed whenever a
|
||||||
|
// quad can be completed
|
||||||
|
// if a quad cannot be completed but the block has
|
||||||
|
// changed, also place a vertex 1 lower to complete a
|
||||||
|
// quad
|
||||||
|
else if (k == 1) {
|
||||||
|
points.put(pos, new Sphere(25, 25, 0.25f));
|
||||||
|
if (blocks[idx] != blocks[Chunk.coord3DTo1D(i, j, k - 1)]) points.put(belowPos, new Sphere(25, 25, 0.25f));
|
||||||
|
}
|
||||||
|
// in any other situation
|
||||||
|
else {
|
||||||
|
if (blocks[idx] == blocks[Chunk.coord3DTo1D(i, j, k - 1)]) {
|
||||||
|
points.put(pos, new Sphere(25, 25, 0.25f));
|
||||||
|
points.remove(belowPos);
|
||||||
|
System.out.println("should be moving from " + belowPos + " to " + pos);
|
||||||
|
} else if (blocks[idx] != blocks[Chunk.coord3DTo1D(i, j, k - 1)]) points.put(belowPos, new Sphere(25, 25, 0.25f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prevBlock = blocks[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
for (Vector3f v : points.keySet()) {
|
||||||
|
System.out.println(v);
|
||||||
|
Geometry geom = new Geometry("Sphere", points.get(v));
|
||||||
|
geom.getLocalTransform().setTranslation(v);
|
||||||
|
|
||||||
|
Material mat = new Material(mgr.game.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
|
mat.getAdditionalRenderState().setWireframe(true);
|
||||||
|
geom.setMaterial(mat);
|
||||||
|
|
||||||
|
chunk.chunkNode.attachChild(geom);
|
||||||
|
}
|
||||||
|
|
||||||
|
points.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.utils;
|
||||||
|
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.Voxel;
|
||||||
|
|
||||||
|
public class Config {
|
||||||
|
public Voxel game;
|
||||||
|
|
||||||
|
public static int CHUNK_SIZE = 4;
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.utils;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
// 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){
|
||||||
|
return x + maxX * (y + z * maxY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// To check if this actually works
|
||||||
|
public static int[] coord1DTo3D(int idx, int maxX, int maxY, int mazZ){
|
||||||
|
final int z = idx / (maxX * maxY);
|
||||||
|
idx -= (z * maxX* maxY);
|
||||||
|
final int y = idx / maxX;
|
||||||
|
final int x = idx % maxX;
|
||||||
|
return new int[]{ x, y, z };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.world;
|
||||||
|
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.Queue;
|
||||||
|
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.data.Interval;
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.data.IntervalTree;
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.utils.Config;
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.utils.Utils;
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.world.blocks.Blocks;
|
||||||
|
import com.jme3.material.Material;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
import com.jme3.scene.Geometry;
|
||||||
|
import com.jme3.scene.Node;
|
||||||
|
|
||||||
|
public class Chunk {
|
||||||
|
|
||||||
|
Vector3f pos;
|
||||||
|
public IntervalTree<Blocks> blocks = new IntervalTree<Blocks>();
|
||||||
|
public Node chunkNode = new Node();
|
||||||
|
|
||||||
|
public Chunk() {
|
||||||
|
this(Vector3f.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chunk(Vector3f pos_) {
|
||||||
|
// 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 static int coord3DTo1D(int x, int y, int z) {
|
||||||
|
return Utils.coord3DTo1D(x, y, z, Config.CHUNK_SIZE, Config.CHUNK_SIZE, Config.CHUNK_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] coord1DTo3D(int idx) {
|
||||||
|
return Utils.coord1DTo3D(idx, Config.CHUNK_SIZE, Config.CHUNK_SIZE, Config.CHUNK_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Blocks getBlock(int x, int y, int z) {
|
||||||
|
return blocks.getSingleValue(Chunk.coord3DTo1D(x, y, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generatePlane() {
|
||||||
|
// blocks.print();
|
||||||
|
// blocks.insertValue(Blocks.STONE, new Interval(0,
|
||||||
|
// Config.CHUNK_3DCOORD_MAX_INDEX));
|
||||||
|
|
||||||
|
for (int i = 0; i < Config.CHUNK_SIZE; i++) blocks.insertValue(Blocks.STONE, new Interval(coord3DTo1D(0, 0, i), coord3DTo1D(Config.CHUNK_SIZE - 1, 0, i)));
|
||||||
|
for (int i = 0; i < Config.CHUNK_SIZE; i++) blocks.insertValue(Blocks.DIRT, new Interval(coord3DTo1D(0, 1, i), coord3DTo1D(Config.CHUNK_SIZE - 1, 1, i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateStair() {
|
||||||
|
for (int i = 0; i < Config.CHUNK_SIZE; i++) {
|
||||||
|
for (int j = 0; j < Config.CHUNK_SIZE; j++) {
|
||||||
|
blocks.insertValue(j < Config.CHUNK_SIZE - i - 1 ? Blocks.STONE : Blocks.GRASS, new Interval(coord3DTo1D(0, i, j), coord3DTo1D(Config.CHUNK_SIZE - 1, i, j)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Blocks[] treeTo1DArray() {
|
||||||
|
// System.out.println(Config.CHUNK_3DCOORD_MAX_INDEX);
|
||||||
|
Blocks[] result = new Blocks[Config.CHUNK_3DCOORD_MAX_INDEX + 1];
|
||||||
|
|
||||||
|
Queue<IntervalTree<Blocks>.TreeNode> queue = new ArrayDeque();
|
||||||
|
queue.add(blocks.getRoot());
|
||||||
|
|
||||||
|
IntervalTree<Blocks>.TreeNode t;
|
||||||
|
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());
|
||||||
|
|
||||||
|
for (int i = t.getInterval().getLow(); i <= t.getInterval().getHigh(); i++) result[i] = t.getValue();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.world;
|
||||||
|
|
||||||
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Queue;
|
||||||
|
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.Voxel;
|
||||||
|
import com.emamaker.voxeltest.intervaltrees.renderer.ChunkRenderer;
|
||||||
|
import com.jme3.math.Vector3f;
|
||||||
|
|
||||||
|
public class WorldManager {
|
||||||
|
|
||||||
|
public final Voxel game;
|
||||||
|
|
||||||
|
ChunkRenderer chunkRenderer = new ChunkRenderer();
|
||||||
|
|
||||||
|
HashMap<Vector3f, Chunk> chunks = new HashMap<>();
|
||||||
|
Queue<Chunk> chunkToModel = new ArrayDeque();
|
||||||
|
ArrayList<Chunk> chunksToRender = new ArrayList<>();
|
||||||
|
|
||||||
|
public WorldManager(final Voxel game_) {
|
||||||
|
this.game = game_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initWorld() {
|
||||||
|
chunks.put(Vector3f.ZERO, new Chunk());
|
||||||
|
chunks.get(Vector3f.ZERO).generateStair();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.emamaker.voxeltest.intervaltrees.world.blocks;
|
||||||
|
|
||||||
|
public enum Blocks {
|
||||||
|
|
||||||
|
AIR,
|
||||||
|
STONE,
|
||||||
|
DIRT,
|
||||||
|
GRASS
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
Loading…
Reference in New Issue